270 lines
100 KiB
JavaScript
270 lines
100 KiB
JavaScript
(function(){/*
|
|
http://pcjs.org/modules/shared/lib/dumpapi.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/reportapi.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/userapi.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/keys.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/strlib.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/usrlib.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/weblib.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/messages.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/debugger.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/debugger.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/embed.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/defines.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/component.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/defines.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/panel.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/bus.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/device.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/memory.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/cpu.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/cpustate.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/cpuops.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/rom.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/ram.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/keyboard.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/serialport.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/pc11.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/computer.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/state.js (C) Jeff Parsons 2012-2016
|
|
*/
|
|
for(var h,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ba="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this,da=["Math","log2"],ea=0;ea<da.length-1;ea++){var fa=da[ea];fa in ba||(ba[fa]={});ba=ba[fa]}var ga=da[da.length-1],ha=ba[ga],ma=ha?ha:function(a){return Math.log(a)/Math.LN2};
|
|
ma!=ha&&null!=ma&&aa(ba,ga,{configurable:!0,writable:!0,value:ma});function na(a,b,c){var d="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}function 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,k;k=c(b,a[g]);0<k?d=g+1:(e=g,f=!k)}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 k=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(k.onreadystatechange=function(){4===k.readyState&&(f=k.responseText,200==k.status||!k.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=k.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,"+");k.open("POST",a,!!c);k.setRequestHeader("Content-type","application/x-www-form-urlencoded");k.send(m)}else k.open("GET",a,!!c),"bytes"==b&&k.overrideMimeType("text/plain; charset=x-user-defined"),k.send();c||(f=k.responseText,200!=k.status&&(e=k.status||-1),d&&d(a,f,e),g=[f,e]);return g}
|
|
function Ca(a,b){var c,d={ia:null,ka:null,Lb:null,Kb: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.Lb=g.load;d.Kb=g.exec;if(e=g.bytes)d.ia=e;else if(e=g.words)for(d.ia=Array(2*e.length),f=c=0;c<e.length;c++)d.ia[f++]=e[c]&255,d.ia[f++]=e[c]>>8&255;else if(e=g.data)for(d.ia=Array(4*e.length),f=c=0;c<e.length;c++)d.ia[f++]=
|
|
e[c]&255,d.ia[f++]=e[c]>>8&255,d.ia[f++]=e[c]>>16&255,d.ia[f++]=e[c]>>24&255;else d.ia=g;d.ka=g.symbols;d.ia.length?1==d.ia.length&&(n(d.ia[0]),d=null):(n("Empty resource: "+a),d=null)}catch(k){n("Resource data error ("+a+"): "+k.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.ia=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.Yb=b.comment;this.tc=b;b=this.id.indexOf(".");0>b?this.Wa=this.id:(this.Ra=this.id.substr(0,b),this.Wa=this.id.substr(b+1));this[a]=c;this.v={ready:!1,Ia:!1,Ib:!1,ha:!1,error:!1};this.zb=null;this.v.error=!1;this.J={};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 k=g.split(" "),m=0;m<k.length;m++)switch(g=k[m],g){case "pdp11-binding":(g=z(f))&&g.binding&&a.ra(g.type,g.binding,f,g.value),m=k.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.J[b]||(this.J[b]=c,c.onclick=function(a){return function(){a.J.print&&(a.J.print.value="")}}(this)),!0;case "print":return this.J[b]||(this.Ta=this.J[b]=c,c.value="",this.j=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
|
|
this.ga=function(a){this.j(a,this.Wa)}),!0;default:return!1}},log:function(){},j:function(){},status:function(a){this.j(this.Wa+": "+a)},ga:function(a,b,c){c=c||this.type;b||n((c?c+": ":"")+a)},Aa:function(){return this.v.ha=!0},za:function(a,b){b&&(this.v.ha=!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.Ib)return a.v.Ia=!1,a.v.Ib=!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.Ib=!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.zb;a.zb=null;b&&b()}}function pb(a,b){b&&(a.v.ready?b():a.zb=b);return a.v.ready}function qb(a){return a.v.error?(a.j(a.toString()+" error"),!0):!1}function rb(a,b){a.v.error=!0;a.ga(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.Wb=!0}u(ub);h=ub.prototype;
|
|
h.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.J[b]=c,this.f++,!0;default:return"rled"==a?(this.J[b]=c,this.f++,!0):this.parent.ra.call(this,a,b,c,d)}};h.Ca=function(a,b,c,d){this.D=a;this.w=b;this.b=c;this.i=d};h.Aa=function(a,b){b||Ib();return!0};h.za=function(){return!0};
|
|
function Jb(a,b,c,d){if(a.J[b]){void 0===c&&(rb(a,"Value for "+b+" is invalid"),a.b.da());var e=a.i&&a.i.ma||8;c=!a.b.v.ca||a.v.Wb?8==e?na(c,d):l(c,d):"--------".substr(0,d||4);a.J[b].textContent!=c&&(a.J[b].textContent=c)}}function Kb(a,b,c,d){for(var e=0;e<d;e++){var f=a.J[b+e];f&&(f.style.backgroundColor=c&1<<e?"#ff0000":"#000000")}}
|
|
h.$=function(a){if(this.f&&(a||!this.b.v.ca||this.v.Wb)){for(a=0;a<this.b.u.length;a++)Jb(this,"R"+a,this.b.u[a]);a=Lb(this.b);Jb(this,"PS",a);Jb(this,"NF",a&8?1:0,1);Jb(this,"ZF",a&4?1:0,1);Jb(this,"VF",a&2?1:0,1);Jb(this,"CF",a&1?1:0,1);Kb(this,"D",this.b.u[0],16);Kb(this,"A",this.b.u[7],22)}};function Ib(){for(var a=!1,b=B(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=z(d),f=lb(e.id);f||(a=!0,f=new 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.ja=Math.log2(this.ua);this.I=this.ua>>2;this.w=this.ua-1;this.B=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.B);for(b=0;b<this.B;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)))}}h=Mb.prototype;h.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}h.Aa=function(a,b){b||this.reset();return!0};
|
|
function Yb(a,b,c,d,e){for(var f=b,g=c,k=f>>>a.ja;0<g&&k<a.W.length;){var m=a.W[k],p=k*a.ua,q=a.ua-(f-p);q>g&&(q=g);if(!e&&m&&m.size){if(m.type==d){if(f+g<=m.C)return m.vb+=m.C-f,m.C=f,!0;if(f>=m.C+m.vb){q=m.size-(f-p);q>g&&(q=g);m.vb=f-m.C+q;f=p+a.ua;g-=q;k++;continue}}return ac(1,f,g)}f=new I(a,f,q,a.ua,d,e);Sb(f,a.i,m);a.W[k++]=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.ja;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.ja;0<c&&b<a.W.length;){var f=d[e++];if(!f)break;a.W[b++]=f;c-=a.ua}}h.ob=function(a){return this.W[(a&this.f)>>>this.ja].Eb(a&this.w,a)};h.Bb=function(a){this.A++;a=this.W[(a&this.f)>>>this.ja].Mb(a&this.w,a);this.A--;return a};h.na=function(a){return this.W[(a&this.f)>>>this.ja].oa(a&this.w,a)};
|
|
h.pb=function(a){var b=a&this.w,c=(a&this.f)>>>this.ja;this.A++;a=this.W[c].Nb(b,a);this.A--;return a};h.Fb=function(a,b){this.W[(a&this.f)>>>this.ja].Hb(a&this.w,b&255,a)};h.hb=function(a,b){this.A++;this.W[(a&this.f)>>>this.ja].Sb(a&this.w,b&255,a);this.A--};h.Va=function(a,b){this.W[(a&this.f)>>>this.ja].wb(a&this.w,b&65535,a)};h.Gb=function(a,b){var c=a&this.w,d=(a&this.f)>>>this.ja;this.A++;this.W[d].Tb(c,b&65535,a);this.A--};
|
|
function cc(a){for(var b=0,c=[],d=0;d<a.B;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,k=0,m=[];g<e.length;){for(var p=e[g],q=g+1;q<e.length&&e[q]===p;)q++;m[k++]=q-g;m[k++]=p;g=q}m.length<e.length&&(e=m)}c[f]=e}}return c}function dc(a,b,c,d,e,f,g,k){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,k||"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.ab)){var g=f[0]?f[0].bind(b):null,k=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)),!k&&p&&(k=function(a){return function(b,c){return a(b,c)}.bind(b)}(p)));dc(a,e,e,g,k,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,Db:20,gd:0};this.f={Td:0,Rb:-1}}u(K);h=K.prototype;
|
|
h.Ca=function(a,b,c,d){this.w=b;this.b=c;this.i=d;var e=this;this.f.Rb=hc(c,function(){e.f.Ka|=128;e.f.Ka&64&&(qc(e.b,e.f.hd),rc(e.b,e.f.Rb,1E3/60))});this.f.hd=sc(64,6);ec(b,this,L);fc(b,this.reset.bind(this));H(this)};h.reset=function(){this.g.Db=this.g.Db&-120|20;this.f.Ka=0};h.Dc=function(){var a=this.f.Ka;this.f.Ka&=-129;return a};h.rd=function(a){this.f.Ka=a;a&64&&rc(this.b,this.f.Rb,1E3/60);this.f.Ka=a&-129};h.wc=function(a){return(a?this.g.gd:this.g.data)&65535};
|
|
h.kd=function(a){this.g.data=a};h.Fc=function(){var a=this.b;return a.F&62337|a.wa<<5|a.xa<<1};h.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)};h.Gc=function(){var a=this.b.Na;a&65280&&(a=(a<<8|a>>8)&65535);return a};h.Hc=function(){return this.b.tb};h.Ic=function(){return this.b.Oa};
|
|
h.ud=function(a){var b=this.b;1170>b.ab&&(a&=-49);b.Oa!=a&&(b.Oa=a,a&16?(b.Za=4194303,b.ya=3915776):(b.Za=262143,b.ya=253952),tc(b));uc(this)};function uc(a){a.g.Db=a.g.Db&-8|(a.b.La?a.b.Oa&16?1:2:4)}h.Wc=function(a){return this.b.S[1][a>>1&7]};h.Id=function(a,b){this.b.S[1][b>>1&7]=a&65295};h.Uc=function(a){return this.b.S[1][(a>>1&7)+8]};h.Gd=function(a,b){this.b.S[1][(b>>1&7)+8]=a&65295};h.Vc=function(a){return this.b.ta[1][a>>1&7]};
|
|
h.Hd=function(a,b){b=b>>1&7;this.b.ta[1][b]=a;this.b.S[1][b]&=65295};h.Tc=function(a){return this.b.ta[1][(a>>1&7)+8]};h.Fd=function(a,b){b=(b>>1&7)+8;this.b.ta[1][b]=a;this.b.S[1][b]&=65295};h.Cc=function(a){return this.b.S[0][a>>1&7]};h.qd=function(a,b){this.b.S[0][b>>1&7]=a&65295};h.Ac=function(a){return this.b.S[0][(a>>1&7)+8]};h.od=function(a,b){this.b.S[0][(b>>1&7)+8]=a&65295};h.Bc=function(a){return this.b.ta[0][a>>1&7]};h.pd=function(a,b){b=b>>1&7;this.b.ta[0][b]=a;this.b.S[0][b]&=65295};
|
|
h.zc=function(a){return this.b.ta[0][(a>>1&7)+8]};h.nd=function(a,b){b=(b>>1&7)+8;this.b.ta[0][b]=a;this.b.S[0][b]&=65295};h.bd=function(a){return this.b.S[3][a>>1&7]};h.Od=function(a,b){this.b.S[3][b>>1&7]=a&65295};h.$c=function(a){return this.b.S[3][(a>>1&7)+8]};h.Md=function(a,b){this.b.S[3][(b>>1&7)+8]=a&65295};h.ad=function(a){return this.b.ta[3][a>>1&7]};h.Nd=function(a,b){b=b>>1&7;this.b.ta[3][b]=a;this.b.S[3][b]&=65295};h.Zc=function(a){return this.b.ta[3][(a>>1&7)+8]};
|
|
h.Ld=function(a,b){b=(b>>1&7)+8;this.b.ta[3][b]=a;this.b.S[3][b]&=65295};h.fb=function(a){a&=7;return this.b.L&2048?this.b.Ea[a]:this.b.u[a]};h.kb=function(a,b){b&=7;this.b.L&2048?this.b.Ea[b]=a:this.b.u[b]=a};h.Nc=function(){return this.b.L&49152?this.b.va[0]:this.b.u[6]};h.zd=function(a){this.b.L&49152?this.b.va[0]=a:this.b.u[6]=a};h.Qc=function(){return this.b.u[7]};h.Cd=function(a){this.b.u[7]=a};h.gb=function(a){a&=7;return this.b.L&2048?this.b.u[a]:this.b.Ea[a]};
|
|
h.lb=function(a,b){b&=7;this.b.L&2048?this.b.u[b]=a:this.b.Ea[b]=a};h.Oc=function(){return 1==(this.b.L&49152)>>14?this.b.u[6]:this.b.va[1]};h.Ad=function(a){1==(this.b.L&49152)>>14?this.b.u[6]=a:this.b.va[1]=a};h.Pc=function(){return 3==(this.b.L&49152)>>14?this.b.u[6]:this.b.va[3]};h.Bd=function(a){3==(this.b.L&49152)>>14?this.b.u[6]=a:this.b.va[3]=a};h.yc=function(a){return this.b.gc[a-65504>>1]};h.md=function(a,b){this.b.gc[b-65504>>1]=a};h.dc=function(a){return 65520==a?61183:0};h.jc=function(){};
|
|
h.Yc=function(){return 1};h.Kd=function(){};h.xc=function(){return this.b.Z};h.ld=function(){this.b.Z=0};h.Ec=function(){return this.b.fc};h.sd=function(a,b){b&1||(a&=255);this.b.fc=a};h.Jc=function(a){return a?this.b.Pb:0};h.vd=function(a){var b=this.b;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.Pb=a;b.G|=2};h.Xc=function(a){return a?this.b.Pa&65280:0};h.Jd=function(a){this.b.Pa=a|255};h.Mc=function(){return Lb(this.b)};h.yd=function(a){vc(this.b,a&-1809|Lb(this.b)&1808);this.b.G|=128};
|
|
h.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.fb,K.prototype.kb,"R0SET0"],M[65473]=[null,null,K.prototype.fb,K.prototype.kb,"R1SET0"],M[65474]=[null,null,K.prototype.fb,K.prototype.kb,"R2SET0"],M[65475]=[null,null,K.prototype.fb,K.prototype.kb,"R3SET0"],M[65476]=[null,null,K.prototype.fb,K.prototype.kb,"R4SET0"],M[65477]=[null,null,K.prototype.fb,K.prototype.kb,"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.gb,K.prototype.lb,"R0SET1",1145],M[65481]=[null,null,K.prototype.gb,K.prototype.lb,"R1SET1",1145],M[65482]=[null,null,K.prototype.gb,K.prototype.lb,"R2SET1",1145],M[65483]=[null,null,K.prototype.gb,K.prototype.lb,"R3SET1",1145],M[65484]=[null,null,K.prototype.gb,K.prototype.lb,"R4SET1",1145],M[65485]=[null,null,K.prototype.gb,K.prototype.lb,"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.C=b;this.vb=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.B=new Uint8Array(this.A,0,d),this.I=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.J++||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.C),!0),this.i.da());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.C),!0),this.i.da())},M:function(a,b){return this.Eb(a++,b++)|this.Eb(a,b)<<8},H:function(a,b,c){this.Hb(a++,b&255,c++);this.Hb(a,b>>8,c)},V:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},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},Wa: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.C){var c=this.i;Kc(c,this.C+a,1,c.M)&&c.da(!0)}return this.Mb(a,b)},ba:function(a,b){if(this.i&&null!=this.C){var c=this.i;Kc(c,this.C+a,2,c.M)&&c.da(!0)}return this.Nb(a,b)},qa:function(a,b,c){if(this.i&&null!=this.C){var d=this.i;Kc(d,this.C+a,
|
|
1,d.B)&&d.da(!0)}this.f?this.D(a,b,c):this.Sb(a,b,c)},xa:function(a,b,c){if(this.i&&null!=this.C){var d=this.i;Kc(d,this.C+a,2,d.B)&&d.da(!0)}this.f?this.D(a,b,c):this.Tb(a,b,c)},N:function(a){return this.B[a]},U:function(a,b){a=this.B[a];this.i&&D(this.i,128)&&C(this.i,"Memory.readByte("+J(this.i,b)+"): "+J(this.i,a),!0);return a},aa: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.I[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.B[a]=b;this.Ja=!0},Ra:function(a,b,c){this.B[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.I[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.J=0;c&&((a.g=c.g)&&Jc(a,Ic,!1),(a.J=c.J)&&Hc(a,Ic,!1))}function Lc(a,b){b?--a.J||(a.Hb=a.f?a.D:a.Sb,a.wb=a.f?a.H:a.Tb):--a.g||(a.Eb=a.Mb,a.oa=a.Nb)}function Hc(a,b,c){c&&a.J||(a.Hb=!a.f&&b[1]||a.D,a.wb=!a.f&&b[3]||a.H);if(c||void 0===c)a.Sb=b[1]||a.D,a.Tb=b[3]||a.H}function Jc(a,b,c){c&&a.g||(a.Eb=b[0]||a.K,a.oa=b[2]||a.M);if(c||void 0===c)a.Mb=b[0]||a.K,a.Nb=b[2]||a.M}function Dc(a,b){b||(b=Mc);Jc(a,b,void 0);Hc(a,b,void 0)}
|
|
var Mc=[],Gc=[I.prototype.V,I.prototype.sa,I.prototype.ma,I.prototype.Wa],Ic=[I.prototype.O,I.prototype.qa,I.prototype.ba,I.prototype.xa];if(sb)var Fc=[I.prototype.N,I.prototype.pa,I.prototype.aa,I.prototype.wa],Ec=[I.prototype.U,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.Ya=Math.round(this.Ga/1E4)/100;this.Ua=this.Ya*this.Ma;this.v.ca=!1;this.v.Qb=!1;this.v.mb=a.autoStart;this.v.$a=!1;this.qb=this.ma=0;this.rb=a.csStart;this.bb=a.csInterval;this.cb=a.csStop;this.K=[];this.bc=this.fd.bind(this);H(this)}u(Nc);var Oc=["power","reset"];h=Nc.prototype;
|
|
h.Ca=function(a,b,c,d){this.D=a;this.w=b;this.i=d;for(b=0;b<Oc.length;b++)(c=this.J[Oc[b]])&&this.D.ra(null,Oc[b],c);a=Pc(a,"autoStart");null!=a&&(this.v.mb="true"==a?!0:"false"==a?!1:!!a);H(this)};h.reset=function(){};h.save=function(){return null};h.restore=function(){return!1};
|
|
h.Aa=function(a,b){if(!b){if(a&&this.restore){Qc(this);if(!this.restore(a))return!1;Rc(this)}else this.reset();this.i?(a=this.i,a.j("Type ? for help with PDP11 Debugger commands"),a.$(),a.Ga&&(b=a.Ga,a.Ga=null,Sc(a,b))):this.j("No debugger detected")}this.D.$();return!0};h.za=function(a){return a?this.save():!0};h.mb=function(){return this.v.mb||!this.i&&void 0===this.J.run?(this.ib(!0),!0):!1};h.Zb=function(){return 0};
|
|
function Rc(a){void 0===a.rb&&(a.rb=0);void 0===a.bb&&(a.bb=-1);void 0===a.cb&&(a.cb=-1);a.v.$a=0<=a.rb&&0<a.bb;a.v.$a&&(a.qb=0,a.ma=a.rb-a.fa)}function Tc(a,b){if(a.v.$a){var c=!1;a.qb=a.qb+a.Zb()|0;a.ma-=b;0>=a.ma&&(a.ma+=a.bb,c=!0);0<=a.cb&&a.cb<=Uc(a)&&(a.bb=a.cb=-1,Rc(a),a.da(),c=!0);c&&a.j(Uc(a)+" cycles: checksum="+l(a.qb))}}
|
|
h.ra=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.J[b]=c,!0;case "run":return this.J[b]=c,c.onclick=function(){var a;if(a=d.D)if(a=d.D,a.v.ha)a=!0;else{var b=null,c,k=kb(a.id);for(c=0;c<k.length&&(b=k[c],b===a||b.v.ready);c++);if(c==k.length)for(c=0;c<k.length&&(b=k[c],b===a||b.v.ha);c++);c==k.length&&(b=a);n("The "+b.type+" component ("+b.id+") is not "+(b.v.ready?"powered yet":"ready yet"+(b.zb?" (waiting for notification)":""))+".");a=!1}a&&(d.v.ca?d.da():d.ib())},
|
|
!0;case "speed":return this.J[b]=c,!0;case "setSpeed":return this.J[b]=c,c.onclick=function(){Vc(d,d.Ma<<1,!0)},c.textContent=this.Ua.toFixed(2)+"Mhz",!0}return!1};h.$=function(){var a=this.J.speed;a&&(a.textContent=this.v.ca&&this.V?this.V.toFixed(2)+"Mhz":"Stopped")};function Wc(a,b,c){a.fa+=b;c&&(a.ba=a.b=0)}function Xc(a,b){var c=1;b&&1<a.Ma&&a.V&&(c=a.V/a.Ya);a.Ab=Math.round(1E3/30);a.Qa=Math.floor(a.Ga/30*c);b||(a.pa=a.Qa);a.nb=0}function Uc(a){return a.fa+a.O+a.ba-a.b}
|
|
function Qc(a){a.V=0;a.Cb=0;a.fa=a.O=a.ba=a.b=0;Rc(a);Vc(a,1)}function Vc(a,b,c){var d=!1;if(void 0!==b){.8>a.V/a.Ua?b=1:d=!0;a.Ma=b;b=a.Ya*a.Ma;if(a.Ua!=b){a.Ua=b;b=a.Ua.toFixed(2)+"Mhz";var e=a.J.setSpeed;e&&(e.textContent=b);a.j("target speed: "+b)}c&&a.D&&a.D.ub()}Wc(a,a.O);a.O=0;a.N=za();a.aa=0;Xc(a);return d}function hc(a,b){var c=a.K.length;a.K.push([-1,b]);return c}function rc(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.ba-=a.b;a.b=0;b&&(a.ba=0);return c}
|
|
h.fd=function(){if(this.v.ca){this.nb>=this.Ga&&Xc(this,!0);this.sa=0;this.Fa=za();if(this.aa){var a=this.Fa-this.aa;a>this.Ab&&(this.N+=a,this.N>this.Fa&&(this.N=this.Fa))}try{do{var b=Zc(this,this.v.$a?1:this.Qa);try{this.jb(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.Cb&&(this.D&&this.D.$(),this.Cb=0);break}}while(this.v.ca)}catch(e){this.da();this.D&&this.D.stop(za(),Uc(this));rb(this,
|
|
e.stack||e.message);return}if(this.v.ca){a=setTimeout;b=this.bc;this.aa=za();var c=this.Ab;this.sa&&(c=Math.round(c*this.sa/this.Qa));var c=c-(this.aa-this.Fa),d=this.aa-this.N;d&&(this.V=Math.round(this.O/(10*d))/100,864E5<=d&&(this.fa=0,Vc(this)));if(0>c||this.V<this.Ua)-1E3>c&&(this.N-=c),c=0;this.nb+=this.sa;this.aa+=c;a(b,c)}}};
|
|
h.ib=function(a){if(qb(this))return!1;if(this.v.ca)return this.j(this.toString()+" busy"),!1;Vc(this);this.v.ca=!0;this.v.Qb=!0;var b=this.J.run;b&&(b.textContent="Halt");this.D&&(a&&this.D.ub(!0),this.D.start(this.N,Uc(this)));setTimeout(this.bc,0);return!0};h.jb=function(){return 0};h.da=function(a){if(this.v.ca){Yc(this);Wc(this,this.O);this.O=0;this.v.ca=!1;var b=this.J.run;b&&(b.textContent="Run");this.D&&this.D.stop(za(),Uc(this))}this.v.complete=a};
|
|
function ad(a){this.ab=+a.model||1170;this.xb=a.addrReset||0;Nc.call(this,a,6666667);this.decode=1120==this.ab?bd.bind(this):cd.bind(this);dd(this);this.A=0;this.U=null;this.v.complete=this.v.oc=!1}u(ad,Nc);h=ad.prototype;h.reset=function(){this.status("model "+this.ab);this.v.ca&&this.da();dd(this);Qc(this);this.v.error=!1;this.parent.reset.call(this)};
|
|
function dd(a){a.P=65536;a.R=32768;a.X=65535;a.T=32768;a.L=15;a.u=[0,0,0,0,0,0,0,a.xb];a.Ea=[0,0,0,0,0,0];a.va=[0,0,0,0];a.B=0;a.xa=0;a.sc=[4,2,0,1];a.S=[[0,0,0,0,0,0,0,0,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.I=0;a.g=a.f=a.Xa=0;a.qa=-1;ed(a)}function ed(a){a.Pa=255;a.Z=0;a.Pb=0;a.F=0;a.Na=0;a.tb=0;a.Oa=0;a.La=0;a.wa=0;a.Za=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.wb=a.Pd,Vb(a.w,a.Oa&16?22:18)):(a.M=0,a.Y=a.qc,a.oa=a.ec,a.wb=a.kc,Vb(a.w,16))}h.Zb=function(){return 0};
|
|
h.save=function(){var a=new N(this);a.set(0,[]);a.set(1,[this.fa,this.Ma]);a.set(2,cc(this.w));return a.data()};h.restore=function(a){var b=a[1];this.fa=b[1];Vc(this,b[3]);a:{b=this.w;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.I){for(var f=0,g=Array(b.I),k=0;k<e.length-1;)for(var m=e[k++],p=e[k++];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 fd(a){return a.P&65536?1:0}
|
|
function gd(a){return a.R&32768?2:0}function hd(a){return a.X&65535?0:4}h.Da=function(){return this.T&32768?8:0};function id(a){var b=a.u[7];a.F&57344||(a.Na=0,a.tb=b);a.u[7]=b+2&65535;return a.oa(b)}function Cd(a,b){var c=a.u[7];a.u[7]=c+b&65535;return c}function O(a,b){a.u[7]=b&65535}function sc(a,b){return{jd:a,eb:b,next:null}}function qc(a,b){if(b!=a.U){var c=a.U;if(!c||c.eb<=b.eb)b.next=c,a.U=b;else{do{var d=c.next;if(!d||d.eb<=b.eb){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()|hd(a)|gd(a)|fd(a)}function vc(a,b){a.T=b<<12;a.X=~b&4;a.R=b<<14;a.P=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.B=b>>14&3;c=a.L>>14&3;a.B!=c&&(a.va[c]=a.u[6],a.u[6]=a.va[a.B]);a.L=b;a.G|=2}function P(a,b){a.G&128||(a.T=a.X=b,a.R=0)}function Dd(a,b,c){a.G&128||(a.T=a.X=a.P=b,a.R=c||0)}function Ed(a,b,c,d){a.G&128||(a.T=a.X=a.P=b,a.R=(c^b)&(d^b))}function Fd(a,b){a.G&128||(a.T=a.X=a.P=b,a.R=a.T^a.P>>1)}
|
|
function Gd(a,b,c,d){a.G&128||(a.T=a.X=a.P=b,a.R=(c^d)&(d^b))}h.ea=function(a,b){if(!this.A){var c=!1;0>this.qa?this.qa=Lb(this):this.B||(a=4,c=!0);this.F&57344||(this.Na=63222,this.tb=a);this.B=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);Hd(this,this.qa);Hd(this,this.u[7]);O(this,d);this.G&=-113;this.qa=-1;if(26!=b)throw a;}};function Id(a){var b=Jd(a),c=Jd(a)&-1793;a.L&49152&&(c=c&-225|a.L&63712);O(a,b);vc(a,c);a.G&=-17}
|
|
function Kd(a,b,c){var d,e,f,g=0;d=b>>13;a.Oa&a.sc[a.B]||(d&=7);e=a.S[a.B][d];f=(a.ta[a.B][d]<<6)+(b&8191)&a.Za;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 k=f>>13&31;31>k?a.Oa&32&&(f=a.uc[k]+(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.S[a.B][d]=e;if(4194170!==f||a.B)a.wa=a.B,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 Ld(a,b){return a.w.ob(b)}function Md(a,b,c){b&1&&a.b--;a.w.Fb(b,c&255)}function Jd(a){var b=a.oa(a.u[6]|a.M);a.u[6]=a.u[6]+2&65535;return b}
|
|
function Hd(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.F&57344||(a.Na=a.Na<<8|246);!a.B&&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.wb(c,b)}
|
|
function Nd(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.B&&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(Cd(a,2)),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=a.oa(Cd(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.B&&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}h.Bb=function(a){if(!this.La)return this.w.Bb(a);this.A++;a=Ld(this,Kd(this,a,3));this.A--;return a};
|
|
h.pb=function(a){if(!this.La)return this.w.pb(a);this.A++;a=this.ec(Kd(this,a,2));this.A--;return a};h.hb=function(a,b){this.La?(this.A++,Md(this,Kd(this,a,5),b),this.A--):this.w.hb(a,b)};h.Gb=function(a,b){this.La?(this.A++,this.kc(Kd(this,a,4),b),this.A--):this.w.Gb(a,b)};h.qc=function(a,b,c){return Nd(this,a,b,c)};h.rc=function(a,b,c){return Kd(this,Nd(this,a,b,c),c)};h.ec=function(a){return this.w.na(a)};h.cd=function(a){return this.w.na(Kd(this,a,2))};h.kc=function(a,b){this.w.Va(a,b&65535)};
|
|
h.Pd=function(a,b){this.w.Va(Kd(this,a,4),b)};function Od(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=Nd(a,b,d,2),c&65536||61440!==(a.L&61440)&&(d&=65535),a.B=a.L>>12&3,c=a.oa(d|c&a.M),a.B=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 Pd(a,b,c,d){a.F&57344||(a.Na=22);var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=Nd(a,b,e,4),c&65536||(e&=65535),a.B=a.L>>12&3,e=Kd(a,e|c&65536,4),a.B=a.L>>14&3,a.w.Va(e,d)):6!=e||(a.L>>2&12288)===(a.L&12288)?a.u[e]=d:a.va[a.L>>12&3]=d}
|
|
function Qd(a,b){b>>=6;var c=a.I=b&7;return(b=a.H=(b&56)>>3)?Ld(a,a.Y(b,c,3)):a.u[c]&255}function Rd(a,b){b>>=6;var c=a.I=b&7;return(b=a.H=(b&56)>>3)?a.w.na(a.Y(b,c,2)):a.u[c]}function Sd(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return Nd(a,b,c,8)}function Td(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?Ld(a,a.Y(b,c,3)):a.u[c]&255}function Ud(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.Xa=a.Y(b,e,7),Md(a,e,d.call(a,c,Ld(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.Va(e,d.call(a,c,a.w.na(e)))):a.u[e]=d.call(a,c,a.u[e])}function Vd(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?Md(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 Wd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?a.w.Va(a.Y(b,d,4),c):a.u[d]=c&65535;return c}
|
|
function S(a,b,c){c&&(O(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3}
|
|
h.jb=function(a){this.v.complete=!0;var b=this.v.oc=this.i&&Xd(this.i),c=a?this.v.Qb?0:1:-1;this.v.Qb=!1;this.ba=this.b=a;do{if(b){if(Yd(this.i,this.u[7],c)){this.da();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.Pb&224)>>5;if(a=this.U&&this.U.eb>e?this.U:null)d=a.jd,e=a.eb;e>(this.L&224)>>5?(this.G&4&&(Cd(this,2),this.G&=-5),this.ea(d,26),e=!0):e=!1;if(e&&a)if(e=this.U,
|
|
e==a)this.U=a.next;else for(;e;){d=e.next;if(d==a){e.next=d.next;break}e=d}}else this.G&1&&this.G++;this.G=this.G&7|this.L&16;this.decode(id(this))}while(0<this.b);return this.v.complete?this.ba-this.b:void 0===this.v.complete?0:-1};Ta(function(){for(var a=B(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new ad(d);A(d,c)}});function Zd(a,b){var c=b+a;Ed(this,c,a,b);return c&65535}function $d(a,b){var c=b+a;Ed(this,c<<8,a<<8,b<<8);return c&255}
|
|
function ae(a,b){a=b<<1;Fd(this,a);return a&65535}function be(a,b){a=b<<1;Fd(this,a<<8);return a&255}function ce(a,b){a=b&32768|b>>1|b<<16;Fd(this,a);return a&65535}function de(a,b){a=b&2048|b>>1|b<<8;Fd(this,a<<8);return a&255}function ee(a,b){a=b&~a;P(this,a);return a}function fe(a,b){a=b&~a;P(this,a<<8);return a}function ge(a,b){a|=b;P(this,a);return a}function he(a,b){a|=b;P(this,a<<8);return a}function ie(a,b){a=~b|65536;Dd(this,a);return a&65535}
|
|
function je(a,b){a=~b|256;Dd(this,a<<8);return a&255}function ke(a,b){a=b-a;this.G&128||(this.T=this.X=a,this.R=b&(b^a));return a&65535}function le(a,b){a=b-a;var c=a<<8;b<<=8;this.G&128||(this.T=this.X=c,this.R=b&(b^c));return a&255}function me(a,b){a=b+a;this.G&128||(this.T=this.X=a,this.R=a&(b^a));return a&65535}function ne(a,b){a=b+a;var c=a<<8;this.G&128||(this.T=this.X=c,this.R=c&(b<<8^c));return a&255}function oe(a,b){a=-b;Dd(this,a,a&b&32768);return a&65535}
|
|
function pe(a,b){a=-b;Dd(this,a<<8,(a&b&128)<<8);return a&255}function qe(a,b){a=b<<1|this.P>>16&1;Fd(this,a);return a&65535}function re(a,b){a=b<<1|this.P>>16&1;Fd(this,a<<8);return a&255}function se(a,b){a=(this.P&65536|b)>>1|b<<16;Fd(this,a);return a&65535}function te(a,b){a=((this.P&65536)>>8|b)>>1|b<<8;Fd(this,a<<8);return a&255}function ue(a,b){var c=b-a;Gd(this,c,a,b);return c&65535}function ve(a,b){var c=b-a;Gd(this,c<<8,a<<8,b<<8);return c&255}
|
|
function we(a,b){this.G&128||(this.T=this.X=b&65280,this.R=this.P=0);return(b<<8|b>>8)&65535}function xe(a,b){a^=b;P(this,a);return a&65535}function ye(a){R(this,a,Rd(this,a),Zd);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}
|
|
function ze(a){var b=Ud(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.P=this.R=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.P=c<<17-b,c>>=b;else if(b)if(16<b)this.R=c,c=0;else{this.P=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.R=32768)}this.u[a]=c&65535;this.T=this.X=c;this.b-=(this.g?6:7)+b}
|
|
function Ae(a){var b=Ud(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.P=this.R=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.P=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.P=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.R=32768)):d=c;this.u[a]=d>>16&65535;this.u[a|1]=d&65535;this.T=d>>16;this.X=d>>16|d;this.b-=(this.g?6:7)+b}function Be(a){S(this,a,!fd(this))}function Ce(a){S(this,a,fd(this))}
|
|
function De(a){R(this,a,Rd(this,a),ee);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}function Ee(a){Q(this,a,Qd(this,a),fe);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}function Fe(a){R(this,a,Rd(this,a),ge);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}function Ge(a){Q(this,a,Qd(this,a),he);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}
|
|
function He(a){P(this,Rd(this,a)&Ud(this,a));this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)}function Ie(a){P(this,(Qd(this,a)&Td(this,a))<<8);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)}function Je(a){S(this,a,hd(this))}function Ke(a){S(this,a,!this.Da()==!gd(this))}function Le(a){S(this,a,!hd(this)&&!this.Da()==!gd(this))}function Me(a){S(this,a,!fd(this)&&!hd(this))}function Ne(a){S(this,a,hd(this)||!this.Da()!=!gd(this))}
|
|
function Oe(a){S(this,a,fd(this)||hd(this))}function Pe(a){S(this,a,!this.Da()!=!gd(this))}function Qe(a){S(this,a,this.Da())}function Re(a){S(this,a,!hd(this))}function Se(a){S(this,a,!this.Da())}function Te(){this.ea(12,1);this.b-=5}function Ue(a){S(this,a,!0)}function Ve(a){S(this,a,!gd(this))}function We(a){S(this,a,gd(this))}function T(a){a&1&&(this.P=0);a&2&&(this.R=0);a&4&&(this.X=1);a&8&&(this.T=0);this.b-=5}
|
|
function Xe(a){var b=Rd(this,a);a=Ud(this,a);Gd(this,b-a,a,b);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)}function Ye(a){var b=Qd(this,a)<<8;a=Td(this,a)<<8;Gd(this,b-a,a,b);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)}
|
|
function Ze(a){var b=Ud(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.P=this.R=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.T=d>>16):(this.R=32768,this.X=d>>15|d,this.T=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.X=this.T=0,this.R=32768,this.P=65536,this.b-=7}function $e(){this.ea(24,2);this.b-=25}
|
|
function af(){this.L&49152?(this.Z|=128,this.ea(4,3)):this.i?$b(this.i):this.da();this.b-=7}function bf(){this.ea(16,4);this.b-=25}var cf=[0,7,7,10,7,11,9,13];function df(a){var b=this.b;O(this,Sd(this,a));this.b=b-cf[this.g]}var ef=[0,14,14,17,14,18,16,20];function ff(a){var b=this.b,c=Sd(this,a);a=a>>6&7;Hd(this,this.u[a]);this.u[a]=this.u[7];O(this,c);this.b=b-ef[this.g]}var gf=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];
|
|
function hf(a){var b=Rd(this,a),c=this.b;P(this,Wd(this,a,b));this.b=c-gf[(this.H?8:0)+this.g]+(7!=this.f||this.g?0:2)}function jf(a){var b=Qd(this,a);P(this,Vd(this,a,b,1)<<8);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}var kf=[7,13,13,17,14,18,17,21];
|
|
function lf(a){var b=Ud(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.T=b>>16,this.X=this.T|b,this.R=0,this.P=-32768>b||32767<b?65536:0);this.b-=23}function mf(){this.b-=5}function nf(){this.L&49152||(ed(this),this.w.reset());this.b-=667}function of(){Id(this);this.G|=this.L&16;this.b-=13}function pf(a){if(a&8)V.call(this,a);else{var b=Jd(this);a&=7;O(this,this.u[a]);this.u[a]=b;this.b-=9}}
|
|
function W(a){a&1&&(this.P=65536);a&2&&(this.R=32768);a&4&&(this.X=0);a&8&&(this.T=32768);this.b-=5}function qf(a){var b=(a&448)>>6;if(this.u[b]=this.u[b]-1&65535)O(this,this.u[7]-((a&63)<<1)),this.b+=1;this.b-=6}function rf(a){R(this,a,Rd(this,a),ue);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}function sf(a){R(this,a,0,we);this.b-=this.g?9:3+(7==this.f?2:0)}function tf(){this.ea(28,5);this.b-=5}function uf(){this.G&4||this.D.$();this.G|=4;Cd(this,-2);this.b-=3}
|
|
function vf(a){R(this,a,Rd(this,a),xe);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){wf[a>>12].call(this,a)}function xf(a){yf[a>>6&3].call(this,a)}function zf(a){Af[a>>6&3].call(this,a)}function Bf(a){Cf[a>>6&3].call(this,a)}function Df(a){Ef[a&15].call(this,a)}function Ff(a){Gf[a&15].call(this,a)}function Hf(a){If[a>>6&3].call(this,a)}function Jf(a){Kf[a>>6&3].call(this,a)}
|
|
function Lf(a){Mf[a>>6&3].call(this,a)}
|
|
var wf=[function(a){Nf[a>>8&15].call(this,a)},hf,Xe,He,De,Fe,ye,V,function(a){gg[a>>8&15].call(this,a)},jf,Ye,Ie,Ee,Ge,rf,V],Nf=[function(a){hg[a>>4&15].call(this,a)},Ue,Re,Je,Ke,Pe,Le,Ne,ff,ff,xf,zf,Bf,V,V,V],yf=[function(a){Dd(this,Wd(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,ie);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,me);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,ke);this.b-=this.g?9:3+(7==this.f?2:0)}],Af=[function(a){R(this,a,0,
|
|
oe);this.b-=this.g?11:6},function(a){R(this,a,fd(this)?1:0,Zd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,fd(this)?1:0,ue);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Ud(this,a);Dd(this,a);this.b-=this.g?4:3+(7==this.f?2:0)}],Cf=[function(a){R(this,a,0,se);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,qe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,ce);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,ae);this.b-=this.g?9:3+(7==this.f?2:0)}],
|
|
hg=[function(a){ig[a&15].call(this,a)},V,V,V,df,df,df,df,pf,V,Df,Ff,sf,sf,sf,sf],ig=[af,uf,of,Te,bf,nf,V,V,V,V,V,V,V,V,V,V],Ef=[mf,function(){this.P=0;this.b-=5},function(){this.R=0;this.b-=5},T,function(){this.X=1;this.b-=5},T,T,T,function(){this.T=0;this.b-=5},T,T,T,T,T,T,T],Gf=[mf,function(){this.P=65536;this.b-=5},function(){this.R=32768;this.b-=5},W,function(){this.X=0;this.b-=5},W,W,W,function(){this.T=32768;this.b-=5},W,W,W,W,W,W,W],gg=[Se,Qe,Me,Oe,Ve,We,Be,Ce,$e,tf,Hf,Jf,Lf,V,V,V],If=[function(a){Dd(this,
|
|
Vd(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,je);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,1,ne);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,1,le);this.b-=this.g?9:3+(7==this.f?2:0)}],Kf=[function(a){Q(this,a,0,pe);this.b-=this.g?11:6},function(a){Q(this,a,fd(this)?1:0,$d);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,fd(this)?1:0,ve);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Td(this,a);Dd(this,a<<8);this.b-=this.g?4:3+(7==
|
|
this.f?2:0)}],Mf=[function(a){Q(this,a,0,te);this.b-=this.g?9+(this.Xa&1):3+(7==this.f?2:0)},function(a){Q(this,a,0,re);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,de);this.b-=this.g?9+(this.Xa&1):3+(7==this.f?2:0)},function(a){Q(this,a,0,be);this.b-=this.g?9:3+(7==this.f?2:0)}];function cd(a){jg[a>>12].call(this,a)}
|
|
var jg=[function(a){kg[a>>8&15].call(this,a)},hf,Xe,He,De,Fe,ye,function(a){lg[a>>8&15].call(this,a)},function(a){mg[a>>8&15].call(this,a)},jf,Ye,Ie,Ee,Ge,rf,V],kg=[function(a){ng[a>>4&15].call(this,a)},Ue,Re,Je,Ke,Pe,Le,Ne,ff,ff,xf,zf,Bf,function(a){og[a>>6&3].call(this,a)},V,V],og=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.oa(a|this.M);O(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=Od(this,a,0);Hd(this,a);P(this,a);this.b-=11},function(a){var b=Jd(this),c=
|
|
this.b;Pd(this,a,0,b);P(this,b);this.b=c-kf[this.g]},function(a){P(this,Wd(this,a,this.Da?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],ng=[function(a){pg[a&15].call(this,a)},V,V,V,df,df,df,df,pf,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)},Df,Ff,sf,sf,sf,sf],pg=[af,uf,of,Te,bf,nf,function(){Id(this);this.b-=13},V,V,V,V,V,V,V,V,V],lg=[lf,lf,Ze,Ze,ze,ze,Ae,Ae,vf,vf,V,V,V,V,qf,qf],mg=[Se,Qe,Me,Oe,Ve,We,Be,Ce,$e,tf,Hf,Jf,Lf,function(a){qg[a>>6&3].call(this,
|
|
a)},V,V],qg=[V,function(a){a=Od(this,a,65536);Hd(this,a);P(this,a);this.b-=11},function(a){var b=Jd(this),c=this.b;Pd(this,a,65536,b);P(this,b);this.b=c-kf[this.g]},V];
|
|
function rg(a){r.call(this,"ROM",a,rg);this.ka=this.f=null;this.B=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.ga("Unable to load ROM resource (error "+f+": "+a+")"):(jb(c.Ra,a,b),(a=Ca(a,b))?(c.f=a.ia,c.ka=a.ka):c.D=null,sg(c))})}}u(rg);rg.prototype.Ca=function(a,b,c,d){this.w=b;this.b=c;this.i=d;sg(this)};
|
|
rg.prototype.Aa=function(){if(this.ka){if(this.i){var a=this.i,b=this.id,c=this.B,d=this.g,e=this.ka,f=[],g;for(g in e){var k=e[g];"number"==typeof k&&(e[g]=k={o:k});var m=k.o,p=k.a;if(void 0!==m){var q=f,m=[m>>>0,g],v=ya(q,m,a.Vb);0>v&&q.splice(-(v+1),0,m)}p&&(k.a=p.replace(/''/g,'"'))}a.F.push({Ud:b,C:c,vc:d,ka:e,Ub:f})}delete this.ka}return!0};rg.prototype.za=function(){return!0};
|
|
function sg(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.B;if(Yb(a.w,b,a.g,Cc)){var c;for(c=0;c<a.f.length;c++)a.w.hb(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.B,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 rg(d);A(d,c)}});
|
|
function tg(a){r.call(this,"RAM",a,tg);this.ka=this.g=null;this.F=a.addr;this.H=a.size;this.A=a.load;this.D=a.exec;this.B=!1;this.f=a.file;this.I=oa(this.f);if(this.f){a=this.f;var b=pa(this.I);"json"!=b&&"hex"!=b&&(a=ra()+"/api/v1/dump?file="+this.f+"&format=bytes&decimal=true");var c=this;Ba(a,null,!0,function(a,b,f){f?c.ga("Unable to load RAM resource (error "+f+": "+a+")"):(jb(c.Ra,a,b),(a=Ca(a,b))?(c.g=a.ia,c.ka=a.ka,null==c.A&&null!=a.Lb&&(c.A=a.Lb),null==c.D&&null!=a.Kb&&(c.D=a.Kb)):c.f=null,
|
|
ug(c))})}}u(tg);tg.prototype.Ca=function(a,b,c,d){this.w=b;this.b=c;this.i=d;ug(this)};tg.prototype.Aa=function(){return!0};tg.prototype.za=function(){return!0};function ug(a){!a.B&&a.H&&Yb(a.w,a.F,a.H,1)&&(a.B=!0);if(!pb(a)){if(!a.B)n("No RAM allocated");else if(a.f){if(!a.g||!a.w)return;var b=a.F;null!==a.A&&(b=a.A);for(var c=0;c<a.g.length;c++)a.w.hb(b+c,a.g[c]);null!==a.D&&(b=a.b,c=a.D,b.xb=c,O(b,c));delete a.g}H(a)}}tg.prototype.reset=function(){};
|
|
Ta(function(){for(var a=B(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new tg(d);A(d,c)}});function vg(a){r.call(this,"Keyboard",a,vg,65536);H(this)}u(vg);vg.prototype.ra=function(){return!1};vg.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 vg(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=wg;b&&(void 0===c&&(c="Panel"),(c=mb(c,this.id))&&(b=c.J[b])&&this.ra(null,a,b))}this.I=this.K=null;this.exports={connect:this.cc,receiveData:this.Ob}}u(X);var wg="buffer";h=X.prototype;
|
|
h.ra=function(a,b,c){var d=this;switch(b){case wg:return this.J[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.Ob(b);return!0},c.onkeypress=function(a){a=a||window.event;d.Ob(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
|
|
h.Ca=function(a,b,c,d){this.D=a;this.w=b;this.b=c;this.i=d;var e=this;this.aa=sc(48,4);this.U=hc(this.b,function(){e.f&128||!e.B.length||(e.N=e.B.shift(),e.f|=128,e.f&64&&qc(e.b,e.aa))});this.ba=sc(52,4);this.V=hc(this.b,function(){e.g|=128;e.g&64&&qc(e.b,e.ba)});ec(b,this,xg);H(this)};
|
|
h.cc=function(){if(!this.I){var a=Pc(this.D,"connection");if(a){var b=a.split("->");if(2==b.length){var c=va(b[0]);if(c!=this.Wa)return;b=va(b[1]);if(this.I=lb(b)){var d=this.I.exports;if(d){var e=d.connect;e&&e.call(this.I);if(this.K=d.receiveData){this.status(this.Ra+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};h.Aa=function(a,b){if(!b)if(this.cc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
|
|
h.za=function(a){return a?this.save():!0};h.reset=function(){yg(this)};h.save=function(){var a=new N(this);a.set(0,[]);return a.data()};h.restore=function(){return yg(this)};function yg(a){a.N=0;a.f=0;a.g=128;a.B=[];return!0}h.Ob=function(a){if("number"==typeof a)this.B.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.B.push(a.charCodeAt(b));else this.B=this.B.concat(a);rc(this.b,this.U,1);return!0};h.Sc=function(){return this.f&65535};h.Ed=function(a){this.f=this.f&-112|a&111};
|
|
h.Rc=function(){this.f&=-129;0<this.B.length&&rc(this.b,this.U,1);return this.N};h.Dd=function(){};h.ed=function(){return this.g};h.Rd=function(a){128==(this.g&192)&&a&64&&rc(this.b,this.V,1);this.g=this.g&-70|a&69};h.dd=function(){return 0};
|
|
h.Qd=function(a){if(a&=255){C(this,"transmitByte("+l(a,2,!0)+")");this.K&&this.K.call(this.I,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;rc(this.b,this.V,1)}};var zg={},xg=(zg[65392]=[null,null,X.prototype.Sc,X.prototype.Ed,"RCSR"],zg[65394]=[null,null,X.prototype.Rc,X.prototype.Dd,"RBUF"],zg[65396]=[null,null,X.prototype.ed,X.prototype.Rd,"XCSR"],zg[65398]=[null,null,X.prototype.dd,X.prototype.Qd,"XBUF"],zg);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.I=this.K=this.f=this.A=0;this.H=[];this.F=Ag;this.B="";this.M=!La("Mobi")&&window&&"FileReader"in window}u(wc);var Ag="";h=wc.prototype;
|
|
h.ra=function(a,b,c){var d=this;switch(b){case "listTapes":return this.J[b]=c,c.onchange=function(){var a=d.J.descTape,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(k){n("PC11 option error: "+k.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descTape":return this.J[b]=c,!0;case "loadTape":return this.J[b]=c,c.onclick=function(){var a=d.J.listTapes;a&&Bg(d,
|
|
a.options[a.selectedIndex].text,a.value)},!0;case "mountTape":if(this.M)return this.J[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;Bg(d,oa(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};
|
|
h.Ca=function(a,b,c,d){this.D=a;this.w=b;this.b=c;this.i=d;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.O=sc(56,4);this.N=hc(this.b,function(){Cg(e)});ec(b,this,Dg);Eg(this,"None",Ag,!0);this.M&&Eg(this,"Local Tape","?");Eg(this,"Remote Tape","??");Fg(this)||H(this)};
|
|
h.Aa=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};h.za=function(a){return a?this.save():!0};h.reset=function(){this.f&=-2241;this.K=0};function Fg(a){a.A=0;if(a.g){var b=a.g.path,c;if(!(c=a.g.name))a:{if((c=a.J.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?Gg(a,c,b,!0):a.ga("Incorrect auto-mount settings for PC11 ("+JSON.stringify(a.g)+")")}return!!a.A}
|
|
function Bg(a,b,c,d){if(c)if("?"==c)a.ga('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.F="??"}else a.F=c;Gg(a,b,c,!1,d)}else Hg(a,!1)}function Gg(a,b,c,d,e){var f=-1;a.B.toLowerCase()!=c.toLowerCase()&&(f++,Hg(a,!0),a.v.Ia?a.ga("PC11 busy"):(d&&(a.A++,D(a)&&C(a,"auto-loading tape: "+b)),Ig(a,b,c,e)?f++:a.v.Ia=!0))}
|
|
function Ig(a,b,c,d){var e=c;if(d){var f=new FileReader;f.onload=function(){var b=f.result;b&&(a.B=c,a.I=0,a.H=new Uint8Array(b,0,b.byteLength),a.F="?");Jg(a)};f.readAsArrayBuffer(d);return!0}0>c.indexOf("/api/v1/dump")&&(d=pa(c),e="json"==d||"gz"==d?encodeURI(c):ra()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!Ba(e,null,!0,function(d,e,f){var g=0>f&&a.D&&!a.D.v.ha;if(f)a.ga('Unable to load tape "'+b+'" (error '+f+": "+d+")",g);else if(jb(a.Ra,d,e),d=Ca(d,e))a.B=c,a.I=0,a.H=
|
|
d.ia;a.v.Ia=!1;a.A&&(a.A--,a.A||H(a));Jg(a)})}function Eg(a,b,c,d){if((a=a.J.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 Jg(a){var b=a.J.listTapes;if(b&&b.options){a=a.F||a.B;for(var c=0;c<b.options.length;c++)if(b.options[c].value==a){b.selectedIndex!=c&&(b.selectedIndex=c);break}c==b.options.length&&(b.selectedIndex=0)}}function Hg(a,b){if(a.B||!1===b)a.B="",b||(a.F=Ag,Jg(a))}h.save=function(){return(new N(this)).data()};h.restore=function(){return!0};function Cg(a){1==(a.f&32769)&&!(a.f&128)&&a.I<a.H.length&&(a.K=a.H[a.I++],a.f|=128,a.f&=-2049,a.f&64&&qc(a.b,a.O),rc(a.b,a.N,1E3/300,!0))}
|
|
h.Lc=function(){return this.f&65534};h.xd=function(a){a&1&&(this.f&32768?a&=-2:(this.f&=-129,this.f|=2048,this.K=0));this.f=this.f&-66|a&65;Cg(this)};h.Kc=function(){this.f&=-129;this.f|=2048;return this.K};h.wd=function(){};var Kg={},Dg=(Kg[65384]=[null,null,wc.prototype.Lc,wc.prototype.xd,"PRS"],Kg[65386]=[null,null,wc.prototype.Kc,wc.prototype.wd,"PRB"],Kg);
|
|
function Lg(a){r.call(this,"Debugger",a,Lg);this.ma=a.base||16;this.ya=!1;this.N=this.xa=this.H=0;this.U=!1;this.A=-1;this.g=[];this.aa={}}u(Lg);var Mg={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};Lg.prototype.$b=function(){return-1};Lg.prototype.ac=function(){};
|
|
function Ng(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.U?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 Og(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 Pg(a,b,c){var d;if(b){b=Qg(a,b);for(var e=0,f=!1,g=b,k=[],m=[],p=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<p.length;){var q=p[e++],v=q.length,q=va(q);if(!q){f=!0;break}q=Rg(a,q,null,!1===c);if(void 0===q){f=!0;c=!1;break}k.push(q);if(e==p.length)break;var q=p[e++],w=q.length;m.length&&Mg[q]<Mg[m[m.length-1]]&&Og(k,m,1);m.push(q);b=b.substr(v+w)}Og(k,m)&&1==k.length||(f=!0);f?c&&a.j("error parsing '"+g+"' at character "+(g.length-b.length)):(d=k.pop(),c&&Sg(a,null,
|
|
d))}return d}function Qg(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=Pg(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 Rg(a,b,c,d){var e;if(null!=b){e=a.$b(b);if(0<=e)e=a.ac(e);else if(e=a.aa[b],null==e){e=b;var f=a.ma,g;if(e){f||(f=10);var k=e.charAt(0),m=0<e.indexOf(",");m&&(e=e.replace(/,/g,""));"#"==k?(f=8,k=null):"$"==k&&(f=16,k=null);null==k?e=e.substr(1):("0"==k&&(k=e.charAt(1),"b"==k&&m&&(f=2,k=null),"o"==k?(f=8,k=null):"x"==k&&(f=16,k=null)),null==k?e=e.substr(2):(k=e.charAt(e.length-1).toLowerCase(),"y"==k?(f=2,k=null):"."==k?(f=10,k=null):"h"==k&&(f=16,k=null),null==k&&(e=e.substr(0,e.length-1))));
|
|
var p,k=e;((m=f)&&10!=m?16==m?k.match(/^[0-9a-f]+$/i):8==m?k.match(/^[0-7]+$/):2==m&&k.match(/^[01]+$/):k.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 Sg(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 k=0;k<f;k++){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 Tg(a,b){if(b)return Sg(a,b,a.aa[b]);var c=0;for(b in a.aa)Sg(a,b,a.aa[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 Ug(a){Lg.call(this,a);this.ya=!0;this.K=Z(0);this.Qa=Z(0);this.O=Z(0);this.F=[];this.f=this.M=this.B=[];Vg(this);this.qa=0;Wg(this);this.Fa={};Xg(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(Ug,Lg);
|
|
var Yg={"?":"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"},Zg=".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(" "),$g=
|
|
{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]}},ah=[0],bh=[58,60,65,96,108,
|
|
110,100,101,102,103,104,105,59,64];h=Ug.prototype;
|
|
h.Ca=function(a,b,c,d){this.w=b;this.b=c;this.D=a;(a=Pc(a,"messages"))&&Xg(this,a);this.Za=$g;this.nb=1145>this.b.ab?bh:[];ch(this,function(a){a:{var b=d.w.W,c=a[0],e=a=0,m=b.length;if(c){a=d.Y(dh(d,c));if(-1===a){d.j("invalid address: "+c);break a}e=a>>>d.w.ja;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.ja,
|
|
8)+" %%"+l(q.C,8)+" "+l(q.vb,4,!0)+" "+l(q.size,4,!0)+" "+p),c!=Bc&&(c=-1),p=0);a+=d.w.ua;e++}}});H(this)};
|
|
h.ra=function(a,b,c){var d=this;switch(b){case "debugInput":return this.pa=this.J[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",Sc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.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.J[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.J[b]=c,Na(c,function(a){var b=!1;ob(d,!0)||(nb(d,!0),b=d.jb(a?1:0),nb(d,!1));return b}),!0}return!1};h.ub=function(){this.pa&&this.pa.focus()};h.Y=function(a){a=a&&a.C;null==a&&(a=-1);return a};h.ob=function(a,b){var c=255,d=this.Y(a,!1,1);-1!==d&&(c=a.yb?this.w.Bb(d):this.b.Bb(d),b&&eh(a,b));return c};h.na=function(a,b){var c=65535,d=this.Y(a,!1,2);-1!==d&&(c=a.yb?this.w.pb(d):this.b.pb(d),b&&eh(a,b));return c};
|
|
h.Fb=function(a,b,c){var d=this.Y(a,!0,1);-1!==d&&(a.yb?this.w.hb(d,b):this.b.hb(d,b),c&&eh(a,c),this.D.$(!0))};h.Va=function(a,b,c){var d=this.Y(a,!0,2);-1!==d&&(a.yb?this.w.Gb(d,b):this.b.Gb(d,b),c&&eh(a,c),this.D.$(!0))};function Z(a,b){return{C:a,yb:b,Ba:!1}}function fh(a){return[a.C,a.Ba]}function gh(a){return{C:a[0],Ba:a[1]}}
|
|
function dh(a,b,c){var d,e=(c?a.K:a.Qa).C;c=!1;if(void 0!==b){b=Qg(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=Pg(a,b,void 0)}null!=e&&(d=Z(e,c));return d}function hh(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.lc=Ng(a,b.hc=c[2]))}function eh(a,b){null!=a.C&&(a.C+=b||1)}
|
|
function Xg(a,b){a.i=a;a.la=a.nc=536870912;a.sa=null;a.wa=[];b=Ng(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 ch(a,b){for(var c in tb)if(64==tb[c]){a.Fa[c]=b;break}}
|
|
h.$b=function(a){var b=-1;a=a.toUpperCase();switch(a){case "SP":b=6;break;case "PC":b=7;break;default:"R"==a.charAt(0)&&(b=+a.charAt(1),0>b||7<b)&&(b=-1)}return b};function ih(a){return 6>a?"R"+a:6==a?"SP":"PC"}h.ac=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Ea[a-8]:20>a?b=this.b.va[a-16]:20==a&&(b=Lb(this.b)));return b};
|
|
h.message=function(a,b){b&&(a+=" @"+J(this,Z(this.b.tb).C));this.la&1073741824?this.wa.push(a):this.sa&&a==this.sa||(this.sa=a,this.la&-2147483648&&(this.da(),a+=" (cpu halted)"),this.j(a),this.b&&(a=this.b,Yc(a),a.pa=0,a.D.$()))};
|
|
function Wg(a){var b;if(Xd(a)){if(!a.I||!a.I.length){a.I=Array(1E3);for(b=0;b<a.I.length;b++)a.I[b]=Z();a.fa=0;a.j("instruction history buffer allocated")}if(!a.ba||!a.ba.length)for(a.ba=Array(256),b=0;b<a.ba.length;b++)a.ba[b]=[b,0]}else a.I&&a.I.length&&a.j("instruction history buffer freed"),a.fa=0,a.I=[],a.ba=[]}h.ib=function(a,b){if(!jh(this,b))return!1;this.b.ib(a);return!0};
|
|
h.jb=function(a,b,c){if(!jh(this))return!1;this.H=0;a||Xd(this)&&Yd(this,this.b.u[7],0);try{a=Zc(this.b,a);var d=this.b.jb(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};h.da=function(a){this.b&&this.b.da(a)};h.$=function(a){void 0===a&&(a=!0);this.K=Z(this.b.u[7]);a&&1!=this.V?kh(this):lh(this)};
|
|
function jh(a,b){var c;(c=!a.b||!pb(a.b))||(c=a.b,c.v.ha?c=!0:(c.j(c.toString()+" not powered"),c=!1),c=!c);return c||a.b.v.ca?(b||a.j("cpu busy or unavailable, command ignored"),!1):!qb(a.b)}h.Aa=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};h.za=function(a,b){b&&this.j(a?"suspending":"shutting down");return a?this.save():!0};h.reset=function(a){Wg(this);this.N=this.xa=0;this.sa=null;this.H=0;this.K=Z(this.b.u[7]);this.v.ca=!1;mh(this);a||this.$()};
|
|
h.save=function(){var a=new N(this);a.set(0,fh(this.K));a.set(1,fh(this.O));a.set(2,[this.g,this.U,this.la]);a.set(3,this.F);return a.data()};h.restore=function(a){var b=0;void 0!==a[2]&&(this.K=gh(a[b++]),this.O=gh(a[b++]),this.g=a[b][0],"string"==typeof this.g&&(this.g=[this.g]),this.U=a[b][1],this.la|=a[b][2]);a[3]&&(this.F=a[3]);return!0};h.start=function(a,b){this.V||this.j("running");this.v.ca=!0;this.xb=a;this.Ab=b};
|
|
h.stop=function(a,b){if(this.v.ca){this.v.ca=!1;this.H=b-this.Ab;if(!this.V){b="stopped";if(this.H){a-=this.xb;var c=0<a?Math.round(1E3*this.H/a):0;b+=" (";Xd(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.ub();mh(this,this.b.u[7])}};function Xd(a){return 1<a.f.length||!!a.qa}
|
|
function Yd(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.ba.length&&(a.N++,null!=a.b.pb(b)&&(b=a.I[a.fa],b.C=d.u[7],b.Ba=!1,++a.fa==a.I.length&&(a.fa=0)));return!1}function $b(a){var b=a.b;if(b.v.ca)throw O(b,a.b.tb),a.da(),-1;return!1}function Vg(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.ja],!1)}a.M=["br"];if(a.B)for(b=1;b<a.B.length;b++)c=a.B[b],d=a.w,c=a.Y(c),Lc(d.W[c>>>d.ja],!0);a.B=["bw"];a.Xa=0}
|
|
h.Sa=function(a,b,c){var d=!0;c||nh(this,a,b,!1,!0);if(a!=this.f){var e=this.Y(b);if(-1===e)this.j("invalid address: "+J(this,b.C)),d=!1;else{var f=this.w;f.W[e>>>f.ja].Sa(e&f.w,a==this.B)}}d&&(a.push(b),c?b.Ba=!0:(oh(this,a,a.length-1,"set"),Wg(this)));return d};function nh(a,b,c,d,e){var f=!1;c=a.Y(c);for(var g=1;g<b.length;g++){var k=b[g];if(c==a.Y(k)&&(!d||k.Ba)){f=!0;k.Ba||e||oh(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.w,Lc(d.W[c>>>d.ja],b==a.B));k.Ba||Wg(a);break}}return f}
|
|
function ph(a,b){for(var c=1;c<b.length;c++)oh(a,b,c);return b.length-1}function oh(a,b,c,d){c=b[c];a.j(b[0]+" "+J(a,c.C)+(d?" "+d:c.hc?' "'+c.hc+'"':""))}function mh(a,b){if(void 0!==b)Kc(a,b,1,a.f,!0),a.V=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Ba){if(!nh(a,a.f,c,!0))break;b=0}}}
|
|
function Kc(a,b,c,d,e){var f=!1;if(!a.Xa++)for(var g=1;!f&&g<d.length;g++){var k=d[g];if(!e||k.Ba)for(var m=a.Y(k),p=0;p<c;p++)if(b+p==m){var q,f=!0;k.Ba&&(nh(a,d,k,!0),e=!0);if(q=k.lc){for(var f=!1,v=0;v<q.length;v++)if(!qh(a,q[v],!0)){if(q[v].indexOf("if")){f=!0;break}for(var w=v+1;w<q.length&&q[w].indexOf("else");w++)v++;if(w==q.length){f=!0;break}}a.b.v.ca||(f=!0)}if(f){e||oh(a,d,g,"hit");break}}}a.Xa--;return f}
|
|
function rh(a,b,c,d){var e=Z(b.C),f=a.na(b,2),g,k;for(k in a.Za)if(g=a.Za[k][f&k])break;g||(g=ah);var m=g[0];0<=a.nb.indexOf(m)&&(g=ah,m=g[0]);var p=k="",q=Zg[m],v=g.length-1;m||v||(k=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.C+((f&255)<<24>>23)&65535,y=J(x,w);else if(8192==F)w=w.C-((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=
|
|
ih(E);break;case 8:y="@"+ih(E);break;case 16:7>E?y="("+ih(E)+")+":(F=x.na(w,2),y="#"+J(x,F,0,!0));break;case 24:7>E?y="@("+ih(E)+")+":(F=x.na(w,2),y="@#"+J(x,F,0,!0));break;case 32:y="-("+ih(E)+")";break;case 40:y="@-("+ih(E)+")";break;case 48:F=x.na(w,2);y=J(x,F,0,!0)+"("+ih(E)+")";7==E&&(y=[y,J(x,F+w.C&65535)]);break;case 56:F=x.na(w,2),y="@"+J(x,F)+"("+ih(E)+")",7==E&&(y=[y,J(x,F+w.C&65535)])}x=y;if(!x||!x.length){k="INVALID";break}"string"!=typeof x&&(p=x[1],x=x[0]);0<k.length&&(k+=",");k+=x||
|
|
"???"}}f="";g=J(a,e.C)+":";if(-1!==e.C&&-1!==b.C){do if(f+=" "+J(a,a.na(e,2)),null==e.C)break;while(e.C!=b.C)}g+=ua(f,24);g+=ua(q,5);k&&(g+=" "+k);if(c||p)g=ua(g,60)+";"+(c||""),g=a.b.v.$a?g+("cycles="+Uc(a.b).toString()+" cs="+l(a.b.qb)):g+(null!=d?"="+d.toString():""),p&&(g+=" @"+p);return g}function sh(a,b){switch(b){case "N":a=a.b.Da();break;case "Z":a=hd(a.b);break;case "V":a=gd(a.b);break;case "C":a=fd(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
|
|
function th(a,b){var c="",d=a.b;8>b?(c=ih(b),c+="="+J(a,d.u[b])):13>b?c="A"+(b-8)+"="+J(a,d.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 uh(a){var b,c="";for(b=0;6>b;b++)c+=th(a,b);c=c+"\n"+(th(a,6)+th(a,7)+th(a,20));return c+=sh(a,"T")+sh(a,"N")+sh(a,"Z")+sh(a,"V")+sh(a,"C")}h.Vb=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
|
|
function vh(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.C>>>0,k=f.vc;if(e>=g&&e<g+k){e=ya(f.Ub,[e-g],a.Vb);0<=e?wh(a,b,e,d):c&&(e=~e,wh(a,b,e-1,d),wh(a,b,e,d));break}}return d}function wh(a,b,c,d){var e={},f=a.F[b].Ub,g=0,k=null;0<=c&&c<f.length&&(g=f[c][0],k=f[c][1]);k&&(e=a.F[b].ka[k],k="."==k.charAt(0)?null:e.l||k);d.push(k);d.push(g);d.push(e.a);d.push(e.c)}
|
|
function xh(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return Tg(a)||a.j("no variables"),!0;if(!c[2])return Tg(a,c[1]);if(!c[3])return delete a.aa[c[1]],!0;b=Pg(a,c[3]);return void 0!==b?(a.aa[c[1]]=b,!0):!1}a.j("invalid assignment:"+b);return!1}
|
|
function yh(a,b,c){var d=null;if(b=dh(a,b,!0)){a.Y(b);var e=vh(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.C-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.C)&&(g=" - "+l(f,4,!0)),f=e[4]+" ("+J(a,e[5])+")"+g,c&&a.j(f),d||(d=f))}else c&&a.j("no symbols")}return d}
|
|
function kh(a,b){var c;if(b&&"?"==b[1])a.j("register commands:"),a.j("\tr\tdump registers"),a.j("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(b&&1<b.length){var e=b[1],f=e.indexOf("=");if(0<f)b=e.substr(f+1),e=e.substr(0,f);else if(2<b.length)b=b[2];else{a.j("missing value for "+b[1]);return}f=Pg(a,b);if(void 0===f)return;b=e.toUpperCase();switch(b){case "SP":case "R6":d.u[6]=f&65535;break;case "PC":case "R7":O(d,f);a.K=Z(d.u[7]);break;case "N":d.T=f?32768:0;break;case "Z":d.X=
|
|
f?0:1;break;case "V":d.R=f?32768:0;break;case "C":d.P=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(uh(a));c&&(a.K=Z(d.u[7]),lh(a,J(a,a.K.C)))}}function zh(a,b){b=va(b);var c=b.match(/^(['"])(.*?)\1$/);c?1<c[2].length?a.j(c[2]):Sg(a,null,c[2].charCodeAt(0)):Pg(a,b,!0)}
|
|
function Ah(a,b,c){var d="t"!=b;c=Rg(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.jb(e,d,!1)},function(){a.D.$();nb(a,!1)})}
|
|
function lh(a,b,c,d){if(b=dh(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c)if("l"==c.charAt(0))c=Rg(a,c.substr(1)),null!=c&&(d=c);else{d=dh(a,c,!0);if(!d||d.C<b.C)return;e=d.C-b.C;if(256<e){a.j("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=ob(a,!1)||a.V?a.H:null;var g=null!=f?"cycles":null,k=vh(a,b),m=b.C;if(k[0]&&d&&(!c&&d||0>k[0].indexOf("+"))){var p=k[0]+":";k[2]&&(p+=" "+k[2]);a.j(p)}k[3]&&(g=k[3],f=null);f=rh(a,b,g,f);a.j(f);a.K=b;e-=b.C-m;c++}}}
|
|
function qh(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.j(">> "+b):(a.U&&(a.j("ended assemble at "+J(a,a.O.C)),a.K=a.O,a.U=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.sa=null;if(pb(a)&&0<b.length){a.U&&(b="a "+J(a,a.O.C)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");if(g&&g.length)for(var k=g[0],m=k.charAt(0),p=1;p<k.length;p++){var q=k.charAt(p);if("?"==m||"r"==m||"a">q||"z"<q){g[0]=k.substr(p);g.unshift(k.substr(0,p));break}}g[0]=g[0].toLowerCase();switch(g[0].charAt(0)){case "a":var v=
|
|
dh(a,g[1],!0);if(v)if(a.O=v,void 0===g[2])a.j("begin assemble at "+J(a,v.C)),a.U=!0,a.D.$();else{var w;a.j("not supported yet");w=[];if(w.length){for(var x=0;x<w.length;x++)a.Fb(v,w[x],1);a.j(rh(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 jd;jd=0+ph(a,a.f);jd+=ph(a,a.M);(jd+=ph(a,a.B))||a.j("no breakpoints")}else if("n"==Fa)a.qa=Rg(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=dh(a,y,!0),!U))break a;"c"==Fa?null==U.C?(Vg(a),a.j("all breakpoints cleared")):nh(a,a.f,U)||nh(a,a.M,U)||nh(a,a.B,U)||a.j("breakpoint missing: "+J(a,U.C)):null!=U.C&&(hh(a,U,F),"p"==Fa?a.Sa(a.f,
|
|
U):"r"==Fa?a.Sa(a.M,U):"w"==Fa?a.Sa(a.B,U):a.j("unknown breakpoint command: "+Fa))}}}break;case "c":a.Ta&&(a.Ta.value="");break;case "d":a:{var Xa,Ya=g[0],ia=g[1],Ga=g[2],Th=g[3];if("?"==ia){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"==ia){var Of=Bh(a.D,!0);"console"==Ga?console.log(Of):(a.Ta&&(a.Ta.value=""),a.j(Of))}else if("symbols"==ia)for(var kd=0;kd<a.F.length;kd++){var ld=a.F[kd],$a;for($a in ld.ka)if("."!=$a.charAt(0)){var Pf=ld.ka[$a].o;if(void 0!==Pf){var Qf=ld.ka[$a].l;Qf&&($a=Qf);a.j(J(a,Pf)+" "+$a)}}}else{if("d"==Ya){for(Xa in tb)if(g[1]==Xa){var Rf=a.Fa[Xa];Rf?(g.shift(),g.shift(),Rf(g)):a.j("no dump registered for "+ia);break a}ia||(Ya=a.Cb||"db")}else a.Cb=
|
|
Ya;if("dh"==Ya){var Sf=ia,Tf=Ga,Uf="",Vf=0,ca=a.fa,ja=a.I;if(ja.length){var Y=+Sf||a.Ya,vb=+Tf||10;isNaN(Y)?Y=vb:Uf="more ";Y>ja.length&&(a.j("note: only "+ja.length+" available"),Y=ja.length);ca-=Y;0>ca&&(null==ja[ja.length-1].C?(Y=ca+Y,ca=0):ca+=ja.length);var md=[];"call"==Tf&&(vb=1E5,md=["CALL"]);for(void 0!==Sf&&a.j(Y+" instructions earlier:");0<vb&&ca!=a.fa;){var Wf=ja[ca++];if(null==Wf.C)break;var wb=Z(Wf.C),Uh=Y--,Xf=rh(a,wb,"history",Uh);(!md.length||0<=Xf.indexOf(md[0]))&&a.j(Xf);wb.Jb&&
|
|
(ca+=wb.Jb,vb-=wb.Jb,Y-=wb.Jb);ca>=ja.length&&(ca=0);a.Ya=Y;Vf++;vb--}}Vf||(a.j("no "+Uf+"history available"),a.Ya=void 0)}else{var xb=dh(a,ia);if(xb){var ic=0;Ga&&("l"==Ga.charAt(0)&&(Ga=Ga.substr(1)||Th),ic=Rg(a,Ga)>>>0,65536<ic&&(ic=65536));for(var yb="",ab="dd"==Ya?4:"dw"==Ya?2:1,jc=ab*ic||128,Vh=jc+15>>4||1;Vh--&&0<jc;){var kc=0,zb=0,Ab,nd="",Yf="",ia=J(a,xb.C);for(Ab=4==ab?16:a.ma;0<Ab&&0<jc;Ab--){var od,lc=2==ab?a.na(xb,od=2):a.ob(xb,od=1),kc=kc|lc<<(zb<<3),zb=zb+od;zb==ab&&(nd+=J(a,kc,ab),
|
|
nd+=1==ab?9==Ab?"-":" ":" ",kc=zb=0);Yf+=32<=lc&&128>lc?String.fromCharCode(lc):".";jc--}yb&&(yb+="\n");yb+=ia+" "+nd+(0==Ab?" "+Yf:"")}yb&&a.j(yb);a.Qa=xb}}}}break;case "e":if("else"==g[0])break;var bb,pd,qd,rd,sd=g[0],td=g[1];"eb"==sd?(bb=1,pd=255,qd=a.ob,rd=a.Fb):"e"==sd||"ew"==sd?(bb=2,pd=65535,qd=a.na,rd=a.Va):td=null;if(null==td)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 mc=dh(a,td);if(mc)for(var nc=2;nc<
|
|
g.length;nc++){var Bb=Pg(a,g[nc]);if(void 0===Bb){a.j("unrecognized value: "+g[nc]);break}Bb&~pd&&a.j("warning: "+l(Bb)+" exceeds "+bb+"-byte value");var Wh=qd.call(a,mc);a.j("changing "+J(a,mc.C)+" from "+J(a,Wh,bb)+" to "+J(a,Bb,bb));rd.call(a,mc,Bb,bb)}}break;case "g":a:{var Zf=g[1],Xh=b;if(void 0!==Zf){var ud=dh(a,Zf,!0);if(!ud)break a;hh(a,ud,Xh);a.Sa(a.f,ud,!0)}a.ib(!0,c)}break;case "h":a.v.ca?(c||a.j("halting"),a.da()):ob(a,!0)||c||a.j("already halted");break;case "i":if("if"==g[0]){var vd;
|
|
var Cb=b.substr(2),Cb=va(Cb);Pg(a,Cb)?(c||a.j("true: "+Cb),vd=!0):(c||a.j("false: "+Cb),vd=!1);vd||(d=!1);break}f=!0;break;case "k":var Yh=g[0];if("?"==g[1])a.j("stack trace commands:"),a.j("\tk\tshow frame addresses"),a.j("\tks\tshow symbol information");else{var wd=0,xd=Z(),Db=Z(a.b.u[6]);for(a.j("stack trace for "+J(a,Db.C));10>wd;){for(var Ha=null,Zh=256;65536>Db.C>>>0;){xd.C=a.na(Db,2);if(null==Db.C||!Zh--)break;if(!(xd.C&1)){for(var $h=a,oc=xd,$f=null,Eb=oc.C,ag=Eb,yd=1;6>=yd&&Eb;yd++){if(2<
|
|
yd){oc.C=Eb;var pc=rh($h,oc);if(0<=pc.indexOf("JSR")){var bg=pc.indexOf(" ");if(Eb+(pc.indexOf(" ",bg+1)-bg-1)/2==ag){$f=pc;break}}}Eb-=2}oc.C=ag;if(Ha=$f)break}}if(!Ha||null==Ha)break;var cg=null;if("ks"==Yh){var dg=Ha.match(/[0-9A-F]+$/);dg&&(cg=yh(a,dg[0]))}Ha=ua(Ha,50)+" ;"+(cg||"stack="+J(a,Db.C));a.j(Ha);wd++}wd||a.j("no return addresses found")}break;case "l":if("ln"==g[0]){yh(a,g[1],!0);break}f=!0;break;case "m":a:{var ka,la=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)la=!0,G=null;else if("off"==G)la=!1,G=null;else{"keys"==G&&(G="key");"kbd"==G&&(G="keyboard");for(ka in tb)if(G==ka){xa=tb[ka];la=!!(a.la&xa);break}if(!xa){a.j("unknown message category: "+G);break a}}if(xa)if("on"==g[2])a.la|=xa,la=!0;else if("off"==g[2]&&(a.la&=~xa,la=!1,1073741824==xa)){for(var zd=0;zd<a.wa.length;zd++)a.j(a.wa[zd]);a.wa=[]}}var ai=0,Fb="";for(ka in tb)if(!G||G==ka){var bi=!!(a.la&tb[ka]);if(null===la||la==bi)Fb&&(Fb+=","),++ai%10||(Fb+="\n\t"),
|
|
"key"==ka&&(ka="keys"),Fb+=ka}void 0===G&&a.j("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.j((null!==la?la?"messages on: ":"messages off: ":"message categories:\n\t")+(Fb||"none"));Wg(a)}break;case "p":if("print"==g[0]){zh(a,b.substr(5));break}var ci="pr"==g[0]?1:0;if(a.V)a.j("step in progress");else{var eg=Z(a.b.u[7]);a.ob(eg);a.V?(a.Sa(a.f,eg,!0),a.ib()||(a.D&&a.D.ub(),a.V=0)):Ah(a,ci?"tr":"t")}break;case "r":if("reset"==b){a.D&&a.D.reset();break}kh(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.bb=Hb;break;case "start":a.b.rb=Hb;break;case "stop":a.b.cb=Hb;break;default:a.j("unknown cs option");break a}void 0!==Hb&&Rc(a.b);a.j("checksums "+(a.b.v.$a?"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.Ua.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":Ah(a,g[0],g[1]);break;case "u":lh(a,g[1],g[2],8);break;case "v":if("var"==g[0]){xh(a,b.substr(3))||(d=!1);break}if("ver"==
|
|
g[0]){a.j("PDPjs version 1.30.1 ("+a.b.ab+",RELEASE"+(sb?",TYPEDARRAYS":",LONGARRAYS")+")");a.j(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){zh(a,b.substr(1));break}var Ad="commands:",Bd;for(Bd in Yg)Ad+="\n"+ua(Bd,9)+Yg[Bd];Xd(a)||(Ad+="\nnote: history disabled if no exec breakpoints");a.j(Ad);break;default:f=!0}f&&(a.j("unknown command: "+b),d=!1)}}catch(fg){a.j("debugger error: "+(fg.stack||fg.message)),d=!1}return d}
|
|
function Sc(a,b,c){b=Ng(a,b,c);for(var d in b)if(!qh(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 Ug(d);A(d,c)}});
|
|
function Ch(a,b,c){r.call(this,"Computer",a,Ch,67108864);this.v.ha=!1;Dh(this,b);this.M=Pc(this,"autoPower",a);this.D=0;this.aa=a.busWidth||a.buswidth;this.f=Eh;this.I=null;this.F=this.U=!1;this.ba=Pc(this,"url")||"";(Math.random()+.1).toString(36);this.g=Fh(this);if(this.b=mb("CPU",this.id)){this.i=mb("Debugger",this.id);this.w=new Mb({id:this.Ra+".bus",busWidth:this.aa},this.b,this.i);var d,e=kb(this.id);if((this.A=mb("Panel",this.id))&&this.A.Ta)for(b=0;b<e.length;b++)d=e[b],d.ga=this.A.ga,d.j=
|
|
this.A.j,d.Ta=this.A.Ta;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=Eh),this.f&&
|
|
(this.K=new N(this,"1.30.1"),Gh(this.K)?b=null:delete this.K);!b&&this.f&&(b=Hh(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.ga("Unable to load machine state from server (error "+c+(b?": "+va(b):"")+")")):(g.I=b,g.U=!0);H(g)})}else H(this);this.J.power||(this.M=!0);!c&&this.M&&Ih(this,this.sb)}else n("Unable to find CPU component")}u(Ch);var Eh=0;
|
|
function Dh(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){n(d.message+" ("+c+")")}}a.V=b}function Pc(a,b,c){var d=b.toLowerCase(),d=db[b]||db[d];void 0===d&&a.V&&(d=a.V[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Ih(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(){Ih(a,b,c)});return}}b.call(a,c)}
|
|
function Jh(a,b){var c=new N(a,"1.30.1","validate");if(Gh(c)&&Kh(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.ga("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}h=Ch.prototype;
|
|
h.sb=function(a){void 0===a&&(a=this.f||(this.I?1:Eh));if(!this.D){this.D++;var b=!1,c=!1;this.O=!1;var d=this.K||new N(this,"1.30.1");if(-1==a)b=!0;else if(a>Eh){if(Gh(d,this.I)){this.B=new N(this,"1.30.1","failsafe");Gh(this.B)&&(Lh(this,d),a=2,Mh(this.B));this.B.set("timestamp",Aa());Nh(this.B);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=Kh(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Gh(d,g):("error"==
|
|
f&&"no machine state"!=g?(this.ga("Error: "+g),"unable to verify user"==g&&(Ka("user",""),this.g=null)):this.j(f+": "+g),Mh(d),Gh(d)?(c=Kh(d),e=!0):c=!1))}e&&Jh(this,c?d:null)}else 2==a&&d.clear()}else Jh(this);delete this.I;delete this.K}e=kb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=Oh(this,g,d,b,c));b=[d,a,c];-1!=a?Ih(this,this.Xb,b):this.Xb(b)}};
|
|
function Oh(a,b,c,d,e){if(!b.v.ha){b.v.ha=!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.U?(c.clear(),a.f=Eh,window&&window.location.reload()):a.O=!0,b.Aa(null),e=!1)}if(!d&&b.Yb)for(a=b.Yb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
|
h.Xb=function(a){var b=a[0],c=0>a[1];a=a[2];this.fa=!0;this.v.ha=!0;var d=this.J.power;d&&(d.textContent="Shutdown");this.b&&(Oh(this,this.b,b,c,a),this.b.mb());this.O&&(Lh(this,b),b.clear());!c&&this.B&&(this.B.clear(),delete this.B);this.D=0};
|
|
function Lh(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.ba;d.user=c;d.type="bug";d.data=b;Ba("http://www.pcjs.org/api/v1/report",d,!0)}}
|
|
function Bh(a,b,c){var d,e="none";if(a.D)return null;a.D--;var f=new N(a,"1.30.1"),g=new N(a,"1.30.1","validate"),k=Aa();g.set("timestamp",k);f.set("timestamp",k);f.set("version","1.30.1");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.za&&(c&&a.b.da(),d=a.b.za(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.v.ha=!1,!1===d&&(e=null)));for(var k=kb(a.id),m=0;m<k.length;m++){var p=k[m];p.v.ha&&(p.za&&(d=p.za(b,c),"object"===typeof d&&f.set(p.id,
|
|
d)),c&&(p.v.ha=!1,!1===d&&(e=null)))}e&&(c?(k=d=!1,b?(a.g&&Ph(a,a.g,f.toString()),Nh(g)&&Nh(f)||(e=null,d=k=!0)):a.f&&(d=!0,k=3==a.f),d&&f.clear(k)):e=f.toString());c&&(a.v.ha=!1,b=a.J.power)&&(b.textContent="Power");a.D=0;return e}h.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())}};
|
|
h.start=function(a,b){for(var c=kb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.$(!0)};h.stop=function(a,b){for(var c=kb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.$(!0)};
|
|
h.ra=function(a,b,c){var d=this;switch(b){case "power":return this.J[b]=c,c.onclick=function(){d.D||(d.v.ha?Bh(d,!1,!0):Ih(d,d.sb))},!0;case "reset":return this.J[b]=c,c.onclick=function(){if(d.v.ha&&!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.");Bh(d,a,!0);!a&&d.N?window&&window.location.reload():d.sb(Eh)}else d.reset(),d.b&&d.b.mb()},!0;case "save":if(qa())c.parentNode.removeChild(c);else return this.J[b]=
|
|
c,c.onclick=function(){var a=Fh(d,!0);if(a){var b=!!(d.f&&!d.H||d.N),c=Bh(d,b);b?Ph(d,a,c):d.ga("Resume disabled, machine state not saved")}},!0}return!1};
|
|
function Fh(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=Qh(a,c))||a.ga("The user ID is invalid.")):b&&a.ga("Browser local storage is not available"));return c}
|
|
function Qh(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 Hh(a){var b=null;a.g&&(b=ra()+"/api/v1/user?req=load&user="+a.g+"&state="+Rh(a,"1.30.1"));return b}
|
|
function Ph(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Rh(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.ga("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.ga(c),Ka("user",""),a.g=null)}}h.ub=function(){};
|
|
h.$=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 Ch(g,d,!0);A(g,f);g.M&&Ih(g,g.sb)}});Oa.show.push(function(){for(var a=B(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=mb("Computer",c.id))&&c.fa&&!c.v.ha&&c.sb(-1)}});
|
|
Oa.exit.push(function(){for(var a=B(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=mb("Computer",c.id))&&c.v.ha&&Bh(c,!(!c.f||c.H),!0)}});function N(a,b,c){this.id=a.id;this.key=Rh(a,b,c);this.i=a.i;Mh(this,a.tc)}function Rh(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
|
|
N.prototype={constructor:N,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){Mh(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 Mh(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function Nh(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 Kh(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){n(c.message||c),b=!1}return b}function Gh(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 Sh=0;
|
|
function di(a,b,c,d,e,f){e("Loading "+a+"...");Ba(a,null,!0,function(g,k,m){m?(k||(k="unable to load "+a+" ("+m+")"),f(k,null)):ei(k,a,b,c,d,e,f)})}
|
|
function ei(a,b,c,d,e,f,g){function k(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?fi(a,f,k):k(a,null):g("no data"+(b?" for file: "+b:""),null)}
|
|
function fi(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");Ba(e,null,!0,function(f,g,k){if(k||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+k+")");else{if(f=d[3])if(k=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var m=k[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]);k[0]!=m&&(g=g.replace(k[0],m))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
|
|
"");a=a.replace(d[0],g);fi(a,b,c)}})}else c(a,null)}
|
|
function gi(a,b,c,d){function e(a){if(void 0===k){var b=g&&B(g,"machine-warning");k=b&&b[0]||g}k&&(k.innerHTML=ta(a))}function f(a){e("Error: "+a);m&&(--Sh||Va(!0));m=!1}var g,k,m=!0;Sh++;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,k){k?di(c,null,null,!1,e,function(d,m){m?(jb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(m=k.transformNode(m))?(g.outerHTML=m,--Sh||Va(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(m),(m=d.transformToFragment(k,document))?g.parentNode?(g.parentNode.replaceChild(m,g),--Sh||Va(!0)):f("invalid machine element: "+
|
|
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?di(b,a,d,!0,e,p):ei(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 gi(a,b,c,d)};window.enableEvents=Va;window.sendEvent=Wa;})();//# sourceMappingURL=/tmp/pdpjs/1.30.1/pdp11-dbg.map
|