|
|
|
|
@ -40,281 +40,282 @@ function wa(a,b){return(a+" ").slice(0,b)
|
|
|
|
|
function za(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a<b?-1:0});d<e;){var g=d+e>>1,h;h=c(b,a[g]);0<h?d=g+1:(e=g,f=!h)}return f?d:~d}var Aa=Date.now||function(){return+new Date};function Ba(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}
|
|
|
|
|
function Da(a,b,c,d){var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(f=h.responseText,200==h.status||!h.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=h.status||-1),d&&d(a,f,e))});if(b&&"object"==
|
|
|
|
|
typeof b){var l="",m;for(m in b)b.hasOwnProperty(m)&&(l&&(l+="&"),l+=m+"="+encodeURIComponent(b[m]));l=l.replace(/%20/g,"+");h.open("POST",a,!!c);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(l)}else h.open("GET",a,!!c),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();c||(f=h.responseText,200!=h.status&&(e=h.status||-1),d&&d(a,f,e),g=[f,e]);return g}
|
|
|
|
|
function Ea(a,b){var c,d={da:null,ga:null,Ka:null,Ja: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.Ka=g.load;d.Ja=g.exec;if(e=g.bytes)d.da=e;else if(e=g.words)for(d.da=Array(2*e.length),f=c=0;c<e.length;c++)d.da[f++]=e[c]&255,d.da[f++]=e[c]>>8&255;else if(e=g.data)for(d.da=Array(4*e.length),f=c=0;c<e.length;c++)d.da[f++]=
|
|
|
|
|
function Ea(a,b){var c,d={da:null,ga:null,La:null,Ka: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.La=g.load;d.Ka=g.exec;if(e=g.bytes)d.da=e;else if(e=g.words)for(d.da=Array(2*e.length),f=c=0;c<e.length;c++)d.da[f++]=e[c]&255,d.da[f++]=e[c]>>8&255;else if(e=g.data)for(d.da=Array(4*e.length),f=c=0;c<e.length;c++)d.da[f++]=
|
|
|
|
|
e[c]&255,d.da[f++]=e[c]>>8&255,d.da[f++]=e[c]>>16&255,d.da[f++]=e[c]>>24&255;else d.da=g;d.ga=g.symbols;d.da.length?1==d.da.length&&(q(d.da[0]),d=null):(q("Empty resource: "+a),d=null)}catch(h){q("Resource data error ("+a+"): "+h.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;c<b.length;c++){f=parseInt(b[c],16);if(isNaN(f)){q("Resource data error ("+a+"): invalid hex byte ("+b[c]+")");break}e.push(f&255)}c==b.length&&(d.da=e)}return d}
|
|
|
|
|
function Fa(){return"http://"+(window?window.location.host:"www.pcjs.org")}function q(a){window&&window.alert(a)}function Ga(a){var b=!1;window&&(b=window.confirm(a));return b}var Ha=null;function Ia(){if(null==Ha){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}Ha=a}return Ha}
|
|
|
|
|
function Ka(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function Qa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Ra(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 Sa(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
|
|
|
|
|
function Ta(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 Ua={init:[],show:[],exit:[]},Va=!1,Wa=!1,Xa=!0;function Ya(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Za(a){Ua.init.push(a)}
|
|
|
|
|
function $a(a){if(Xa)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){q(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function ab(a){!Xa&&a?(Xa=!0,Va&&bb("init"),Wa&&bb("show")):Xa=a}function bb(a){Ua[a]&&$a(Ua[a])}Ya("onload",function(){Va=!0;$a(Ua.init)});Ya("onpageshow",function(){Wa=!0;$a(Ua.show)});Ya(Ra("Opera")||Ra("iOS")?"onunload":"onbeforeunload",function(){$a(Ua.exit)});
|
|
|
|
|
function t(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.tc=b.comment;this.Vc=b;b=this.id.indexOf(".");0>b?this.Ya=this.id:(this.Qa=this.id.substr(0,b),this.Ya=this.id.substr(b+1));this[a]=c;this.w={ready:!1,ab:!1,ac:!1,ha:!1,error:!1};this.Rb=null;this.w.error=!1;this.G={};this.i=null;this.ma=d||0;u.push(this)}var cb=void 0,db={};
|
|
|
|
|
function t(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.sc=b.comment;this.Yc=b;b=this.id.indexOf(".");0>b?this.Ya=this.id:(this.Qa=this.id.substr(0,b),this.Ya=this.id.substr(b+1));this[a]=c;this.w={ready:!1,ab:!1,$b:!1,ha:!1,error:!1};this.Sb=null;this.w.error=!1;this.G={};this.i=null;this.ma=d||0;u.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 ob(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 z(a,b){b||(b=t);a.prototype=ob(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var pb=window.PCjs.Machines||(window.PCjs.Machines={}),u=window.PCjs.Components||(window.PCjs.Components=[])}else pb={},u=[];function qb(a,b,c){pb[a]&&b&&(pb[a][b]=c)}function rb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<u.length;b++){var d=u[b];a&&d.id.indexOf(a)||c.push(d)}return c}
|
|
|
|
|
function sb(a){if(void 0!==a){var b;for(b=0;b<u.length;b++)if(u[b].id===a)return u[b]}return null}function tb(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<u.length;d++)if(c)c==u[d]&&(c=null);else if(!(a!=u[d].type||b&&u[d].id.indexOf(b)))return u[d]}return null}function A(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){q(c.message+" ("+a+")")}return b}
|
|
|
|
|
function B(a,b){b=D(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var h=g.split(" "),l=0;l<h.length;l++)switch(g=h[l],g){case "pdp11-binding":(g=A(f))&&g.binding&&a.ra(g.type,g.binding,f,g.value),l=h.length}}}}
|
|
|
|
|
function B(a,b){b=D(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var h=g.split(" "),l=0;l<h.length;l++)switch(g=h[l],g){case "pdp11-binding":(g=A(f))&&g.binding&&a.sa(g.type,g.binding,f,g.value),l=h.length}}}}
|
|
|
|
|
function D(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
|
|
|
|
|
t.prototype={constructor:t,parent:null,toString:function(){return this.name?this.name:this.id||this.type},ra:function(a,b,c){switch(b){case "clear":return this.G[b]||(this.G[b]=c,c.onclick=function(a){return function(){a.G.print&&(a.G.print.value="")}}(this)),!0;case "print":return this.G[b]||(this.Ra=this.G[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.P=function(a){this.j(a,this.Ya)}),!0;default:return!1}},log:function(){},j:function(){},status:function(a){this.j(this.Ya+": "+a)},P:function(a,b,c){c=c||this.type;b||q((c?c+": ":"")+a)},Ga:function(){return this.w.ha=!0},Fa:function(a,b){b&&(this.w.ha=!1);return!0}};function E(a,b,c,d){a.i&&(!0===c||F(a,c|0))&&a.i.message(b,d)}function F(a,b){if(a.i){a===a.i?b|=0:b=b||a.ma;var c=a.i.ma&b;return!!b&&c===b||!!(c&a.i.Oc)}return!1}
|
|
|
|
|
function ub(a,b){if(a.w.ac)return a.w.ab=!1,a.w.ac=!1;if(a.w.error)return a.j(a.toString()+" error"),!1;a.w.ab=b;return a.w.ab}function vb(a,b){a.w.ab&&(b?a.w.ac=!0:void 0===b&&a.j(a.toString()+" busy"));return a.w.ab}function H(a,b){a.w.error||(a.w.ready=!1!==b,a.w.ready&&(b=a.Rb,a.Rb=null,b&&b()))}function wb(a,b){b&&(a.w.ready?b():a.Rb=b);return a.w.ready}function xb(a){return a.w.error?(a.j(a.toString()+" error"),!0):!1}function yb(a,b){a.w.error=!0;a.P(b)}
|
|
|
|
|
t.prototype={constructor:t,parent:null,toString:function(){return this.name?this.name:this.id||this.type},sa:function(a,b,c){switch(b){case "clear":return this.G[b]||(this.G[b]=c,c.onclick=function(a){return function(){a.G.print&&(a.G.print.value="")}}(this)),!0;case "print":return this.G[b]||(this.Ra=this.G[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.P=function(a){this.j(a,this.Ya)}),!0;default:return!1}},log:function(){},j:function(){},status:function(a){this.j(this.Ya+": "+a)},P:function(a,b,c){c=c||this.type;b||q((c?c+": ":"")+a)},Ga:function(){return this.w.ha=!0},Fa:function(a,b){b&&(this.w.ha=!1);return!0}};function E(a,b,c,d){a.i&&(!0===c||F(a,c|0))&&a.i.message(b,d)}function F(a,b){if(a.i){a===a.i?b|=0:b=b||a.ma;var c=a.i.ma&b;return!!b&&c===b||!!(c&a.i.Qc)}return!1}
|
|
|
|
|
function ub(a,b){if(a.w.$b)return a.w.ab=!1,a.w.$b=!1;if(a.w.error)return a.j(a.toString()+" error"),!1;a.w.ab=b;return a.w.ab}function vb(a,b){a.w.ab&&(b?a.w.$b=!0:void 0===b&&a.j(a.toString()+" busy"));return a.w.ab}function H(a,b){a.w.error||(a.w.ready=!1!==b,a.w.ready&&(b=a.Sb,a.Sb=null,b&&b()))}function wb(a,b){b&&(a.w.ready?b():a.Sb=b);return a.w.ready}function xb(a){return a.w.error?(a.j(a.toString()+" error"),!0):!1}function yb(a,b){a.w.error=!0;a.P(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});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
|
|
|
|
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
|
|
|
|
|
var zb="undefined"!==typeof ArrayBuffer,Ab="UNKNOWN TRAP HALT INTERRUPT TRACE STACK ILLEGAL ERROR".split(" "),Bb={cpu:1,trap:16,fault:32,bus:64,memory:128,rom:256,device:512,keyboard:65536,key:131072,paper:1048576,disk:4194304,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};
|
|
|
|
|
function Cb(a){t.call(this,"Panel",a,Cb);this.f=this.A=this.Va=this.D=this.J=this.H=0;this.L=this.M=this.I=!1;this.O=Db;this.B={};this.g={START:[1,1,!0,!1,this.ed],STEP:[1,1,!1,!1,this.fd],ENABLE:[1,1,!1,!1,this.ad],CONT:[1,1,!0,!1,this.Zc],DEP:[0,0,!0,!1,this.$c],EXAM:[1,1,!0,!1,this.bd],LOAD:[1,1,!0,!1,this.dd],TEST:[0,0,!0,!1,this.cd]};for(a=0;22>a;a++)this.g["S"+a]=[0,0,!1,!1,this.gd,a]}z(Cb);var Db=7;function Eb(a,b){return a.g[b]&&a.g[b][1]}k=Cb.prototype;k.reset=function(){this.stop()};
|
|
|
|
|
k.ra=function(a,b,c,d){if(this.C&&this.C.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.G[b]=c,this.H++,!0;default:return"led"==a||"rled"==a?(this.G[b]=c,this.B[b]=d?1:0,this.H++,!0):"switch"==a?(void 0===this.g[b]&&(this.g[b]=[d?1:0,d?1:0]),this.G[b]=c,a=c.parentElement||c,a=a.parentElement||a,a.onmousedown=function(a,
|
|
|
|
|
b){return function(){Fb(a,b)}}(this,b),a.onmouseup=a.onmouseout=function(a,b){return function(){Gb(a,b)}}(this,b),a.ontouchstart=function(a,b){return function(c){Fb(a,b);c.preventDefault()}}(this,b),a.ontouchend=function(a,b){return function(){Gb(a,b)}}(this,b),!0):this.parent.ra.call(this,a,b,c,d)}};k.Ea=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.i=d;Hb(b,this,Ib);Jb(b,this.reset.bind(this));Kb(this);Lb(this)};k.Ga=function(a,b){b||(Mb(),this.reset());return!0};k.Fa=function(){return!0};
|
|
|
|
|
function $b(a,b,c){if(a=a.G[b])a.style.backgroundColor=c?"#ff0000":"#000000"}function Kb(a,b){for(var c in a.B)$b(a,c,null!=b?b:a.B[c])}function ac(a,b,c){if(a=a.G[b])a.style.marginTop=c?"0px":"20px",a.style.backgroundColor=c?"#00ff00":"#228B22"}function Lb(a){for(var b in a.g)ac(a,b,a.g[b][1])}function bc(a,b,c,d){a.G[b]&&(void 0===c&&(yb(a,"Value for "+b+" is invalid"),a.b.fa()),c=8==(a.i&&a.i.ca||8)?qa(c,d):p(c,d),a.G[b].textContent!=c&&(a.G[b].textContent=c))}
|
|
|
|
|
function Fb(a,b){var c=a.g[b];ac(a,b,c[1]=1-c[1]);c[3]=!0;c[4]&&c[4].call(a,c[1],c[5]);"STEP"!=b&&(a.L="DEP"==b,a.M="EXAM"==b)}function Gb(a,b){var c=a.g[b];c[2]&&c[3]&&(ac(a,b,c[1]=c[0]),c[4]&&c[4].call(a,c[1],c[5]));c[3]=!1}k.ed=function(a){a||this.b.w.W||(this.v.reset(),cc(this.b),Eb(this,"ENABLE")&&this.b.ib())};k.fd=function(){};k.ad=function(a){a||this.b.fa()};
|
|
|
|
|
k.Zc=function(a){if(!a&&!this.b.w.W)if(Eb(this,"ENABLE"))this.b.ib();else{if((a=this.i)&&!vb(a,!0))ub(a,!0),a.jb(0),ub(a,!1);else try{var b=this.b.jb(1);0<b&&(dc(this.b,b),ec(this.b,b,!0),fc(this.b,b))}catch(c){"number"!=typeof c&&yb(this.b,c.stack||c.message)}this.stop();this.C&&this.C.oa()}};k.$c=function(a){a&&!this.b.w.W&&(this.L&&gc(this),a=hc(this,this.Va),this.O==Db?this.v.Bb(this.f,a):this.b.Bb(this.f,a))};
|
|
|
|
|
k.bd=function(a){a||this.b.w.W||(this.M&&gc(this),a=this.O==Db?this.v.bb(this.f):this.b.bb(this.f),hc(this,a))};k.dd=function(a){a||this.b.w.W||ic(this,this.Va)};k.cd=function(a){a?(this.I=!0,Kb(this,!0)):(this.I=!1,Kb(this),jc(this,0))};k.gd=function(a,b){this.Va=a?this.Va|1<<b:this.Va&~(1<<b)};function gc(a){var b=1145>a.b.cb?8:16,c=65472<=a.f&&a.f<65472+b,b=c?1:2,c=c?15:a.v.Ma;Eb(a,"STEP")||(b=-b);ic(a,a.f&~c|a.f+b&c)}
|
|
|
|
|
function ic(a,b){a.f=b&a.v.Ma;b=a.f;for(var c=0;22>c;c++)kc(a,"A"+c,b&1<<c)}function hc(a,b){a.A=b&65535;b=a.A;for(var c=0;16>c;c++)kc(a,"D"+c,b&1<<c);return a.A}function kc(a,b,c){a.B[b]=c;a.I||$b(a,b,c)}function lc(a){return void 0!==a.G.S0}function jc(a,b){if(lc(a)){a.Va=b;for(var c=0;22>c;c++)a.g["S"+c][1]=b&1<<c?1:0;Lb(a)}}k.stop=function(){ic(this,this.b.u[7])};k.lc=function(a){this.f=a};k.setData=function(a,b){b?this.D=a:this.A=a};k.hd=function(a){return(a?this.Va:this.D)&65535};
|
|
|
|
|
k.ce=function(a){this.D=a};var mc={},Ib=(mc[65400]=[null,null,Cb.prototype.hd,Cb.prototype.ce,"CNSW"],mc);function Mb(){for(var a=!1,b=D(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=A(d),f=sb(e.id);f||(a=!0,f=new Cb(e));B(f,d);a&&H(f)}}Za(Mb);
|
|
|
|
|
function nc(a,b,c){t.call(this,"Bus",a,nc,64);this.b=b;this.i=c;this.J=a.busWidth||16;this.C=0;this.B=[];this.g=null;this.H=1<<this.J;this.Ma=this.H-1;this.ya=oc;this.ja=Math.log2(this.ya);this.I=this.ya>>2;this.v=this.ya-1;this.D=this.H/this.ya|0;this.$a=[];this.la=0;this.f=!1;this.cc=0;this.A=[];this.Lc=[pc,qc,rc,sc];a=new I(this);tc(a,this.i);this.Y=Array(this.D);for(b=0;b<this.D;b++)this.Y[b]=a;H(this)}z(nc);var oc=8192,uc=oc-1;
|
|
|
|
|
function Cb(a){t.call(this,"Panel",a,Cb);this.f=this.A=this.Va=this.D=this.J=this.H=0;this.L=this.M=this.I=!1;this.O=Db;this.B={};this.g={START:[1,1,!0,!1,this.fd],STEP:[1,1,!1,!1,this.gd],ENABLE:[1,1,!1,!1,this.bd],CONT:[1,1,!0,!1,this.$c],DEP:[0,0,!0,!1,this.ad],EXAM:[1,1,!0,!1,this.cd],LOAD:[1,1,!0,!1,this.ed],TEST:[0,0,!0,!1,this.dd]};for(a=0;22>a;a++)this.g["S"+a]=[0,0,!1,!1,this.hd,a]}z(Cb);var Db=7;function Eb(a,b){return a.g[b]&&a.g[b][1]}k=Cb.prototype;k.reset=function(){this.stop()};
|
|
|
|
|
k.sa=function(a,b,c,d){if(this.C&&this.C.sa(a,b,c,d)||this.b&&this.b.sa(a,b,c,d)||this.i&&this.i.sa(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.G[b]=c,this.H++,!0;default:return"led"==a||"rled"==a?(this.G[b]=c,this.B[b]=d?1:0,this.H++,!0):"switch"==a?(void 0===this.g[b]&&(this.g[b]=[d?1:0,d?1:0]),this.G[b]=c,a=c.parentElement||c,a=a.parentElement||a,a.onmousedown=function(a,
|
|
|
|
|
b){return function(){Fb(a,b)}}(this,b),a.onmouseup=a.onmouseout=function(a,b){return function(){Gb(a,b)}}(this,b),a.ontouchstart=function(a,b){return function(c){Fb(a,b);c.preventDefault()}}(this,b),a.ontouchend=function(a,b){return function(){Gb(a,b)}}(this,b),!0):this.parent.sa.call(this,a,b,c,d)}};k.Ea=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.i=d;Hb(b,this,Ib);Jb(b,this.reset.bind(this));Kb(this);Lb(this)};k.Ga=function(a,b){b||(Mb(),this.reset());return!0};k.Fa=function(){return!0};
|
|
|
|
|
function Nb(a,b,c){if(a=a.G[b])a.style.backgroundColor=c?"#ff0000":"#000000"}function Kb(a,b){for(var c in a.B)Nb(a,c,null!=b?b:a.B[c])}function ac(a,b,c){if(a=a.G[b])a.style.marginTop=c?"0px":"20px",a.style.backgroundColor=c?"#00ff00":"#228B22"}function Lb(a){for(var b in a.g)ac(a,b,a.g[b][1])}function bc(a,b,c,d){a.G[b]&&(void 0===c&&(yb(a,"Value for "+b+" is invalid"),a.b.fa()),c=8==(a.i&&a.i.ca||8)?qa(c,d):p(c,d),a.G[b].textContent!=c&&(a.G[b].textContent=c))}
|
|
|
|
|
function Fb(a,b){var c=a.g[b];ac(a,b,c[1]=1-c[1]);c[3]=!0;c[4]&&c[4].call(a,c[1],c[5]);"STEP"!=b&&(a.L="DEP"==b,a.M="EXAM"==b)}function Gb(a,b){var c=a.g[b];c[2]&&c[3]&&(ac(a,b,c[1]=c[0]),c[4]&&c[4].call(a,c[1],c[5]));c[3]=!1}k.fd=function(a){a||this.b.w.W||(this.v.reset(),cc(this.b),Eb(this,"ENABLE")&&this.b.hb())};k.gd=function(){};k.bd=function(a){a||this.b.fa()};
|
|
|
|
|
k.$c=function(a){if(!a&&!this.b.w.W)if(Eb(this,"ENABLE"))this.b.hb();else{if((a=this.i)&&!vb(a,!0))ub(a,!0),a.ib(0),ub(a,!1);else try{var b=this.b.ib(1);0<b&&(dc(this.b,b),ec(this.b,b,!0),fc(this.b,b))}catch(c){"number"!=typeof c&&yb(this.b,c.stack||c.message)}this.stop();this.C&&this.C.oa()}};k.ad=function(a){a&&!this.b.w.W&&(this.L&&gc(this),a=hc(this,this.Va),this.O==Db?this.v.Bb(this.f,a):this.b.Bb(this.f,a))};
|
|
|
|
|
k.cd=function(a){a||this.b.w.W||(this.M&&gc(this),a=this.O==Db?this.v.bb(this.f):this.b.bb(this.f),hc(this,a))};k.ed=function(a){a||this.b.w.W||ic(this,this.Va)};k.dd=function(a){a?(this.I=!0,Kb(this,!0)):(this.I=!1,Kb(this),jc(this,0))};k.hd=function(a,b){this.Va=a?this.Va|1<<b:this.Va&~(1<<b)};function gc(a){var b=1145>a.b.cb?8:16,c=65472<=a.f&&a.f<65472+b,b=c?1:2,c=c?15:a.v.Na;Eb(a,"STEP")||(b=-b);ic(a,a.f&~c|a.f+b&c)}
|
|
|
|
|
function ic(a,b){a.f=b&a.v.Na;b=a.f;for(var c=0;22>c;c++)kc(a,"A"+c,b&1<<c)}function hc(a,b){a.A=b&65535;b=a.A;for(var c=0;16>c;c++)kc(a,"D"+c,b&1<<c);return a.A}function kc(a,b,c){a.B[b]=c;a.I||Nb(a,b,c)}function lc(a){return void 0!==a.G.S0}function jc(a,b){if(lc(a)){a.Va=b;for(var c=0;22>c;c++)a.g["S"+c][1]=b&1<<c?1:0;Lb(a)}}k.stop=function(){ic(this,this.b.u[7])};k.kc=function(a){this.f=a};k.setData=function(a,b){b?this.D=a:this.A=a};k.kd=function(a){return(a?this.Va:this.D)&65535};
|
|
|
|
|
k.ee=function(a){this.D=a};var mc={},Ib=(mc[65400]=[null,null,Cb.prototype.kd,Cb.prototype.ee,"CNSW"],mc);function Mb(){for(var a=!1,b=D(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=A(d),f=sb(e.id);f||(a=!0,f=new Cb(e));B(f,d);a&&H(f)}}Za(Mb);
|
|
|
|
|
function nc(a,b,c){t.call(this,"Bus",a,nc,64);this.b=b;this.i=c;this.J=a.busWidth||16;this.C=0;this.B=[];this.g=null;this.H=1<<this.J;this.Na=this.H-1;this.za=oc;this.ja=Math.log2(this.za);this.I=this.za>>2;this.v=this.za-1;this.D=this.H/this.za|0;this.$a=[];this.la=0;this.f=!1;this.bc=0;this.A=[];this.Nc=[pc,qc,rc,sc];a=new I(this);tc(a,this.i);this.Y=Array(this.D);for(b=0;b<this.D;b++)this.Y[b]=a;H(this)}z(nc);var oc=8192,uc=oc-1;
|
|
|
|
|
function pc(a,b){var c=-1,d=this.controller,e=d.$a[a],f=b&65535;e?e[0]?c=e[0](f):e[2]&&(c=f&1?e[2](f&-2)>>8:e[2](f)&255):f&1&&(e=d.$a[a&-2])&&(e[2]?c=e[2](f&-2)>>8:e[0]&&(c=e[0](f)));if(0<=c)return this.i&&F(this.i,e[5])&&E(this.i,e[4]+".readByte("+J(this.i,b)+"): "+J(this.i,c),!0,!d.la),c;d.Da(b,16,3);c=255;this.i&&F(this.i,e[5])&&E(this.i,"warning: unconverted read access to byte @"+J(this.i,b)+": "+J(this.i,c),!0,!d.la);return c}
|
|
|
|
|
function qc(a,b,c){var d=!1,e=this.controller,f=e.$a[a],g=c&65535;if(f)if(f[1])f[1](b,g),d=!0;else{if(f[3]){a=f[2]?f[2](0):0;if(g&1)f[3](a&255|b<<8,g&-2);else f[3](a&-256|b,g);d=!0}}else if(g&1&&(f=e.$a[a&-2]))if(f[3])g&=-2,a=f[2]?f[2](0):0,f[3](a&255|b<<8,g),d=!0;else if(f[1])f[1](b,g);d?this.i&&F(this.i,f[5])&&E(this.i,f[4]+".writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0,!e.la):(e.Da(c,16,5),this.i&&F(this.i,f[5])&&E(this.i,"warning: unconverted write access to byte @"+J(this.i,c)+": "+J(this.i,
|
|
|
|
|
b),!0,!e.la))}function rc(a,b){var c=-1,d=this.controller;a=d.$a[a];var e=b&65535;a&&(a[2]?c=a[2](e):a[0]&&(c=a[0](e)|a[0](e+1)<<8));if(0<=c)return this.i&&F(this.i,a[5])&&E(this.i,a[4]+".readWord("+J(this.i,b)+"): "+J(this.i,c),!0,!d.la),c;d.Da(b,16,2);c=65535;this.i&&F(this.i,a[5])&&E(this.i,"warning: unconverted read access to word @"+J(this.i,b)+": "+J(this.i,c),!0,!d.la);return c}
|
|
|
|
|
function sc(a,b,c){var d=!1,e=this.controller;a=e.$a[a];var f=c&65535;a&&(a[3]?(a[3](b,f),d=!0):a[1]&&(a[1](b&255,f),a[1](b>>8,f+1),d=!0));d?this.i&&F(this.i,a[5])&&E(this.i,a[4]+".writeWord("+J(this.i,c)+","+J(this.i,b)+")",!0,!e.la):(e.Da(c,16,4),this.i&&F(this.i,a[5])&&E(this.i,"warning: unconverted write access to word @"+J(this.i,c)+": "+J(this.i,b),!0,!e.la))}
|
|
|
|
|
function vc(a,b){if(b!=a.C){var c;a.C&&(c=(1<<a.C)-oc,wc(a,c,oc,a.B),a.C=0);b&&(a.C=b,c=1<<b,a.Ma=c-1,c-=oc,a.B=xc(a,c,oc),a.g?wc(a,c,oc,a.g):(yc(a,c,oc,zc,a),a.g=xc(a,c,oc)))}}k=nc.prototype;k.reset=function(){for(var a=0;a<this.A.length;a++)this.A[a]();vc(this,16)};k.Ga=function(a,b){b||this.reset();return!0};
|
|
|
|
|
function yc(a,b,c,d,e){for(var f=b,g=c,h=f>>>a.ja;0<g&&h<a.Y.length;){var l=a.Y[h],m=h*a.ya,n=a.ya-(f-m);n>g&&(n=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.F)return l.Mb+=l.F-f,l.F=f,!0;if(f>=l.F+l.Mb){n=l.size-(f-m);n>g&&(n=g);l.Mb=f-l.F+n;f=m+a.ya;g-=n;h++;continue}}return Ac(1,f,g)}f=new I(a,f,n,a.ya,d,e);tc(f,a.i,l);a.Y[h++]=f;f=m+a.ya;g-=n}return 0>=g?(d==Bc&&(a.cc+=c),a.status((c>>10)+"Kb "+Cc[d]+" at "+qa(b)),!0):Ac(2,b,c)}
|
|
|
|
|
function xc(a,b,c){var d=[];for(b>>>=a.ja;0<c&&b<a.Y.length;)d.push(a.Y[b++]),c-=a.ya;return d}function wc(a,b,c,d){var e=0;for(b>>>=a.ja;0<c&&b<a.Y.length;){var f=d[e++];if(!f)break;a.Y[b++]=f;c-=a.ya}}k.Fb=function(a){3932160<=a&&(a=Dc(this.b,a));return this.Y[(a&this.Ma)>>>this.ja].Vb(a&this.v,a)};k.Tb=function(a){3932160<=a&&(a=Dc(this.b,a));this.f=!1;this.la++;a=this.Y[(a&this.Ma)>>>this.ja].hc(a&this.v,a);this.la--;return a};
|
|
|
|
|
k.na=function(a){3932160<=a&&(a=Dc(this.b,a));return this.Y[(a&this.Ma)>>>this.ja].qa(a&this.v,a)};k.bb=function(a){3932160<=a&&(a=Dc(this.b,a));var b=a&this.v,c=(a&this.Ma)>>>this.ja;this.f=!1;this.la++;a=this.Y[c].ic(b,a);this.la--;return a};k.Xb=function(a,b){3932160<=a&&(a=Dc(this.b,a));this.Y[(a&this.Ma)>>>this.ja].Zb(a&this.v,b&255,a)};k.qb=function(a,b){3932160<=a&&(a=Dc(this.b,a));this.f=!1;this.la++;this.Y[(a&this.Ma)>>>this.ja].$b(a&this.v,b&255,a);this.la--};
|
|
|
|
|
k.hb=function(a,b){3932160<=a&&(a=Dc(this.b,a));this.Y[(a&this.Ma)>>>this.ja].Nb(a&this.v,b&65535,a)};k.Bb=function(a,b){3932160<=a&&(a=Dc(this.b,a));var c=a&this.v,d=(a&this.Ma)>>>this.ja;this.f=!1;this.la++;this.Y[d].nc(c,b&65535,a);this.la--};
|
|
|
|
|
function Kc(a){for(var b=0,c=[],d=0;d<a.D;d++){var e=a.Y[d];if(e.Sa||e.Rc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,h=0,l=[];g<e.length;){for(var m=e[g],n=g+1;n<e.length&&e[n]===m;)n++;l[h++]=n-g;l[h++]=m;g=n}l.length<e.length&&(e=l)}c[f]=e}}return c}function Lc(a,b,c,d,e,f,g,h,l){for(;b<=c;b+=2){var m=b&uc;if(void 0!==a.$a[m])return q("I/O address already registered: "+p(b,8,!0)),!1;a.$a[m]=[d,e,f,g,l||"unknown",h,!1]}return!0}
|
|
|
|
|
function vc(a,b){if(b!=a.C){var c;a.C&&(c=(1<<a.C)-oc,wc(a,c,oc,a.B),a.C=0);b&&(a.C=b,c=1<<b,a.Na=c-1,c-=oc,a.B=xc(a,c,oc),a.g?wc(a,c,oc,a.g):(yc(a,c,oc,zc,a),a.g=xc(a,c,oc)))}}k=nc.prototype;k.reset=function(){for(var a=0;a<this.A.length;a++)this.A[a]();vc(this,16)};k.Ga=function(a,b){b||this.reset();return!0};
|
|
|
|
|
function yc(a,b,c,d,e){for(var f=b,g=c,h=f>>>a.ja;0<g&&h<a.Y.length;){var l=a.Y[h],m=h*a.za,n=a.za-(f-m);n>g&&(n=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.F)return l.Nb+=l.F-f,l.F=f,!0;if(f>=l.F+l.Nb){n=l.size-(f-m);n>g&&(n=g);l.Nb=f-l.F+n;f=m+a.za;g-=n;h++;continue}}return Ac(1,f,g)}f=new I(a,f,n,a.za,d,e);tc(f,a.i,l);a.Y[h++]=f;f=m+a.za;g-=n}return 0>=g?(d==Bc&&(a.bc+=c),a.status((c>>10)+"Kb "+Cc[d]+" at "+qa(b)),!0):Ac(2,b,c)}
|
|
|
|
|
function xc(a,b,c){var d=[];for(b>>>=a.ja;0<c&&b<a.Y.length;)d.push(a.Y[b++]),c-=a.za;return d}function wc(a,b,c,d){var e=0;for(b>>>=a.ja;0<c&&b<a.Y.length;){var f=d[e++];if(!f)break;a.Y[b++]=f;c-=a.za}}k.Gb=function(a){3932160<=a&&(a=Dc(this.b,a));return this.Y[(a&this.Na)>>>this.ja].Vb(a&this.v,a)};k.Tb=function(a){3932160<=a&&(a=Dc(this.b,a));this.f=!1;this.la++;a=this.Y[(a&this.Na)>>>this.ja].gc(a&this.v,a);this.la--;return a};
|
|
|
|
|
k.na=function(a){3932160<=a&&(a=Dc(this.b,a));return this.Y[(a&this.Na)>>>this.ja].ra(a&this.v,a)};k.bb=function(a){3932160<=a&&(a=Dc(this.b,a));var b=a&this.v,c=(a&this.Na)>>>this.ja;this.f=!1;this.la++;a=this.Y[c].hc(b,a);this.la--;return a};k.Ab=function(a,b){3932160<=a&&(a=Dc(this.b,a));this.Y[(a&this.Na)>>>this.ja].Yb(a&this.v,b&255,a)};k.qb=function(a,b){3932160<=a&&(a=Dc(this.b,a));this.f=!1;this.la++;this.Y[(a&this.Na)>>>this.ja].Zb(a&this.v,b&255,a);this.la--};
|
|
|
|
|
k.gb=function(a,b){3932160<=a&&(a=Dc(this.b,a));this.Y[(a&this.Na)>>>this.ja].Ob(a&this.v,b&65535,a)};k.Bb=function(a,b){3932160<=a&&(a=Dc(this.b,a));var c=a&this.v,d=(a&this.Na)>>>this.ja;this.f=!1;this.la++;this.Y[d].mc(c,b&65535,a);this.la--};
|
|
|
|
|
function Ec(a){for(var b=0,c=[],d=0;d<a.D;d++){var e=a.Y[d];if(e.Sa||e.Tc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,h=0,l=[];g<e.length;){for(var m=e[g],n=g+1;n<e.length&&e[n]===m;)n++;l[h++]=n-g;l[h++]=m;g=n}l.length<e.length&&(e=l)}c[f]=e}}return c}function Lc(a,b,c,d,e,f,g,h,l){for(;b<=c;b+=2){var m=b&uc;if(void 0!==a.$a[m])return q("I/O address already registered: "+p(b,8,!0)),!1;a.$a[m]=[d,e,f,g,l||"unknown",h,!1]}return!0}
|
|
|
|
|
function Hb(a,b,c,d,e){for(var f in c){var g=+f,h=c[f];if(!(h[6]&&h[6]>a.b.cb)){var l=h[0]?h[0].bind(b):null,m=h[1]?h[1].bind(b):null,n=h[2]?h[2].bind(b):null,v=h[3]?h[3].bind(b):null,r=h[5]||1;65472<=g&&65487>=g&&(!l&&n&&(l=function(a){return function(b){return a(b)&255}.bind(b)}(n)),!m&&v&&(m=function(a){return function(b,c){return a(b,c)}.bind(b)}(v)));for(var w=h[4],y=0;y<r;y++,g+=2)if(w&&1<r&&(w=h[4]+y),!Lc(a,g,g,l,m,n,v,d||64,w||e))return!1}}return!0}function Jb(a,b){a.A.push(b)}
|
|
|
|
|
k.Da=function(a,b,c){this.f=!0;this.la||(this.i&&F(this.i,32)&&E(this.i,"memory fault ("+c+") on "+J(this.i,a),!0,!0),b&&(this.b.Ha|=b),this.b.sa(4,0,a))};function Mc(a){var b=a.f;a.f=!1;return b}function Ac(a,b,c){q("Memory block error ("+a+": "+p(b)+","+p(c)+")");return!1}function K(a){t.call(this,"Device",a,K,512);this.f={ea:0,mc:-1}}z(K);k=K.prototype;
|
|
|
|
|
k.Ea=function(a,b,c,d){this.v=b;this.C=a;this.b=c;this.i=d;var e=this;this.f.mc=Nc(c,function(){e.f.Gb|=128;e.f.Gb&64&&Oc(e.b,e.f.ae);e.C&&e.C.oa(1);Pc(e.b,e.f.mc,1E3/60)});this.f.ae=Qc(64,6);Hb(b,this,Rc);Jb(b,this.reset.bind(this));H(this)};k.reset=function(){this.f.Gb=128;Pc(this.b,this.f.mc,1E3/60,!0)};k.qd=function(){return this.f.Gb};k.ke=function(a){this.f.Gb=a&192};k.sd=function(){var a=this.b;return a.D&62337|a.Na<<5|a.Za<<1};
|
|
|
|
|
k.me=function(a){var b=this.b;a&=62337;if(b.D!=a){b.D=a;b.Na=a>>5&3;b.Za=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Ua!=c&&(b.Ua=c,Sc(b))}};k.td=function(){var a=this.b.fb;a&65280&&(a=(a<<8|a>>8)&65535);return a};k.ud=function(){return this.b.Kb};k.vd=function(){return this.b.pb};k.ne=function(a){var b=this.b;1170>b.cb&&(a&=-49);b.pb!=a&&(b.pb=a,b.Sb=a&16?4194303:262143,Sc(b))};k.Wd=function(a){a=a>>1&63;var b=this.b.Lb[a>>1];return a&1?b>>16:b&65535};
|
|
|
|
|
k.Oe=function(a,b){b=b>>1&63;var c=b>>1;this.b.Lb[c]=b&1?this.b.Lb[c]&65535|(a&63)<<16:this.b.Lb[c]&-65536|a&65534};k.Pd=function(a){return this.b.V[1][a>>1&7]};k.He=function(a,b){this.b.V[1][b>>1&7]=a&65295};k.Nd=function(a){return this.b.V[1][(a>>1&7)+8]};k.Fe=function(a,b){this.b.V[1][(b>>1&7)+8]=a&65295};k.Od=function(a){return this.b.xa[1][a>>1&7]};k.Ge=function(a,b){b=b>>1&7;this.b.xa[1][b]=a;this.b.V[1][b]&=65295};k.Md=function(a){return this.b.xa[1][(a>>1&7)+8]};
|
|
|
|
|
k.Ee=function(a,b){b=(b>>1&7)+8;this.b.xa[1][b]=a;this.b.V[1][b]&=65295};k.pd=function(a){return this.b.V[0][a>>1&7]};k.je=function(a,b){this.b.V[0][b>>1&7]=a&65295};k.nd=function(a){return this.b.V[0][(a>>1&7)+8]};k.he=function(a,b){this.b.V[0][(b>>1&7)+8]=a&65295};k.od=function(a){return this.b.xa[0][a>>1&7]};k.ie=function(a,b){b=b>>1&7;this.b.xa[0][b]=a;this.b.V[0][b]&=65295};k.md=function(a){return this.b.xa[0][(a>>1&7)+8]};k.ge=function(a,b){b=(b>>1&7)+8;this.b.xa[0][b]=a;this.b.V[0][b]&=65295};
|
|
|
|
|
k.Vd=function(a){return this.b.V[3][a>>1&7]};k.Ne=function(a,b){this.b.V[3][b>>1&7]=a&65295};k.Td=function(a){return this.b.V[3][(a>>1&7)+8]};k.Le=function(a,b){this.b.V[3][(b>>1&7)+8]=a&65295};k.Ud=function(a){return this.b.xa[3][a>>1&7]};k.Me=function(a,b){b=b>>1&7;this.b.xa[3][b]=a;this.b.V[3][b]&=65295};k.Sd=function(a){return this.b.xa[3][(a>>1&7)+8]};k.Ke=function(a,b){b=(b>>1&7)+8;this.b.xa[3][b]=a;this.b.V[3][b]&=65295};k.zb=function(a){a&=7;return this.b.N&2048?this.b.Wa[a]:this.b.u[a]};
|
|
|
|
|
k.Cb=function(a,b){b&=7;this.b.N&2048?this.b.Wa[b]=a:this.b.u[b]=a};k.Ad=function(){return this.b.N&49152?this.b.Ia[0]:this.b.u[6]};k.se=function(a){this.b.N&49152?this.b.Ia[0]=a:this.b.u[6]=a};k.Dd=function(){return this.b.u[7]};k.ve=function(a){this.b.u[7]=a};k.Ab=function(a){a&=7;return this.b.N&2048?this.b.u[a]:this.b.Wa[a]};k.Db=function(a,b){b&=7;this.b.N&2048?this.b.u[b]=a:this.b.Wa[b]=a};k.Bd=function(){return 1==(this.b.N&49152)>>14?this.b.u[6]:this.b.Ia[1]};
|
|
|
|
|
k.te=function(a){1==(this.b.N&49152)>>14?this.b.u[6]=a:this.b.Ia[1]=a};k.Cd=function(){return 3==(this.b.N&49152)>>14?this.b.u[6]:this.b.Ia[3]};k.ue=function(a){3==(this.b.N&49152)>>14?this.b.u[6]=a:this.b.Ia[3]=a};k.kd=function(a){return this.b.Ec[a-65504>>1]};k.ee=function(a,b){this.b.Ec[b-65504>>1]=a};k.Bc=function(a){if(65520==a){a=0;switch(Bc){case Bc:a=this.v.cc}a=(a>>6)-1}else a=0;return a};k.Ic=function(){};k.Rd=function(){return 1};k.Je=function(){};k.jd=function(){return this.b.Ha};
|
|
|
|
|
k.de=function(){this.b.Ha=0};k.rd=function(){return this.b.Dc};k.le=function(a,b){b&1||(a&=255);this.b.Dc=a};k.wd=function(a){return a?this.b.kc:0};k.oe=function(a){var b=this.b;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.kc=a;b.K|=2};k.Qd=function(a){return a?this.b.Wb&65280:0};k.Ie=function(a){this.b.Wb=a|255};k.zd=function(){return Tc(this.b)};k.re=function(a){Uc(this.b,a&-1793|Tc(this.b)&1792);this.b.K|=128};k.Hc=function(a,b){F(this)&&E(this,"writeIgnored("+qa(b)+"): "+qa(a),!0,!0)};
|
|
|
|
|
var L={},Rc=(L[61568]=[null,null,K.prototype.Wd,K.prototype.Oe,"UNIMAP",64,1170],L[62592]=[null,null,K.prototype.Pd,K.prototype.He,"SIPDR",8,1145],L[62608]=[null,null,K.prototype.Nd,K.prototype.Fe,"SDPDR",8,1145],L[62624]=[null,null,K.prototype.Od,K.prototype.Ge,"SIPAR",8,1145],L[62640]=[null,null,K.prototype.Md,K.prototype.Ee,"SDPAR",8,1145],L[62656]=[null,null,K.prototype.pd,K.prototype.je,"KIPDR",8,1145],L[62672]=[null,null,K.prototype.nd,K.prototype.he,"KDPDR",8,1145],L[62688]=[null,null,K.prototype.od,
|
|
|
|
|
K.prototype.ie,"KIPAR",8,1145],L[62704]=[null,null,K.prototype.md,K.prototype.ge,"KDPAR",8,1145],L[62798]=[null,null,K.prototype.vd,K.prototype.ne,"MMR3",1,1145],L[65382]=[null,null,K.prototype.qd,K.prototype.ke,"LKS"],L[65402]=[null,null,K.prototype.sd,K.prototype.me,"MMR0",1,1145],L[65404]=[null,null,K.prototype.td,K.prototype.Hc,"MMR1",1,1145],L[65406]=[null,null,K.prototype.ud,K.prototype.Hc,"MMR2",1,1145],L[65408]=[null,null,K.prototype.Vd,K.prototype.Ne,"UIPDR",8,1145],L[65424]=[null,null,K.prototype.Td,
|
|
|
|
|
K.prototype.Le,"UDPDR",8,1145],L[65440]=[null,null,K.prototype.Ud,K.prototype.Me,"UIPAR",8,1145],L[65456]=[null,null,K.prototype.Sd,K.prototype.Ke,"UDPAR",8,1145],L[65472]=[null,null,K.prototype.zb,K.prototype.Cb,"R0SET0"],L[65473]=[null,null,K.prototype.zb,K.prototype.Cb,"R1SET0"],L[65474]=[null,null,K.prototype.zb,K.prototype.Cb,"R2SET0"],L[65475]=[null,null,K.prototype.zb,K.prototype.Cb,"R3SET0"],L[65476]=[null,null,K.prototype.zb,K.prototype.Cb,"R4SET0"],L[65477]=[null,null,K.prototype.zb,K.prototype.Cb,
|
|
|
|
|
"R5SET0"],L[65478]=[null,null,K.prototype.Ad,K.prototype.se,"R6KERNEL"],L[65479]=[null,null,K.prototype.Dd,K.prototype.ve,"R7KERNEL"],L[65480]=[null,null,K.prototype.Ab,K.prototype.Db,"R0SET1",1,1145],L[65481]=[null,null,K.prototype.Ab,K.prototype.Db,"R1SET1",1,1145],L[65482]=[null,null,K.prototype.Ab,K.prototype.Db,"R2SET1",1,1145],L[65483]=[null,null,K.prototype.Ab,K.prototype.Db,"R3SET1",1,1145],L[65484]=[null,null,K.prototype.Ab,K.prototype.Db,"R4SET1",1,1145],L[65485]=[null,null,K.prototype.Ab,
|
|
|
|
|
K.prototype.Db,"R5SET1",1,1145],L[65486]=[null,null,K.prototype.Bd,K.prototype.te,"R6SUPER",1,1145],L[65487]=[null,null,K.prototype.Cd,K.prototype.ue,"R6USER",1,1145],L[65504]=[null,null,K.prototype.kd,K.prototype.ee,"CTRL",8,1170],L[65520]=[null,null,K.prototype.Bc,K.prototype.Ic,"LSIZE",1,1170],L[65522]=[null,null,K.prototype.Bc,K.prototype.Ic,"HSIZE",1,1170],L[65524]=[null,null,K.prototype.Rd,K.prototype.Je,"SYSID",1,1170],L[65526]=[null,null,K.prototype.jd,K.prototype.de,"CPUERR",1,1170],L[65528]=
|
|
|
|
|
[null,null,K.prototype.rd,K.prototype.le,"MB",1,1170],L[65530]=[null,null,K.prototype.wd,K.prototype.oe,"PIR"],L[65532]=[null,null,K.prototype.Qd,K.prototype.Ie,"SL"],L[65534]=[null,null,K.prototype.zd,K.prototype.re,"PSW"],L);Za(function(){for(var a=D(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=A(d);switch(c.type){case "default":c=new K(c);B(c,d);break;case "pc11":c=new Vc(c);B(c,d);break;case "rl11":c=new M(c),B(c,d)}}});var Wc;
|
|
|
|
|
k.Da=function(a,b,c){this.f=!0;this.la||(this.i&&F(this.i,32)&&E(this.i,"memory fault ("+c+") on "+J(this.i,a),!0,!0),b&&(this.b.Ha|=b),this.b.ta(4,0,a))};function Mc(a){var b=a.f;a.f=!1;return b}function Ac(a,b,c){q("Memory block error ("+a+": "+p(b)+","+p(c)+")");return!1}function K(a){t.call(this,"Device",a,K,512);this.f={ea:0,lc:-1}}z(K);k=K.prototype;
|
|
|
|
|
k.Ea=function(a,b,c,d){this.v=b;this.C=a;this.b=c;this.i=d;var e=this;this.f.lc=Nc(c,function(){e.f.Ib|=128;e.f.Ib&64&&Oc(e.b,e.f.ce);e.C&&e.C.oa(1);Pc(e.b,e.f.lc,1E3/60)});this.f.ce=Qc(64,6);Hb(b,this,Rc);Jb(b,this.reset.bind(this));H(this)};k.reset=function(){this.f.Ib=128;Pc(this.b,this.f.lc,1E3/60,!0)};k.sd=function(){return this.f.Ib};k.me=function(a){this.f.Ib=a&192};k.ud=function(){var a=this.b;return a.J&62337|a.Za<<5|a.kb<<1};
|
|
|
|
|
k.oe=function(a){var b=this.b;a&=62337;if(b.J!=a){b.J=a;b.Za=a>>5&3;b.kb=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Ua!=c&&(b.Ua=c,Sc(b))}};k.vd=function(){var a=this.b;a.J&57344||(a.Ac=a.S&65535);a=a.Ac;a&65280&&(a=(a<<8|a>>8)&65535);return a};k.wd=function(){var a=this.b;a.J&57344||(a.Bc=a.Hb);return a.Bc};k.xd=function(){return this.b.pb};k.pe=function(a){var b=this.b;1170>b.cb&&(a&=-49);b.pb!=a&&(b.pb=a,b.Ub=a&16?4194303:262143,Sc(b))};
|
|
|
|
|
k.Yd=function(a){a=a>>1&63;var b=this.b.Mb[a>>1];return a&1?b>>16:b&65535};k.Qe=function(a,b){b=b>>1&63;var c=b>>1;this.b.Mb[c]=b&1?this.b.Mb[c]&65535|(a&63)<<16:this.b.Mb[c]&-65536|a&65534};k.Rd=function(a){return this.b.V[1][a>>1&7]};k.Je=function(a,b){this.b.V[1][b>>1&7]=a&65295};k.Pd=function(a){return this.b.V[1][(a>>1&7)+8]};k.He=function(a,b){this.b.V[1][(b>>1&7)+8]=a&65295};k.Qd=function(a){return this.b.ya[1][a>>1&7]};k.Ie=function(a,b){b=b>>1&7;this.b.ya[1][b]=a;this.b.V[1][b]&=65295};
|
|
|
|
|
k.Od=function(a){return this.b.ya[1][(a>>1&7)+8]};k.Ge=function(a,b){b=(b>>1&7)+8;this.b.ya[1][b]=a;this.b.V[1][b]&=65295};k.rd=function(a){return this.b.V[0][a>>1&7]};k.le=function(a,b){this.b.V[0][b>>1&7]=a&65295};k.pd=function(a){return this.b.V[0][(a>>1&7)+8]};k.je=function(a,b){this.b.V[0][(b>>1&7)+8]=a&65295};k.qd=function(a){return this.b.ya[0][a>>1&7]};k.ke=function(a,b){b=b>>1&7;this.b.ya[0][b]=a;this.b.V[0][b]&=65295};k.od=function(a){return this.b.ya[0][(a>>1&7)+8]};
|
|
|
|
|
k.ie=function(a,b){b=(b>>1&7)+8;this.b.ya[0][b]=a;this.b.V[0][b]&=65295};k.Xd=function(a){return this.b.V[3][a>>1&7]};k.Pe=function(a,b){this.b.V[3][b>>1&7]=a&65295};k.Vd=function(a){return this.b.V[3][(a>>1&7)+8]};k.Ne=function(a,b){this.b.V[3][(b>>1&7)+8]=a&65295};k.Wd=function(a){return this.b.ya[3][a>>1&7]};k.Oe=function(a,b){b=b>>1&7;this.b.ya[3][b]=a;this.b.V[3][b]&=65295};k.Ud=function(a){return this.b.ya[3][(a>>1&7)+8]};k.Me=function(a,b){b=(b>>1&7)+8;this.b.ya[3][b]=a;this.b.V[3][b]&=65295};
|
|
|
|
|
k.yb=function(a){a&=7;return this.b.N&2048?this.b.Wa[a]:this.b.u[a]};k.Cb=function(a,b){b&=7;this.b.N&2048?this.b.Wa[b]=a:this.b.u[b]=a};k.Cd=function(){return this.b.N&49152?this.b.Ia[0]:this.b.u[6]};k.ue=function(a){this.b.N&49152?this.b.Ia[0]=a:this.b.u[6]=a};k.Fd=function(){return this.b.u[7]};k.xe=function(a){this.b.u[7]=a};k.zb=function(a){a&=7;return this.b.N&2048?this.b.u[a]:this.b.Wa[a]};k.Db=function(a,b){b&=7;this.b.N&2048?this.b.u[b]=a:this.b.Wa[b]=a};
|
|
|
|
|
k.Dd=function(){return 1==(this.b.N&49152)>>14?this.b.u[6]:this.b.Ia[1]};k.ve=function(a){1==(this.b.N&49152)>>14?this.b.u[6]=a:this.b.Ia[1]=a};k.Ed=function(){return 3==(this.b.N&49152)>>14?this.b.u[6]:this.b.Ia[3]};k.we=function(a){3==(this.b.N&49152)>>14?this.b.u[6]=a:this.b.Ia[3]=a};k.md=function(a){return this.b.Gc[a-65504>>1]};k.ge=function(a,b){this.b.Gc[b-65504>>1]=a};k.Dc=function(a){if(65520==a){a=0;switch(Bc){case Bc:a=this.v.bc}a=(a>>6)-1}else a=0;return a};k.Kc=function(){};k.Td=function(){return 1};
|
|
|
|
|
k.Le=function(){};k.ld=function(){return this.b.Ha};k.fe=function(){this.b.Ha=0};k.td=function(){return this.b.Fc};k.ne=function(a,b){b&1||(a&=255);this.b.Fc=a};k.yd=function(a){return a?this.b.jc:0};k.qe=function(a){var b=this.b;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.jc=a;b.K|=2};k.Sd=function(a){return a?this.b.Wb&65280:0};k.Ke=function(a){this.b.Wb=a|255};k.Bd=function(){return Tc(this.b)};k.te=function(a){Uc(this.b,a&-1793|Tc(this.b)&1792);this.b.K|=128};
|
|
|
|
|
k.Jc=function(a,b){F(this)&&E(this,"writeIgnored("+qa(b)+"): "+qa(a),!0,!0)};
|
|
|
|
|
var L={},Rc=(L[61568]=[null,null,K.prototype.Yd,K.prototype.Qe,"UNIMAP",64,1170],L[62592]=[null,null,K.prototype.Rd,K.prototype.Je,"SIPDR",8,1145],L[62608]=[null,null,K.prototype.Pd,K.prototype.He,"SDPDR",8,1145],L[62624]=[null,null,K.prototype.Qd,K.prototype.Ie,"SIPAR",8,1145],L[62640]=[null,null,K.prototype.Od,K.prototype.Ge,"SDPAR",8,1145],L[62656]=[null,null,K.prototype.rd,K.prototype.le,"KIPDR",8,1145],L[62672]=[null,null,K.prototype.pd,K.prototype.je,"KDPDR",8,1145],L[62688]=[null,null,K.prototype.qd,
|
|
|
|
|
K.prototype.ke,"KIPAR",8,1145],L[62704]=[null,null,K.prototype.od,K.prototype.ie,"KDPAR",8,1145],L[62798]=[null,null,K.prototype.xd,K.prototype.pe,"MMR3",1,1145],L[65382]=[null,null,K.prototype.sd,K.prototype.me,"LKS"],L[65402]=[null,null,K.prototype.ud,K.prototype.oe,"MMR0",1,1145],L[65404]=[null,null,K.prototype.vd,K.prototype.Jc,"MMR1",1,1145],L[65406]=[null,null,K.prototype.wd,K.prototype.Jc,"MMR2",1,1145],L[65408]=[null,null,K.prototype.Xd,K.prototype.Pe,"UIPDR",8,1145],L[65424]=[null,null,K.prototype.Vd,
|
|
|
|
|
K.prototype.Ne,"UDPDR",8,1145],L[65440]=[null,null,K.prototype.Wd,K.prototype.Oe,"UIPAR",8,1145],L[65456]=[null,null,K.prototype.Ud,K.prototype.Me,"UDPAR",8,1145],L[65472]=[null,null,K.prototype.yb,K.prototype.Cb,"R0SET0"],L[65473]=[null,null,K.prototype.yb,K.prototype.Cb,"R1SET0"],L[65474]=[null,null,K.prototype.yb,K.prototype.Cb,"R2SET0"],L[65475]=[null,null,K.prototype.yb,K.prototype.Cb,"R3SET0"],L[65476]=[null,null,K.prototype.yb,K.prototype.Cb,"R4SET0"],L[65477]=[null,null,K.prototype.yb,K.prototype.Cb,
|
|
|
|
|
"R5SET0"],L[65478]=[null,null,K.prototype.Cd,K.prototype.ue,"R6KERNEL"],L[65479]=[null,null,K.prototype.Fd,K.prototype.xe,"R7KERNEL"],L[65480]=[null,null,K.prototype.zb,K.prototype.Db,"R0SET1",1,1145],L[65481]=[null,null,K.prototype.zb,K.prototype.Db,"R1SET1",1,1145],L[65482]=[null,null,K.prototype.zb,K.prototype.Db,"R2SET1",1,1145],L[65483]=[null,null,K.prototype.zb,K.prototype.Db,"R3SET1",1,1145],L[65484]=[null,null,K.prototype.zb,K.prototype.Db,"R4SET1",1,1145],L[65485]=[null,null,K.prototype.zb,
|
|
|
|
|
K.prototype.Db,"R5SET1",1,1145],L[65486]=[null,null,K.prototype.Dd,K.prototype.ve,"R6SUPER",1,1145],L[65487]=[null,null,K.prototype.Ed,K.prototype.we,"R6USER",1,1145],L[65504]=[null,null,K.prototype.md,K.prototype.ge,"CTRL",8,1170],L[65520]=[null,null,K.prototype.Dc,K.prototype.Kc,"LSIZE",1,1170],L[65522]=[null,null,K.prototype.Dc,K.prototype.Kc,"HSIZE",1,1170],L[65524]=[null,null,K.prototype.Td,K.prototype.Le,"SYSID",1,1170],L[65526]=[null,null,K.prototype.ld,K.prototype.fe,"CPUERR",1,1170],L[65528]=
|
|
|
|
|
[null,null,K.prototype.td,K.prototype.ne,"MB",1,1170],L[65530]=[null,null,K.prototype.yd,K.prototype.qe,"PIR"],L[65532]=[null,null,K.prototype.Sd,K.prototype.Ke,"SL"],L[65534]=[null,null,K.prototype.Bd,K.prototype.te,"PSW"],L);Za(function(){for(var a=D(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=A(d);switch(c.type){case "default":c=new K(c);B(c,d);break;case "pc11":c=new Vc(c);B(c,d);break;case "rl11":c=new M(c),B(c,d)}}});var Wc;
|
|
|
|
|
if(zb){var Xc=new ArrayBuffer(2);(new DataView(Xc)).setUint16(0,256,!0);Wc=256===(new Uint16Array(Xc))[0]}else Wc=!1;var Yc=Wc;
|
|
|
|
|
function I(a,b,c,d,e,f){this.v=a;this.id=Zc+=2;this.b=null;this.F=b;this.Mb=c;this.size=d||0;this.type=e||$c;this.f=e==ad;this.controller=null;tc(this);this.Sa=this.Rc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.b=a[0],bd(this,f.Lc);else if(zb)this.A=new ArrayBuffer(this.size),this.D=new DataView(this.A,0,this.size),this.G=new Uint8Array(this.A,0,this.size),this.I=new Uint16Array(this.A,0,this.size>>1),this.b=new Int32Array(this.A,0,this.size>>2),bd(this,Yc?cd:dd);else{a=this.b=Array(this.size>>
|
|
|
|
|
function I(a,b,c,d,e,f){this.v=a;this.id=Zc+=2;this.b=null;this.F=b;this.Nb=c;this.size=d||0;this.type=e||$c;this.f=e==ad;this.controller=null;tc(this);this.Sa=this.Tc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.b=a[0],bd(this,f.Nc);else if(zb)this.A=new ArrayBuffer(this.size),this.D=new DataView(this.A,0,this.size),this.G=new Uint8Array(this.A,0,this.size),this.I=new Uint16Array(this.A,0,this.size>>1),this.b=new Int32Array(this.A,0,this.size>>2),bd(this,Yc?cd:dd);else{a=this.b=Array(this.size>>
|
|
|
|
|
2);for(f=0;f<a.length;f++)a[f]=0;bd(this,ed)}else bd(this)}var $c=0,Bc=1,ad=2,zc=4,Cc=["NONE","RAM","ROM","VID","H/W"],Zc=0;
|
|
|
|
|
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(zb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.D.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(zb)for(b=0;b<a.length;b++)this.D.setInt32(b<<2,a[b],!0);else this.b=a;return this.Sa=!0}return!1},nb:function(a,b){b?this.C++||fd(this,gd,!1):this.g++||hd(this,gd,!1)},J:function(a,b){this.i&&F(this.i,128)&&E(this.i,
|
|
|
|
|
"attempt to read invalid address "+J(this.i,b),!0);this.v.Da(b,32,2);return 255},B:function(a,b,c){this.i&&F(this.i,128)&&E(this.i,"attempt to write "+J(this.i,b)+" to invalid addresses "+J(this.i,c),!0);this.v.Da(c,32,4)},L:function(a,b){return this.Vb(a++,b++)|this.Vb(a,b)<<8},H:function(a,b,c){this.Zb(a++,b&255,c++);this.Zb(a,b>>8,c)},S:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ca:function(a,b){a&1&&this.v.Da(b,64,2);b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+
|
|
|
|
|
1]&255)<<8},ta:function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<<a)|b<<a;this.Sa=!0},Na:function(a,b,c){a&1&&this.v.Da(c,64,4);c=a>>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<<a)|b<<a:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>8);this.Sa=!0},O:function(a,b){if(this.i&&null!=this.F){var c=this.i;id(c,this.F+a,1,c.M)&&c.fa(!0)}return this.hc(a,b)},Qa:function(a,b){if(this.i&&null!=this.F){var c=this.i;id(c,this.F+a,2,c.M)&&c.fa(!0)}return this.ic(a,b)},ka:function(a,
|
|
|
|
|
b,c){if(this.i&&null!=this.F){var d=this.i;id(d,this.F+a,1,d.D)&&d.fa(!0)}this.f?this.B(a,b,c):this.$b(a,b,c)},wa:function(a,b,c){if(this.i&&null!=this.F){var d=this.i;id(d,this.F+a,2,d.D)&&d.fa(!0)}this.f?this.B(a,b,c):this.nc(a,b,c)},M:function(a){return this.G[a]},R:function(a,b){a=this.G[a];this.i&&F(this.i,128)&&E(this.i,"Memory.readByte("+J(this.i,b)+"): "+J(this.i,a),!0);return a},X:function(a,b){a&1&&this.v.Da(b,64,2);return this.D.getUint16(a,!0)},ba:function(a,b){a&1&&this.v.Da(b,64,2);
|
|
|
|
|
a=this.I[a>>1];this.i&&F(this.i,128)&&E(this.i,"Memory.readWord("+J(this.i,b)+"): "+J(this.i,a),!0);return a},ia:function(a,b){this.G[a]=b;this.Sa=!0},Ya:function(a,b,c){this.G[a]=b;this.Sa=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0)},va:function(a,b,c){a&1&&this.v.Da(c,64,4);this.D.setUint16(a,b,!0);this.Sa=!0},Aa:function(a,b,c){a&1&&this.v.Da(c,64,4);this.I[a>>1]=b;this.Sa=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeWord("+J(this.i,c)+","+J(this.i,
|
|
|
|
|
b)+")",!0)}};function tc(a,b,c){a.i=b;a.g=a.C=0;c&&((a.g=c.g)&&hd(a,gd,!1),(a.C=c.C)&&fd(a,gd,!1))}function jd(a,b){b?--a.C||(a.Zb=a.f?a.B:a.$b,a.Nb=a.f?a.H:a.nc):--a.g||(a.Vb=a.hc,a.qa=a.ic)}function fd(a,b,c){c&&a.C||(a.Zb=!a.f&&b[1]||a.B,a.Nb=!a.f&&b[3]||a.H);if(c||void 0===c)a.$b=b[1]||a.B,a.nc=b[3]||a.H}function hd(a,b,c){c&&a.g||(a.Vb=b[0]||a.J,a.qa=b[2]||a.L);if(c||void 0===c)a.hc=b[0]||a.J,a.ic=b[2]||a.L}function bd(a,b){b||(b=kd);hd(a,b,void 0);fd(a,b,void 0)}
|
|
|
|
|
var kd=[],ed=[I.prototype.S,I.prototype.ta,I.prototype.ca,I.prototype.Na],gd=[I.prototype.O,I.prototype.ka,I.prototype.Qa,I.prototype.wa];if(zb)var dd=[I.prototype.M,I.prototype.ia,I.prototype.X,I.prototype.va],cd=[I.prototype.R,I.prototype.Ya,I.prototype.ba,I.prototype.Aa];
|
|
|
|
|
function ld(a,b){t.call(this,"CPU",a,ld,1);var c=a.multiplier||1;this.kb=a.cycles||b;this.eb=c;this.ub=Math.round(this.kb/1E4)/100;this.ob=this.ub*this.eb;this.w.W=!1;this.w.Yb=!1;this.w.sb=a.autoStart;this.w.vb=!1;this.Hb=this.ta=0;this.Ib=a.csStart;this.wb=a.csInterval;this.xb=a.csStop;this.L=[];this.zc=this.$d.bind(this);H(this)}z(ld);var md=["power","reset"];k=ld.prototype;
|
|
|
|
|
k.Ea=function(a,b,c,d){this.C=a;this.v=b;this.i=d;this.B=a.B;for(b=0;b<md.length;b++)(c=this.G[md[b]])&&this.C.ra(null,md[b],c);a=nd(a,"autoStart");null!=a&&(this.w.sb="true"==a?!0:"false"==a?!1:!!a);H(this)};k.reset=function(){};k.save=function(){return null};k.restore=function(){return!1};
|
|
|
|
|
k.Ga=function(a,b){if(!b){if(a&&this.restore){od(this);if(!this.restore(a))return!1;pd(this)}else this.reset();this.i?(a=this.i,b=this.w.sb,a.kb=!0,a.j("Type ? for help with PDPjs Debugger commands"),qd(a),b||a.rb(),a.Za&&(b=a.Za,a.Za=null,rd(a,b))):this.j("No debugger detected")}return!0};k.Fa=function(a){return a?this.save():!0};k.sb=function(){return this.w.sb||!this.i&&void 0===this.G.run?(this.ib(),!0):!1};k.uc=function(){return 0};
|
|
|
|
|
function pd(a){void 0===a.Ib&&(a.Ib=0);void 0===a.wb&&(a.wb=-1);void 0===a.xb&&(a.xb=-1);a.w.vb=0<=a.Ib&&0<a.wb;a.w.vb&&(a.Hb=0,a.ta=a.Ib-a.ka)}function fc(a,b){if(a.w.vb){var c=!1;a.Hb=a.Hb+a.uc()|0;a.ta-=b;0>=a.ta&&(a.ta+=a.wb,c=!0);0<=a.xb&&a.xb<=sd(a)&&(a.wb=a.xb=-1,pd(a),a.fa(),c=!0);c&&a.j(sd(a)+" cycles: checksum="+p(a.Hb))}}
|
|
|
|
|
k.ra=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.G[b]=c,!0;case "run":return this.G[b]=c,c.onclick=function(){var a;if(a=d.C)if(a=d.C,a.w.ha)a=!0;else{var b=null,c,h=rb(a.id);for(c=0;c<h.length&&(b=h[c],b===a||b.w.ready);c++);if(c==h.length)for(c=0;c<h.length&&(b=h[c],b===a||b.w.ha);c++);c==h.length&&(b=a);q("The "+b.type+" component ("+b.id+") is not "+(b.w.ready?"powered yet":"ready yet"+(b.Rb?" (waiting for notification)":""))+".");a=!1}a&&(d.w.W?d.fa():d.ib())},
|
|
|
|
|
!0;case "speed":return this.G[b]=c,!0;case "setSpeed":return this.G[b]=c,c.onclick=function(){td(d,d.eb<<1,!0)},c.textContent=this.ob.toFixed(2)+"Mhz",!0}return!1};k.oa=function(a){this.C&&this.C.oa(a)};function ec(a,b,c){a.ka+=b;c&&(a.ia=a.b=a.J=0)}function ud(a,b){var c=1;b&&1<a.eb&&a.ba&&(c=a.ba/a.ub);a.Ub=Math.round(1E3/30);a.mb=Math.floor(a.kb/30*c);b||(a.va=a.mb);a.Eb=0}function sd(a){return a.ka+a.X+a.ia-a.b}function od(a){a.ba=0;a.xc=0;a.ka=a.X=a.ia=a.b=a.J=0;pd(a);td(a,1)}
|
|
|
|
|
function td(a,b,c){var d=!1;if(void 0!==b){.8>a.ba/a.ob?b=1:d=!0;a.eb=b;b=a.ub*a.eb;if(a.ob!=b){a.ob=b;b=a.ob.toFixed(2)+"Mhz";var e=a.G.setSpeed;e&&(e.textContent=b);a.j("target speed: "+b)}c&&a.C&&a.C.rb()}ec(a,a.X);a.X=0;a.S=Aa();a.ca=0;ud(a);return d}function Nc(a,b){var c=a.L.length;a.L.push([-1,b]);return c}function Pc(a,b,c,d){0<=b&&b<a.L.length&&(d||0>a.L[b][0])&&(c=a.kb*a.eb/1E3*c|0,a.w.W&&(c+=vd(a)),a.L[b][0]=c)}
|
|
|
|
|
function wd(a,b){for(var c=a.L.length-1;0<=c;c--){var d=a.L[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function dc(a,b){for(var c=a.L.length-1;0<=c;c--){var d=a.L[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function vd(a,b){var c=a.ia-=a.b;a.b=a.J=0;b&&(a.ia=0);return c}
|
|
|
|
|
k.$d=function(){if(this.w.W){this.Eb>=this.kb&&ud(this,!0);this.Aa=0;this.lb=Aa();if(this.ca){var a=this.lb-this.ca;a>this.Ub&&(this.S+=a,this.S>this.lb&&(this.S=this.lb))}try{do{var b=wd(this,this.w.vb?1:this.mb);try{this.jb(b)}catch(e){if("number"!=typeof e)throw e;}b=vd(this,!0);this.Aa+=b;this.X+=b;fc(this,b);dc(this,b);this.va-=b;if(0>=this.va){this.va+=this.mb;15<=++this.xc&&(this.oa(),this.xc=0);break}}while(this.w.W)}catch(e){this.fa();this.C&&this.C.stop(Aa(),sd(this));yb(this,e.stack||e.message);
|
|
|
|
|
return}if(this.w.W){a=setTimeout;b=this.zc;this.ca=Aa();var c=this.Ub;this.Aa&&(c=Math.round(c*this.Aa/this.mb));var c=c-(this.ca-this.lb),d=this.ca-this.S;d&&(this.ba=Math.round(this.X/(10*d))/100,864E5<=d&&(this.ka=0,td(this)));if(0>c||this.ba<this.ob)-1E3>c&&(this.S-=c),c=0;this.Eb+=this.Aa;this.ca+=c;a(b,c)}}};
|
|
|
|
|
k.ib=function(a){if(xb(this))return!1;if(this.w.W)return this.j(this.toString()+" busy"),!1;td(this);this.w.W=!0;this.w.Yb=!0;var b=this.G.run;b&&(b.textContent="Halt");this.C&&(a&&this.C.rb(!0),this.C.start(this.S,sd(this)));setTimeout(this.zc,0);return!0};k.jb=function(){return 0};k.fa=function(a){var b=!1;if(this.w.W){vd(this);ec(this,this.X);this.X=0;this.w.W=!1;if(b=this.G.run)b.textContent="Run";this.C&&this.C.stop(Aa(),sd(this));b=!0}this.w.complete=a;return b};
|
|
|
|
|
function xd(a){this.cb=+a.model||1170;this.Ob=a.addrReset||0;ld.call(this,a,6666667);this.decode=1120==this.cb?yd.bind(this):zd.bind(this);Ad(this);this.M=0;this.O=null;this.w.complete=!1}z(xd,ld);k=xd.prototype;k.reset=function(){this.status("model "+this.cb);this.w.W&&this.fa();Ad(this);od(this);this.w.error=!1;this.parent.reset.call(this)};
|
|
|
|
|
function Ad(a){a.T=65536;a.U=32768;a.$=65535;a.Z=32768;a.N=15;a.u=[0,0,0,0,0,0,0,a.Ob];a.Wa=[0,0,0,0,0,0];a.Ia=[0,0,0,0];a.A=0;a.Za=0;a.Uc=[4,2,0,1];a.V=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.xa=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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.Lb=[0,0,0,0,0,0,0,0,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.Ec=[0,0,0,0,0,0,0,0];a.Dc=0;a.K=0;a.H=a.I=0;a.g=a.f=a.tb=0;a.wa=-1;cc(a)}function cc(a){a.Wb=255;a.Ha=0;a.kc=0;a.D=0;a.fb=0;a.Kb=0;a.pb=0;a.Ua=0;a.Na=0;a.Sb=262143;a.O=null;a.v&&Sc(a)}function Sc(a){a.Ua?(a.R=65536,a.aa=a.Tc,a.qa=a.Xd,a.Nb=a.Pe,vc(a.v,a.pb&16?22:18)):(a.R=0,a.aa=a.Sc,a.qa=a.Cc,a.Nb=a.Jc,vc(a.v,16))}k.uc=function(){return 0};k.save=function(){var a=new N(this);a.set(0,[]);a.set(1,[this.ka,this.eb]);a.set(2,Kc(this.v));return a.data()};
|
|
|
|
|
k.restore=function(a){var b=a[1];this.ka=b[1];td(this,b[3]);a:{b=this.v;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),h=0;h<e.length-1;)for(var l=e[h++],m=e[h++];l--;)g[f++]=m;e=g}f=b.Y[d];if(!f||!f.restore(e)){q("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function Bd(a){return a.T&65536?1:0}function Cd(a){return a.U&32768?2:0}function Dd(a){return a.$&65535?0:4}k.Ta=function(){return this.Z&32768?8:0};
|
|
|
|
|
function Ed(a){var b=a.u[7];a.D&57344||(a.fb=0,a.Kb=b);a.u[7]=b+2&65535;return a.qa(b)}function Fd(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 Qc(a,b){return{be:a,yb:b,next:null}}function Oc(a,b){if(b!=a.O){var c=a.O;if(!c||c.yb<=b.yb)b.next=c,a.O=b;else{do{var d=c.next;if(!d||d.yb<=b.yb){b.next=d;c.next=b;break}c=d}while(c)}}a.K|=2}function Gd(a){return a.K&64?(a.sa(168,64,-1),!0):a.K&32?(a.sa(4,32,-5),!0):a.K&16?(a.sa(12,16,-4),!0):!1}
|
|
|
|
|
function Tc(a){return a.N=a.N&63728|a.Ta()|Dd(a)|Cd(a)|Bd(a)}function Uc(a,b){a.Z=b<<12;a.$=~b&4;a.U=b<<14;a.T=b<<16;if((b^a.N)&2048)for(var c=a.Wa.length;0<=--c;){var d=a.u[c];a.u[c]=a.Wa[c];a.Wa[c]=d}a.A=b>>14&3;c=a.N>>14&3;a.A!=c&&(a.Ia[c]=a.u[6],a.u[6]=a.Ia[a.A]);a.N=b;a.K|=2}function Q(a,b){a.K&128||(a.Z=a.$=b,a.U=0)}function Hd(a,b,c){a.K&128||(a.Z=a.$=a.T=b,a.U=c||0)}function Id(a,b,c,d){a.K&128||(a.Z=a.$=a.T=b,a.U=(c^b)&(d^b))}function be(a,b){a.K&128||(a.Z=a.$=a.T=b,a.U=a.Z^a.T>>1)}
|
|
|
|
|
function ce(a,b,c,d){a.K&128||(a.Z=a.$=a.T=b,a.U=(c^d)&(d^b))}k.sa=function(a,b,c){if(!this.M){0>this.wa?this.wa=Tc(this):this.A||(a=4,this.Ha|=4,this.u[6]=4);this.D&57344||(this.fb=63222,this.Kb=a);this.A=0;var d=this.qa(a|this.R),e=this.qa(a+2&65535|this.R);Uc(this,e&-12289|this.wa>>2&12288);de(this,this.wa);de(this,this.u[7]);O(this,d);this.K&=~b;this.wa=-1;this.K|=8;this.Yc=a;this.Xc=c;if(-3!=c)throw a;}};
|
|
|
|
|
function ee(a){var b=fe(a),c=fe(a)&-1793;a.N&49152&&(c=c&-225|a.N&63712);O(a,b);Uc(a,c);a.K&=-17}function Dc(a,b){var c=b>>13&31;31>c&&a.pb&32&&(b=a.Lb[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)"));return b}
|
|
|
|
|
function ge(a,b,c){var d,e,f;if(!(c&a.Ua))return b;d=b>>13;a.pb&a.Uc[a.A]||(d&=7);e=a.V[a.A][d];f=(a.xa[a.A][d]<<6)+(b&8191)&a.Sb;var g=0;switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:128;break;default:g=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.V[a.A][d]=e;if(4194170!==f||a.A)a.Na=a.A,a.Za=d;b=!1;g&&(g&57344&&(0<=a.wa&&(g|=128),a.D&57344||(a.D=a.D|g|a.Na<<5|a.Za<<1),
|
|
|
|
|
b=!0),a.D&61440||!(4191360>f||4194239<f)||(a.D|=4096,a.D&512&&(a.K|=64)),b&&a.sa(168,0,-7));return f}function he(a,b){return a.v.Fb(b)}function ie(a,b,c){b&1&&a.b--;a.v.Xb(b,c&255)}function fe(a){var b=a.qa(a.u[6]|a.R);a.u[6]=a.u[6]+2&65535;return b}function de(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.D&57344||(a.fb=a.fb<<8|246);je(a,0,c);a.Nb(c,b)}function je(a,b,c){!a.A&&c<=a.Wb&&(b||4<c)&&(1145<=a.cb&&c<=a.Wb-32?(a.Ha|=4,a.u[6]=4,a.sa(4,0,-5)):(a.Ha|=8,a.K|=32))}
|
|
|
|
|
function ke(a,b,c,d){var e,f,g=d&8?0:a.R;switch(b){case 0:return a.sa(4,0,-6),0;case 1:return 6==c&&d&4&&je(a,b,a.u[6]),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.qa(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.qa(e)|g;a.b-=8;break;case 6:return e=a.qa(Fd(a,2)),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=a.qa(Fd(a,2)),e=e+
|
|
|
|
|
a.u[c]&65535,e=a.qa(e|a.R)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;!g||a.D&57344||(a.fb=a.fb<<8|f<<3&248|c);6==c&&0>f&&je(a,b,a.u[6]);return e}k.Tb=function(a){if(!this.Ua)return this.v.Tb(a);this.M++;a=he(this,ge(this,a,3));this.M--;return a};k.bb=function(a){if(!this.Ua)return this.v.bb(a);this.M++;a=this.Cc(ge(this,a,2));this.M--;return a};k.qb=function(a,b){this.Ua?(this.M++,ie(this,ge(this,a,5),b),this.M--):this.v.qb(a,b)};
|
|
|
|
|
k.Bb=function(a,b){this.Ua?(this.M++,this.Jc(ge(this,a,4),b),this.M--):this.v.Bb(a,b)};k.Sc=function(a,b,c){return ke(this,a,b,c)};k.Tc=function(a,b,c){return ge(this,ke(this,a,b,c),c)};k.Cc=function(a){return this.v.na(a)};k.Xd=function(a){return this.v.na(ge(this,a,2))};k.Jc=function(a,b){this.v.hb(a,b&65535)};k.Pe=function(a,b){this.v.hb(ge(this,a,4),b)};
|
|
|
|
|
function le(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=ke(a,b,d,2),c&65536||61440!==(a.N&61440)&&(d&=65535),a.A=a.N>>12&3,c=a.qa(d|c&a.R),a.A=a.N>>14&3):c=6!=d||(a.N>>2&12288)===(a.N&12288)?a.u[d]:a.Ia[a.N>>12&3];return c}function me(a,b,c,d){a.D&57344||(a.fb=22);var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=ke(a,b,e,4),c&65536||(e&=65535),a.A=a.N>>12&3,e=ge(a,e|c&65536,4),a.A=a.N>>14&3,a.v.hb(e,d)):6!=e||(a.N>>2&12288)===(a.N&12288)?a.u[e]=d:a.Ia[a.N>>12&3]=d}
|
|
|
|
|
function ne(a,b){b>>=6;var c=a.I=b&7;return(b=a.H=(b&56)>>3)?he(a,a.aa(b,c,3)):a.u[c]&255}function oe(a,b){b>>=6;var c=a.I=b&7;return(b=a.H=(b&56)>>3)?a.v.na(a.aa(b,c,2)):a.u[c]}function pe(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return ke(a,b,c,8)}function qe(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?he(a,a.aa(b,c,3)):a.u[c]&255}function re(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?a.v.na(a.aa(b,c,2)):a.u[c]}
|
|
|
|
|
function R(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.tb=a.aa(b,e,7),ie(a,e,d.call(a,c,he(a,e)))):a.u[e]=a.u[e]&65280|d.call(a,c,a.u[e]&255)}function S(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.aa(b,e,6),a.v.hb(e,d.call(a,c,a.v.na(e)))):a.u[e]=d.call(a,c,a.u[e])}function se(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?ie(a,a.aa(b,e,5),c):a.u[e]=c?a.u[e]&~d|c<<24>>24&d:a.u[e]&~d;return c}function te(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?a.v.hb(a.aa(b,d,4),c):a.u[d]=c&65535;return c}
|
|
|
|
|
function T(a,b,c){c&&(O(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3}
|
|
|
|
|
k.jb=function(a){this.w.complete=!0;var b=this.i&&ue(this.i)?1:this.w.Yb?-1:0,c=a?this.w.Yb?0:1:-1;this.w.Yb=!1;this.ia=this.b=a;do{if(b){if(this.i&&ve(this.i,this.u[7],c)){this.fa();break}c||c++;b++}if(this.K){if(a=this.K&7){a=!1;if(this.K&2){this.K&=-3;var d=160,e=(this.kc&224)>>5,f=this.O&&this.O.yb>e?this.O:null;f&&(d=f.be,e=f.yb);e>(this.N&224)>>5?(this.K&4&&(Fd(this,2),this.K&=-5),this.sa(d,0,-3),e=!0):e=!1;if(e){if(f)if(a=f,f=this.O,f==a)this.O=a.next;else for(;f;){e=f.next;if(e==a){f.next=
|
|
|
|
|
e.next;break}f=e}a=!0}}else this.K&1&&this.K++;a=a&&0>c}if(a)break;if(this.K&112&&Gd(this)&&0>c)break}this.K=this.K&7|this.N&16;this.decode(Ed(this))}while(0<this.b);return this.w.complete?this.ia-this.b:void 0===this.w.complete?0:-1};Za(function(){for(var a=D(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new xd(d);B(d,c)}});function we(a,b){var c=b+a;Id(this,c,a,b);return c&65535}function xe(a,b){var c=b+a;Id(this,c<<8,a<<8,b<<8);return c&255}
|
|
|
|
|
function ye(a,b){a=b<<1;be(this,a);return a&65535}function ze(a,b){a=b<<1;be(this,a<<8);return a&255}function Ae(a,b){a=b&32768|b>>1|b<<16;be(this,a);return a&65535}function Be(a,b){a=b&128|b>>1|b<<8;be(this,a<<8);return a&255}function Ce(a,b){a=b&~a;Q(this,a);return a}function De(a,b){a=b&~a;Q(this,a<<8);return a}function Ee(a,b){a|=b;Q(this,a);return a}function Fe(a,b){a|=b;Q(this,a<<8);return a}function Ge(a,b){a=~b|65536;Hd(this,a);return a&65535}
|
|
|
|
|
function He(a,b){a=~b|256;Hd(this,a<<8);return a&255}function Ie(a,b){a=b-a;this.K&128||(this.Z=this.$=a,this.U=b&(b^a));return a&65535}function Je(a,b){a=b-a;var c=a<<8;b<<=8;this.K&128||(this.Z=this.$=c,this.U=b&(b^c));return a&255}function Ke(a,b){a=b+a;this.K&128||(this.Z=this.$=a,this.U=a&(b^a));return a&65535}function Le(a,b){a=b+a;var c=a<<8;this.K&128||(this.Z=this.$=c,this.U=c&(b<<8^c));return a&255}function Me(a,b){a=-b;Hd(this,a,a&b&32768);return a&65535}
|
|
|
|
|
function Ne(a,b){a=-b;Hd(this,a<<8,(a&b&128)<<8);return a&255}function Oe(a,b){a=b<<1|this.T>>16&1;be(this,a);return a&65535}function Pe(a,b){a=b<<1|this.T>>16&1;be(this,a<<8);return a&255}function Qe(a,b){a=(this.T&65536|b)>>1|b<<16;be(this,a);return a&65535}function Re(a,b){a=((this.T&65536)>>8|b)>>1|b<<8;be(this,a<<8);return a&255}function Se(a,b){var c=b-a;ce(this,c,a,b);return c&65535}function Te(a,b){var c=b-a;ce(this,c<<8,a<<8,b<<8);return c&255}
|
|
|
|
|
function Ue(a,b){this.K&128||(this.Z=this.$=b&65280,this.U=this.T=0);return(b<<8|b>>8)&65535}function Ve(a,b){a^=b;Q(this,a);return a&65535}function We(a){S(this,a,oe(this,a),we);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}
|
|
|
|
|
function Xe(a){var b=re(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.T=this.U=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.T=c<<17-b,c>>=b;else if(b)if(16<b)this.U=c,c=0;else{this.T=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.U=32768)}this.u[a]=c&65535;this.Z=this.$=c;this.b-=(this.g?6:7)+b}
|
|
|
|
|
function Ye(a){var b=re(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.T=this.U=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.T=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.T=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.U=32768)):d=c;this.u[a]=d>>16&65535;this.u[a|1]=d&65535;this.Z=d>>16;this.$=d>>16|d;this.b-=(this.g?6:7)+b}function Ze(a){T(this,a,!Bd(this))}function $e(a){T(this,a,Bd(this))}
|
|
|
|
|
function af(a){S(this,a,oe(this,a),Ce);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}function bf(a){R(this,a,ne(this,a),De);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}function cf(a){S(this,a,oe(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 df(a){R(this,a,ne(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 ef(a){Q(this,oe(this,a)&re(this,a));this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)}function ff(a){Q(this,(ne(this,a)&qe(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 gf(a){T(this,a,Dd(this))}function hf(a){T(this,a,!this.Ta()==!Cd(this))}function jf(a){T(this,a,!Dd(this)&&!this.Ta()==!Cd(this))}function kf(a){T(this,a,!Bd(this)&&!Dd(this))}function lf(a){T(this,a,Dd(this)||!this.Ta()!=!Cd(this))}
|
|
|
|
|
function mf(a){T(this,a,Bd(this)||Dd(this))}function nf(a){T(this,a,!this.Ta()!=!Cd(this))}function of(a){T(this,a,this.Ta())}function pf(a){T(this,a,!Dd(this))}function qf(a){T(this,a,!this.Ta())}function rf(){this.sa(12,0,-1);this.b-=5}function sf(a){T(this,a,!0)}function tf(a){T(this,a,!Cd(this))}function uf(a){T(this,a,Cd(this))}function U(a){a&1&&(this.T=0);a&2&&(this.U=0);a&4&&(this.$=1);a&8&&(this.Z=0);this.b-=5}
|
|
|
|
|
function vf(a){var b=oe(this,a);a=re(this,a);ce(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 wf(a){var b=ne(this,a)<<8;a=qe(this,a)<<8;ce(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 xf(a){var b=re(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.T=this.U=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.u[a]=d&65535,this.u[a|1]=c-d*b&65535,this.$=d>>16|d,this.Z=d>>16):(this.U=32768,this.$=d>>15|d,this.Z=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.$=this.Z=0,this.U=32768,this.T=65536,this.b-=7}function yf(){this.sa(24,0,-1);this.b-=25}
|
|
|
|
|
function zf(){this.N&49152?(this.Ha|=128,this.sa(4,0,-2)):(this.B&&this.B.setData(this.u[0],!0),this.i?Af(this.i):this.fa());this.b-=7}function Bf(){this.sa(16,0,-1);this.b-=25}var Cf=[0,7,7,10,7,11,9,13];function Df(a){this.J=this.b;O(this,pe(this,a));this.b=this.J-Cf[this.g]}var Ef=[0,14,14,17,14,18,16,20];function Ff(a){this.J=this.b;var b=pe(this,a);a=a>>6&7;de(this,this.u[a]);this.u[a]=this.u[7];O(this,b);this.b=this.J-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=oe(this,a);this.J=this.b;Q(this,te(this,a,b));this.b=this.J-Gf[(this.H?8:0)+this.g]+(7!=this.f||this.g?0:2)}function If(a){var b=ne(this,a);Q(this,se(this,a,b,65535)<<8);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}var Jf=[7,13,13,17,14,18,17,21];
|
|
|
|
|
function Kf(a){var b=re(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.K&128||(this.Z=b>>16,this.$=this.Z|b,this.U=0,this.T=-32768>b||32767<b?65536:0);this.b-=23}function Lf(){this.b-=5}function Mf(){this.N&49152||(this.v.reset(),cc(this));this.b-=667}function Nf(){ee(this);this.K|=this.N&16;this.b-=13}
|
|
|
|
|
function Of(a){if(a&8)V.call(this,a);else{var b=fe(this);a&=7;7==a?O(this,b):(O(this,this.u[a]),this.u[a]=b);this.b-=9}}function W(a){a&1&&(this.T=65536);a&2&&(this.U=32768);a&4&&(this.$=0);a&8&&(this.Z=32768);this.b-=5}function Pf(a){var b=(a&448)>>6;if(this.u[b]=this.u[b]-1&65535)O(this,this.u[7]-((a&63)<<1)),this.b+=1;this.b-=6}function Qf(a){S(this,a,oe(this,a),Se);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)}
|
|
|
|
|
function Rf(a){S(this,a,0,Ue);this.b-=this.g?9:3+(7==this.f?2:0)}function Sf(){this.sa(28,0,-1);this.b-=5}function Tf(){this.B&&(this.B.lc(this.u[7],!0),this.B.setData(this.u[0],!0));this.K|=4;Fd(this,-2);this.b-=3}function Uf(a){S(this,a,oe(this,a),Ve);this.b-=this.g?9:3+(7==this.f?2:0)}function V(a){var b;if(b=this.i)b=this.i,F(b,1)?(E(b,"undefined opcode "+J(b,a),!0,!0),b=Af(b)):b=!1;b||this.sa(8,0,-1)}function yd(a){Vf[a>>12].call(this,a)}function Wf(a){Xf[a>>6&3].call(this,a)}
|
|
|
|
|
function Yf(a){Zf[a>>6&3].call(this,a)}function $f(a){ag[a>>6&3].call(this,a)}function bg(a){cg[a&15].call(this,a)}function dg(a){eg[a&15].call(this,a)}function fg(a){gg[a>>6&3].call(this,a)}function hg(a){ig[a>>6&3].call(this,a)}function jg(a){kg[a>>6&3].call(this,a)}
|
|
|
|
|
var Vf=[function(a){lg[a>>8&15].call(this,a)},Hf,vf,ef,af,cf,We,V,function(a){mg[a>>8&15].call(this,a)},If,wf,ff,bf,df,Qf,V],lg=[function(a){ng[a>>4&15].call(this,a)},sf,pf,gf,hf,nf,jf,lf,Ff,Ff,Wf,Yf,$f,V,V,V],Xf=[function(a){Hd(this,te(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Ge);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,Ke);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,Ie);this.b-=this.g?9:3+(7==this.f?2:0)}],Zf=[function(a){S(this,a,0,
|
|
|
|
|
Me);this.b-=this.g?11:6},function(a){S(this,a,Bd(this)?1:0,we);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,Bd(this)?1:0,Se);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=re(this,a);Hd(this,a);this.b-=this.g?4:3+(7==this.f?2:0)}],ag=[function(a){S(this,a,0,Qe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Oe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Ae);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,ye);this.b-=this.g?9:3+(7==this.f?2:0)}],
|
|
|
|
|
ng=[function(a){og[a&15].call(this,a)},V,V,V,Df,Df,Df,Df,Of,V,bg,dg,Rf,Rf,Rf,Rf],og=[zf,Tf,Nf,rf,Bf,Mf,V,V,V,V,V,V,V,V,V,V],cg=[Lf,function(){this.T=0;this.b-=5},function(){this.U=0;this.b-=5},U,function(){this.$=1;this.b-=5},U,U,U,function(){this.Z=0;this.b-=5},U,U,U,U,U,U,U],eg=[Lf,function(){this.T=65536;this.b-=5},function(){this.U=32768;this.b-=5},W,function(){this.$=0;this.b-=5},W,W,W,function(){this.Z=32768;this.b-=5},W,W,W,W,W,W,W],mg=[qf,of,kf,mf,tf,uf,Ze,$e,yf,Sf,fg,hg,jg,V,V,V],gg=[function(a){Hd(this,
|
|
|
|
|
se(this,a,0,255));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,He);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,Le);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,Je);this.b-=this.g?9:3+(7==this.f?2:0)}],ig=[function(a){R(this,a,0,Ne);this.b-=this.g?11:6},function(a){R(this,a,Bd(this)?1:0,xe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,Bd(this)?1:0,Te);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=qe(this,a);Hd(this,a<<8);this.b-=this.g?4:3+
|
|
|
|
|
(7==this.f?2:0)}],kg=[function(a){R(this,a,0,Re);this.b-=this.g?9+(this.tb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,Pe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,Be);this.b-=this.g?9+(this.tb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,ze);this.b-=this.g?9:3+(7==this.f?2:0)}];function zd(a){pg[a>>12].call(this,a)}
|
|
|
|
|
var pg=[function(a){qg[a>>8&15].call(this,a)},Hf,vf,ef,af,cf,We,function(a){rg[a>>8&15].call(this,a)},function(a){sg[a>>8&15].call(this,a)},If,wf,ff,bf,df,Qf,V],qg=[function(a){tg[a>>4&15].call(this,a)},sf,pf,gf,hf,nf,jf,lf,Ff,Ff,Wf,Yf,$f,function(a){ug[a>>6&3].call(this,a)},V,V],ug=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.qa(a|this.R);O(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=le(this,a,0);de(this,a);Q(this,a);this.b-=11},function(a){var b=fe(this);this.J=
|
|
|
|
|
this.b;me(this,a,0,b);Q(this,b);this.b=this.J-Jf[this.g]},function(a){Q(this,te(this,a,this.Ta?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],tg=[function(a){vg[a&15].call(this,a)},V,V,V,Df,Df,Df,Df,Of,function(a){a&8?(this.N&49152||(this.N=this.N&-2017|(a&7)<<5,this.K|=1),this.b-=5):V.call(this,a)},bg,dg,Rf,Rf,Rf,Rf],vg=[zf,Tf,Nf,rf,Bf,Mf,function(){ee(this);this.b-=13},function(){this.sa(8,0,-1)},V,V,V,V,V,V,V,V],rg=[Kf,Kf,xf,xf,Xe,Xe,Ye,Ye,Uf,Uf,V,V,V,V,Pf,Pf],sg=[qf,of,kf,mf,tf,uf,Ze,$e,yf,Sf,
|
|
|
|
|
fg,hg,jg,function(a){wg[a>>6&3].call(this,a)},V,V],wg=[V,function(a){a=le(this,a,65536);de(this,a);Q(this,a);this.b-=11},function(a){var b=fe(this);this.J=this.b;me(this,a,65536,b);Q(this,b);this.b=this.J-Jf[this.g]},V];
|
|
|
|
|
function xg(a){t.call(this,"ROM",a,xg);this.ga=this.g=null;this.A=a.addr;this.f=a.size;this.D=!1;this.B=a.alias;this.C=a.file;this.H=ra(this.C);if(this.C){a=this.C;var b=sa(this.H);"json"!=b&&"hex"!=b&&(a=Fa()+"/api/v1/dump?file="+this.C+"&format=bytes&decimal=true");var c=this;Da(a,null,!0,function(a,b,f){f?(c.P("Unable to load ROM resource (error "+f+": "+a+")"),c.C=null):(qb(c.Qa,a,b),(a=Ea(a,b))?(c.g=a.da,c.ga=a.ga):c.C=null);yg(c)})}}z(xg);k=xg.prototype;
|
|
|
|
|
k.Ea=function(a,b,c,d){this.v=b;this.b=c;this.i=d;yg(this)};k.Ga=function(){this.ga&&(this.i&&Sg(this.i,this.id,this.A,this.f,this.ga),delete this.ga);return!0};k.Fa=function(){return!0};
|
|
|
|
|
function yg(a){if(!wb(a)){if(a.C){if(!a.g||!a.v)return;a.f||(a.f=a.g.length);if(a.g.length!=a.f)yb(a,"ROM size ("+p(a.g.length,8,!0)+") does not match specified size ("+p(a.f,8,!0)+")");else{var b;a:{b=a.A;a.status(a.f+"-byte ROM at "+qa(b));if(57344<=b&&b<57344+oc){var c={};b=(c[b]=[xg.prototype.Ld,xg.prototype.De,null,null,null,a.f>>1],c);if(Hb(a.v,a,b,256,a.Ya)){b=a.D=!0;break a}}else if(yc(a.v,b,a.f,ad)){for(c=0;c<a.g.length;c++)a.v.qb(b+c,a.g[c]);b=!0;break a}b=!1}if(b){b=[];"number"==typeof a.B?
|
|
|
|
|
b.push(a.B):null!=a.B&&a.B.length&&(b=a.B);for(c=0;c<b.length;c++){var d=a,e=b[c],f=xc(d.v,d.A,d.f);wc(d.v,e,d.f,f)}a.D||delete a.g}}}H(a)}}k.Ld=function(a){return this.g[a-this.A]};k.De=function(){};Za(function(){for(var a=D(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new xg(d);B(d,c)}});
|
|
|
|
|
function Tg(a){t.call(this,"RAM",a,Tg);this.ga=this.g=null;this.C=a.addr;this.A=a.size;this.Ka=a.load;this.Ja=a.exec;this.B=!1;this.f=a.file;this.D=ra(this.f);if(this.f){a=this.f;var b=sa(this.D);"json"!=b&&"hex"!=b&&(a=Fa()+"/api/v1/dump?file="+this.f+"&format=bytes&decimal=true");var c=this;Da(a,null,!0,function(a,b,f){f?(c.P("Unable to load RAM resource (error "+f+": "+a+")"),c.f=null):(qb(c.Qa,a,b),(a=Ea(a,b))?(c.g=a.da,c.ga=a.ga,null==c.Ka&&(c.Ka=a.Ka),null==c.Ja&&(c.Ja=a.Ja)):c.f=null);Ug(c)})}}
|
|
|
|
|
z(Tg);Tg.prototype.Ea=function(a,b,c,d){this.v=b;this.b=c;this.i=d;Ug(this)};Tg.prototype.Ga=function(){this.ga&&(this.i&&Sg(this.i,this.id,this.C,this.A,this.ga),delete this.ga);return!0};Tg.prototype.Fa=function(){return!0};function Ug(a){if(a.v&&(!a.B&&a.A&&yc(a.v,a.C,a.A,Bc)&&(a.B=!0),!wb(a))){if(!a.B)q("No RAM allocated");else if(a.f){if(!a.g||!a.v)return;Vg(a,a.g,a.Ka,a.Ja,a.C)}H(a)}}
|
|
|
|
|
Tg.prototype.reset=function(){if(this.B){for(var a=this.v,b=this.C,c=this.A,d=b&a.v,b=b>>>a.ja;0<c&&b<a.Y.length;){var e=a.Y[b];if(e.controller&&a.g&&a.g.length==a.B.length){var f=a.g.indexOf(e);0<=f&&(e=a.B[f])}if(e){var f=c,g=0,h,d=d||0,g=g&255;void 0===f&&(f=e.size);if(zb&&e.G)for(h=d;f--&&h<e.G.length;h++)e.G[h]=g;else for(h=d;f--&&h<e.size;h++)e.$b(d,g,e.F+d)}c-=a.ya;b++;d=0}this.g&&Vg(this,this.g,this.Ka,this.Ja,this.C,!0)}};
|
|
|
|
|
function Vg(a,b,c,d,e,f){var g=!1;if(null==c)for(var h=0;h<b.length-1;){var l=b[h]&255|(b[h+1]&255)<<8;if(l)if(l&255){if(1!=l)break;if(h+6>=b.length)break;for(var h=h+2,m=b[h++]&255|(b[h++]&255)<<8,n=b[h++]&255|(b[h++]&255)<<8,l=l+((m&255)+(m>>8)+(n&255)+(n>>8)),v=h,r=m-=6;0<m&&h<b.length;)l+=b[h++]&255,m--;if(m||h>=b.length)break;l+=b[h++]&255;if(l&255)break;if(r)for(E(a,"loading "+p(r,4,!0)+" bytes at "+p(n,4,!0)+"-"+p(n+r-1,4,!0),1048576);r--;)a.b.qb(n++,b[v++]&255);else n&1?a.b.fa():null==d&&
|
|
|
|
|
(d=n),null!=d&&E(a,"starting address: "+p(d,4,!0),1048576);g=!0}else h++;else h+=2}if(!g&&(null==c&&(c=e),null!=c)){for(g=0;g<b.length;g++)a.b.qb(c+g,b[g]);g=!0}g&&null!=d&&(a=a.b,a.Ob=d,O(a,d),!f&&a.i&&(a.fa()||qd(a.i)));return g}Za(function(){for(var a=D(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Tg(d);B(d,c)}});function Wg(a){t.call(this,"Keyboard",a,Wg,65536);H(this)}z(Wg);Wg.prototype.ra=function(){return!1};
|
|
|
|
|
Wg.prototype.Ea=function(a,b,c,d){this.C=a;this.b=c;this.i=d};Za(function(){for(var a=D(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Wg(d);B(d,c)}});
|
|
|
|
|
function X(a){this.M=a.baudReceive||9600;this.ca=a.baudTransmit||9600;this.ba=a.upperCase;this.B=this.D=null;this.R=a.tabSize;this.O=a.charBOL;this.H=0;t.call(this,"SerialPort",a,X,8388608);var b=a.binding;if("console"==b)this.D="";else{var c;a=Xg;b&&(void 0===c&&(c="Panel"),(c=tb(c,this.id))&&(b=c.G[b])&&this.ra(null,a,b))}this.I=this.L=null;this.exports={connect:this.yc,receiveData:this.jc}}z(X);var Xg="buffer";k=X.prototype;
|
|
|
|
|
k.ra=function(a,b,c){var d=this;switch(b){case Xg:return this.G[b]=this.B=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.jc(b);return!0},c.onkeypress=function(a){a=a||window.event;d.jc(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
|
|
|
|
|
k.Ea=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.i=d;var e=this;this.ka=Qc(48,4);this.S=Nc(this.b,function(){e.f&128||!e.A.length||(e.J=e.A.shift()&255,e.ba&&97<=e.J&&122>e.J&&(e.J-=32),e.f|=128,e.f&64&&Oc(e.b,e.ka))});this.X=Qc(52,4);this.ia=Nc(this.b,function(){e.g|=128;e.g&64&&Oc(e.b,e.X)});Hb(b,this,Yg);H(this)};
|
|
|
|
|
k.yc=function(){if(!this.I){var a=nd(this.C,"connection");if(a){var b=a.split("->");if(2==b.length){var c=xa(b[0]);if(c!=this.Ya)return;b=xa(b[1]);if(this.I=sb(b)){var d=this.I.exports;if(d){var e=d.connect;e&&e.call(this.I);if(this.L=d.receiveData){this.status(this.Qa+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};k.Ga=function(a,b){if(!b)if(this.yc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
|
|
|
|
|
k.Fa=function(a){return a?this.save():!0};k.reset=function(){Zg(this)};k.save=function(){var a=new N(this);a.set(0,[]);return a.data()};k.restore=function(){return Zg(this)};function Zg(a){a.J=0;a.f=0;a.g=128;a.A=[];return!0}k.jc=function(a){if("number"==typeof a)this.A.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.A.push(a.charCodeAt(b));else this.A=this.A.concat(a);Pc(this.b,this.S,1E3/Math.round(this.M/10));return!0};k.Fd=function(){return this.f&65534};
|
|
|
|
|
k.xe=function(a){this.f=this.f&-112|a&111};k.Ed=function(){this.f&=-129;0<this.A.length&&Pc(this.b,this.S,1E3/Math.round(this.M/10));return this.J};k.we=function(){};k.Zd=function(){return this.g};k.Re=function(a){this.g&128&&a&64&&Oc(this.b,this.X);this.g=this.g&-70|a&69};k.Yd=function(){return 0};
|
|
|
|
|
k.Qe=function(a){if(a&=255){E(this,"transmitByte("+p(a,2,!0)+")");this.L&&this.L.call(this.I,a);if(this.B)if(13==a)this.H=0;else if(8==a)this.B.value=this.B.value.slice(0,-1),0<this.H&&this.H--;else{var b;b=(b=ya[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.R||8,c=a-this.H%a,this.R&&(b=wa("",c)));this.O&&!this.H&&c&&(b=String.fromCharCode(this.O)+b);this.B.value+=b;this.B.scrollTop=this.B.scrollHeight;this.H+=c}else if(null!=this.D){if(10==a||1024<=this.D.length)this.j(this.D),
|
|
|
|
|
this.D="";10!=a&&(this.D+=String.fromCharCode(a))}this.g&=-129;Pc(this.b,this.ia,1E3/Math.round(this.ca/10))}};var $g={},Yg=($g[65392]=[null,null,X.prototype.Fd,X.prototype.xe,"RCSR"],$g[65394]=[null,null,X.prototype.Ed,X.prototype.we,"RBUF"],$g[65396]=[null,null,X.prototype.Zd,X.prototype.Re,"XCSR"],$g[65398]=[null,null,X.prototype.Yd,X.prototype.Qe,"XBUF"],$g);Za(function(){for(var a=D(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new X(d);B(d,c)}});
|
|
|
|
|
function Vc(a){t.call(this,"PC11",a,Vc);this.g=a.autoMount||null;this.D=0;this.ba=a.baudReceive||3600;this.J=this.L=this.f=0;this.I=[];this.H=ah;this.B=bh;this.M=this.A="";this.da=this.Ka=this.Ja=null;this.R=-1;this.O=!Ra("Mobi")&&window&&"FileReader"in window}z(Vc);var ah="",bh=0;k=Vc.prototype;
|
|
|
|
|
k.ra=function(a,b,c){var d=this,e=bh;switch(b){case "listTapes":return this.G[b]=c,c.onchange=function(){var a=d.G.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(l){q("PC11 option error: "+l.message)}b=e.desc;void 0===b&&(b="");e=e.href;void 0!==e&&(b='<a href="'+e+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descTape":return this.G[b]=c,!0;case "loadTape":e=2;case "attachTape":return e||(e=1),this.G[b]=c,c.onclick=
|
|
|
|
|
function(){var a=d.G.listTapes;a&&ch(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.O){c.parentNode.removeChild(c);break}this.G[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;ch(d,ra(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.G[b]=c,!0}return!1};
|
|
|
|
|
k.Ea=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.i=d;this.S=dh(a);var e=this;if((this.g=nd(this.C,"autoMount")||this.g)&&"string"==typeof this.g)try{this.g=eval("("+this.g+")")}catch(f){q("PC11 auto-mount error: "+f.message+" ("+this.g+")"),this.g=null}this.X=Qc(56,4);this.ca=Nc(this.b,function(){1==(e.f&32769)&&!(e.f&128)&&e.J<e.I.length&&(e.L=e.I[e.J++]&255,eh(e,e.J/e.I.length*100),e.f|=128,e.f&=-2049,e.f&64&&Oc(e.b,e.X))});Hb(b,this,fh);gh(this,"None",ah,!0);this.O&&gh(this,"Local Tape",
|
|
|
|
|
"?");gh(this,"Remote Tape","??");hh(this)||H(this)};k.Ga=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};k.Fa=function(a){return a?this.save():!0};k.reset=function(){this.f&=-2241;this.L=0};function hh(a){a.D=0;if(a.g){var b=a.g.path||"",c;if(!(c=a.g.name))a:{if((c=a.G.listTapes)&&c.options)for(var d=0;d<c.options.length;d++){var e=c.options[d];if(e.value==b){c=e.text;break a}}c=ra(b,!0)}b&&c?ih(a,c,b,1,!0):jh(a)}return!!a.D}
|
|
|
|
|
function ch(a,b,c,d,e){if(c)if("?"==c)a.P('Use "Choose File" and "Mount" to select and load a local tape.');else{if("??"==c){c=window.prompt("Enter the URL of a remote tape image.","")||"";if(!c)return;b=ra(c);a.status("Attempting to load "+c+' as "'+b+'"');a.H="??"}else a.H=c;ih(a,b,c,d,!1,e)}else kh(a,!1)}
|
|
|
|
|
function ih(a,b,c,d,e,f){var g=-1;if(a.A.toLowerCase()!=c.toLowerCase()||a.B!=d)g++,kh(a,!0),a.w.ab?a.P("PC11 busy"):(e&&(a.D++,F(a)&&E(a,"auto-loading tape: "+b)),lh(a,b,c,d,f)?g++:a.w.ab=!0);g&&mh(a,a.M,a.A,a.B,a.da,a.Ka,a.Ja)}
|
|
|
|
|
function lh(a,b,c,d,e){var f=c;if(e){var g=new FileReader;g.onload=function(){var e=g.result;e&&(e=new Uint8Array(e,0,e.byteLength),mh(a,b,c,d,e),a.H="?");jh(a)};g.readAsArrayBuffer(e);return!0}0>c.indexOf("/api/v1/dump")&&(e=sa(c),f="json"==e||"gz"==e?encodeURI(c):Fa()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!Da(f,null,!0,function(e,f,g){var h=0>g&&a.C&&!a.C.w.ha;g?a.P('Unable to load tape "'+b+'" (error '+g+": "+e+")",h):(qb(a.Qa,e,f),(e=Ea(e,f))&&mh(a,b,c,d,e.da,e.Ka,
|
|
|
|
|
e.Ja));a.w.ab=!1;a.D&&(a.D--,a.D||H(a));jh(a)})}function gh(a,b,c,d){if((a=a.G.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 jh(a){var b=a.G.listTapes;if(b&&b.options){a=a.H||a.A;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 eh(a,b){b|=0;if(b!==a.R){var c=a.G.readProgress;c&&(c=(c=D(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.R=b}}
|
|
|
|
|
function mh(a,b,c,d,e,f,g){a.M=b;a.A=c;a.B=d;a.da=e;a.Ka=f;a.Ja=g;2==d?a.S&&Vg(a.S,e,f,g)?a.status("tape loaded: "+b):(a.M="",a.A="",a.H=ah,a.B=bh,a.P("No load address available for tape: "+b)):(a.J=0,a.I=e,a.status("tape attached: "+b),eh(a,0))}function kh(a,b){if(a.A||!1===b)a.M="",a.A="",b||(a.B&&a.status(1==a.B?"tape detached":"tape unloaded"),a.H=ah,a.B=bh,jh(a))}k.save=function(){return(new N(this)).data()};k.restore=function(){return!0};k.yd=function(){return this.f&65534};
|
|
|
|
|
k.qe=function(a){a&1&&(this.f&32768?(a&=-2,this.f&64&&Oc(this.b,this.X)):(this.f&=-129,this.f|=2048,this.L=0,Pc(this.b,this.ca,1E3/Math.round(this.ba/10))));this.f=this.f&-66|a&65};k.xd=function(){this.f&=-129;this.f|=2048;return this.L};k.pe=function(){};var nh={},fh=(nh[65384]=[null,null,Vc.prototype.yd,Vc.prototype.qe,"PRS"],nh[65386]=[null,null,Vc.prototype.xd,Vc.prototype.pe,"PRB"],nh);
|
|
|
|
|
function oh(a,b,c){t.call(this,"Disk",{id:a.Qa+".disk"+p(++ph,4)},oh,4194304);this.controller=a;this.C=a.C;this.i=a.i;this.B=b;this.Xa=b.name;this.fc=b.fc;qh(this,c,b.ua,b.za,b.pa,b.La);H(this)}var ph=0;z(oh);k=oh.prototype;k.Ea=function(a,b,c,d){this.i=d};
|
|
|
|
|
function qh(a,b,c,d,e,f){a.mode=b;a.ua=c;a.za=d;a.pa=e;a.La=f;a.b=[];if("preload"!=a.mode){b=Array(a.ua);for(c=0;c<b.length;c++){d=Array(a.za);for(e=0;e<d.length;e++){f=Array(a.pa);for(var g=1;g<=f.length;g++)f[g-1]=rh(null,c,e,g,a.La,0);d[e]=f}b[c]=d}a.b=b}a.f=null}
|
|
|
|
|
function sh(a,b,c,d,e){var f=c;if(a.v)return!0;a.Xa=b;a.gb=c;a.Gc=ra(c);a.v=e;a.A=a.controller;if(d){var g=new FileReader;g.onload=function(){var b=g.result,c,d=b?b.byteLength:0,e=ka[d];if(e){a.ua=e[0];a.za=e[1];a.pa=e[2];a.La=e[3]||512;c=a.La>>2;var f=e=0,b=new DataView(b,0,d);a.b=Array(a.ua);for(d=0;d<a.b.length;d++)for(var r=a.b[d]=Array(a.za),w=0;w<r.length;w++)for(var y=r[w]=Array(a.pa),x=0;x<y.length;x++){for(var C=rh(null,d,w,x+1,a.La,0),ia=C.data,Ja=0;Ja<c;Ja++,f+=4)var P=ia[Ja]=b.getInt32(f,
|
|
|
|
|
!0),e=e+P&-1;C.Ba=c;y[x]=C}a.f=e;c=a}else a.P("Unrecognized disk format ("+d+" bytes)");a.v&&(a.v.call(a.controller,a.B,c,a.Xa,a.gb),a.v=null)};g.readAsArrayBuffer(d);return!0}0>c.indexOf("/api/v1/dump")&&(b=sa(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):ta(c,"/")&&(d="dir"),f=Fa()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.fc?"":e)+"&format=json"));return!!Da(f,
|
|
|
|
|
null,!0,function(b,c,d){th(a,b,c,d)})}
|
|
|
|
|
function th(a,b,c,d){var e=null;a.g=!1;var f=0>d&&a.C&&!a.C.w.ha;if(d)a.controller.P('Unable to load disk "'+a.Xa+'" (error '+d+": "+b+")",f);else{qb(a.controller.Qa,b,c);try{if(0<ra(a.Gc,!0).toLowerCase().indexOf("-readonly"))a.g=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.g=!0)}var h;"<"==c.substr(0,1)?h=["Missing disk image: "+a.Xa]:h=0>c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+
|
|
|
|
|
c+")");if(h.length)if(1==h.length)q(h[0]);else{a.ua=h.length;a.za=h[0].length;a.pa=h[0][0].length;var l=h[0][0][0];a.La=l&&l.length||512;for(d=c=0;d<a.ua;d++)for(f=0;f<a.za;f++)for(g=0;g<a.pa;g++)if(l=h[d][f][g]){var m=l.length;void 0===m&&(m=l.length=512);var m=m>>2,n=l.pattern;void 0===n&&(n=l.pattern=0);var v=l.data;if(void 0===v){var r=l.bytes;if(void 0!==r&&r.length){for(var w=m<<2,y=r.length;y<w;y++)r[y]=n;uh(l,r)}else v=[],n=l.pattern=n|n<<8|n<<16|n<<24,l.data=v;delete l.bytes}rh(l,d,f);for(w=
|
|
|
|
|
0;w<v.length;w++)c=c+v[w]&-1}a.b=h;a.f=c;e=a}else q("Empty disk image: "+a.Xa)}catch(x){q("Disk image error ("+b+"): "+x.message)}}a.v&&(a.v.call(a.A,a.B,e,a.Xa,a.gb),a.v=null)}function rh(a,b,c,d,e,f){a||(a={sector:d,length:e,data:[],pattern:f});a.Ue=b;a.Ve=c;a.Pa=a.Ba=0;a.Sa=!1;return a}
|
|
|
|
|
k.seek=function(a,b,c,d,e){d=null;var f=this.B,g=this.b[a];if(g){var h=g[b];if(!h&&f.Mc&&b<f.za)for(h=g[b]=Array(f.Nc),g=0;g<h.length;g++)h[g]=rh(null,a,b,g+1,f.Ac,0);if(h){for(g=0;g<h.length;g++)if(h[g]&&h[g].sector==c){d=h[g];break}!d&&f.Mc&&9==f.pc&&(d=h[g]=rh(null,a,b,f.pc,f.Ac,0))}}e&&e(d,!1);return d};function uh(a,b){for(var c=0,d=a.length>>2,e=Array(d),f=0;f<d;f++)e[f]=b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24,c+=4;a.data=e}
|
|
|
|
|
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(zb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.D.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(zb)for(b=0;b<a.length;b++)this.D.setInt32(b<<2,a[b],!0);else this.b=a;return this.Sa=!0}return!1},mb:function(a,b){b?this.C++||fd(this,gd,!1):this.g++||hd(this,gd,!1)},J:function(a,b){this.i&&F(this.i,128)&&E(this.i,
|
|
|
|
|
"attempt to read invalid address "+J(this.i,b),!0);this.v.Da(b,32,2);return 255},B:function(a,b,c){this.i&&F(this.i,128)&&E(this.i,"attempt to write "+J(this.i,b)+" to invalid addresses "+J(this.i,c),!0);this.v.Da(c,32,4)},L:function(a,b){return this.Vb(a++,b++)|this.Vb(a,b)<<8},H:function(a,b,c){this.Yb(a++,b&255,c++);this.Yb(a,b>>8,c)},S:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ca:function(a,b){a&1&&this.v.Da(b,64,2);b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+
|
|
|
|
|
1]&255)<<8},Ya:function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<<a)|b<<a;this.Sa=!0},Ja:function(a,b,c){a&1&&this.v.Da(c,64,4);c=a>>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<<a)|b<<a:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>8);this.Sa=!0},O:function(a,b){if(this.i&&null!=this.F){var c=this.i;id(c,this.F+a,1,c.M)&&c.fa(!0)}return this.gc(a,b)},$:function(a,b){if(this.i&&null!=this.F){var c=this.i;id(c,this.F+a,2,c.M)&&c.fa(!0)}return this.hc(a,b)},ka:function(a,
|
|
|
|
|
b,c){if(this.i&&null!=this.F){var d=this.i;id(d,this.F+a,1,d.D)&&d.fa(!0)}this.f?this.B(a,b,c):this.Zb(a,b,c)},wa:function(a,b,c){if(this.i&&null!=this.F){var d=this.i;id(d,this.F+a,2,d.D)&&d.fa(!0)}this.f?this.B(a,b,c):this.mc(a,b,c)},M:function(a){return this.G[a]},R:function(a,b){a=this.G[a];this.i&&F(this.i,128)&&E(this.i,"Memory.readByte("+J(this.i,b)+"): "+J(this.i,a),!0);return a},X:function(a,b){a&1&&this.v.Da(b,64,2);return this.D.getUint16(a,!0)},Qa:function(a,b){a&1&&this.v.Da(b,64,2);
|
|
|
|
|
a=this.I[a>>1];this.i&&F(this.i,128)&&E(this.i,"Memory.readWord("+J(this.i,b)+"): "+J(this.i,a),!0);return a},ia:function(a,b){this.G[a]=b;this.Sa=!0},pa:function(a,b,c){this.G[a]=b;this.Sa=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0)},va:function(a,b,c){a&1&&this.v.Da(c,64,4);this.D.setUint16(a,b,!0);this.Sa=!0},xa:function(a,b,c){a&1&&this.v.Da(c,64,4);this.I[a>>1]=b;this.Sa=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeWord("+J(this.i,c)+","+J(this.i,
|
|
|
|
|
b)+")",!0)}};function tc(a,b,c){a.i=b;a.g=a.C=0;c&&((a.g=c.g)&&hd(a,gd,!1),(a.C=c.C)&&fd(a,gd,!1))}function jd(a,b){b?--a.C||(a.Yb=a.f?a.B:a.Zb,a.Ob=a.f?a.H:a.mc):--a.g||(a.Vb=a.gc,a.ra=a.hc)}function fd(a,b,c){c&&a.C||(a.Yb=!a.f&&b[1]||a.B,a.Ob=!a.f&&b[3]||a.H);if(c||void 0===c)a.Zb=b[1]||a.B,a.mc=b[3]||a.H}function hd(a,b,c){c&&a.g||(a.Vb=b[0]||a.J,a.ra=b[2]||a.L);if(c||void 0===c)a.gc=b[0]||a.J,a.hc=b[2]||a.L}function bd(a,b){b||(b=kd);hd(a,b,void 0);fd(a,b,void 0)}
|
|
|
|
|
var kd=[],ed=[I.prototype.S,I.prototype.Ya,I.prototype.ca,I.prototype.Ja],gd=[I.prototype.O,I.prototype.ka,I.prototype.$,I.prototype.wa];if(zb)var dd=[I.prototype.M,I.prototype.ia,I.prototype.X,I.prototype.va],cd=[I.prototype.R,I.prototype.pa,I.prototype.Qa,I.prototype.xa];
|
|
|
|
|
function ld(a,b){t.call(this,"CPU",a,ld,1);var c=a.multiplier||1;this.lb=a.cycles||b;this.eb=c;this.Eb=Math.round(this.lb/1E4)/100;this.ob=this.Eb*this.eb;this.w.W=!1;this.w.Xb=!1;this.w.sb=a.autoStart;this.w.ub=!1;this.Jb=this.va=0;this.Kb=a.csStart;this.vb=a.csInterval;this.wb=a.csStop;this.L=[];this.zc=this.be.bind(this);H(this)}z(ld);var md=["power","reset"];k=ld.prototype;
|
|
|
|
|
k.Ea=function(a,b,c,d){this.C=a;this.v=b;this.i=d;this.B=a.B;for(b=0;b<md.length;b++)(c=this.G[md[b]])&&this.C.sa(null,md[b],c);a=nd(a,"autoStart");null!=a&&(this.w.sb="true"==a?!0:"false"==a?!1:!!a);H(this)};k.reset=function(){};k.save=function(){return null};k.restore=function(){return!1};
|
|
|
|
|
k.Ga=function(a,b){if(!b){if(a&&this.restore){od(this);if(!this.restore(a))return!1;pd(this)}else this.reset();this.i?(a=this.i,b=this.w.sb,a.jb=!0,a.j("Type ? for help with PDPjs Debugger commands"),qd(a),b||a.rb(),a.Za&&(b=a.Za,a.Za=null,rd(a,b))):this.j("No debugger detected")}return!0};k.Fa=function(a){return a?this.save():!0};k.sb=function(){return this.w.sb||!this.i&&void 0===this.G.run?(this.hb(),!0):!1};k.tc=function(){return 0};
|
|
|
|
|
function pd(a){void 0===a.Kb&&(a.Kb=0);void 0===a.vb&&(a.vb=-1);void 0===a.wb&&(a.wb=-1);a.w.ub=0<=a.Kb&&0<a.vb;a.w.ub&&(a.Jb=0,a.va=a.Kb-a.pa)}function fc(a,b){if(a.w.ub){var c=!1;a.Jb=a.Jb+a.tc()|0;a.va-=b;0>=a.va&&(a.va+=a.vb,c=!0);0<=a.wb&&a.wb<=sd(a)&&(a.vb=a.wb=-1,pd(a),a.fa(),c=!0);c&&a.j(sd(a)+" cycles: checksum="+p(a.Jb))}}
|
|
|
|
|
k.sa=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.G[b]=c,!0;case "run":return this.G[b]=c,c.onclick=function(){var a;if(a=d.C)if(a=d.C,a.w.ha)a=!0;else{var b=null,c,h=rb(a.id);for(c=0;c<h.length&&(b=h[c],b===a||b.w.ready);c++);if(c==h.length)for(c=0;c<h.length&&(b=h[c],b===a||b.w.ha);c++);c==h.length&&(b=a);q("The "+b.type+" component ("+b.id+") is not "+(b.w.ready?"powered yet":"ready yet"+(b.Sb?" (waiting for notification)":""))+".");a=!1}a&&(d.w.W?d.fa():d.hb())},
|
|
|
|
|
!0;case "speed":return this.G[b]=c,!0;case "setSpeed":return this.G[b]=c,c.onclick=function(){td(d,d.eb<<1,!0)},c.textContent=this.ob.toFixed(2)+"Mhz",!0}return!1};k.oa=function(a){this.C&&this.C.oa(a)};function ec(a,b,c){a.pa+=b;c&&(a.ka=a.b=a.I=0)}function ud(a,b){var c=1;b&&1<a.eb&&a.ca&&(c=a.ca/a.Eb);a.wc=Math.round(1E3/30);a.nb=Math.floor(a.lb/30*c);b||(a.wa=a.nb);a.Fb=0}function sd(a){return a.pa+a.$+a.ka-a.b}function od(a){a.ca=0;a.yc=0;a.pa=a.$=a.ka=a.b=a.I=0;pd(a);td(a,1)}
|
|
|
|
|
function td(a,b,c){var d=!1;if(void 0!==b){.8>a.ca/a.ob?b=1:d=!0;a.eb=b;b=a.Eb*a.eb;if(a.ob!=b){a.ob=b;b=a.ob.toFixed(2)+"Mhz";var e=a.G.setSpeed;e&&(e.textContent=b);a.j("target speed: "+b)}c&&a.C&&a.C.rb()}ec(a,a.$);a.$=0;a.X=Aa();a.ia=0;ud(a);return d}function Nc(a,b){var c=a.L.length;a.L.push([-1,b]);return c}function Pc(a,b,c,d){0<=b&&b<a.L.length&&(d||0>a.L[b][0])&&(c=a.lb*a.eb/1E3*c|0,a.w.W&&(c+=vd(a)),a.L[b][0]=c)}
|
|
|
|
|
function wd(a,b){for(var c=a.L.length-1;0<=c;c--){var d=a.L[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function dc(a,b){for(var c=a.L.length-1;0<=c;c--){var d=a.L[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function vd(a,b){var c=a.ka-=a.b;a.b=a.I=0;b&&(a.ka=0);return c}
|
|
|
|
|
k.be=function(){if(this.w.W){this.Fb>=this.lb&&ud(this,!0);this.Ja=0;this.jb=Aa();if(this.ia){var a=this.jb-this.ia;a>this.wc&&(this.X+=a,this.X>this.jb&&(this.X=this.jb))}try{do{var b=wd(this,this.w.ub?1:this.nb);try{this.ib(b)}catch(e){if("number"!=typeof e)throw e;}b=vd(this,!0);this.Ja+=b;this.$+=b;fc(this,b);dc(this,b);this.wa-=b;if(0>=this.wa){this.wa+=this.nb;15<=++this.yc&&(this.oa(),this.yc=0);break}}while(this.w.W)}catch(e){this.fa();this.C&&this.C.stop(Aa(),sd(this));yb(this,e.stack||e.message);
|
|
|
|
|
return}if(this.w.W){a=setTimeout;b=this.zc;this.ia=Aa();var c=this.wc;this.Ja&&(c=Math.round(c*this.Ja/this.nb));var c=c-(this.ia-this.jb),d=this.ia-this.X;d&&(this.ca=Math.round(this.$/(10*d))/100,864E5<=d&&(this.pa=0,td(this)));if(0>c||this.ca<this.ob)-1E3>c&&(this.X-=c),c=0;this.Fb+=this.Ja;this.ia+=c;a(b,c)}}};
|
|
|
|
|
k.hb=function(a){if(xb(this))return!1;if(this.w.W)return this.j(this.toString()+" busy"),!1;td(this);this.w.W=!0;this.w.Xb=!0;var b=this.G.run;b&&(b.textContent="Halt");this.C&&(a&&this.C.rb(!0),this.C.start(this.X,sd(this)));setTimeout(this.zc,0);return!0};k.ib=function(){return 0};k.fa=function(a){var b=!1;if(this.w.W){vd(this);ec(this,this.$);this.$=0;this.w.W=!1;if(b=this.G.run)b.textContent="Run";this.C&&this.C.stop(Aa(),sd(this));b=!0}this.w.complete=a;return b};
|
|
|
|
|
function xd(a){this.cb=+a.model||1170;this.Rb=a.addrReset||0;ld.call(this,a,6666667);this.decode=1120==this.cb?yd.bind(this):zd.bind(this);Ad(this);this.M=0;this.O=null;this.w.complete=!1}z(xd,ld);k=xd.prototype;k.reset=function(){this.status("model "+this.cb);this.w.W&&this.fa();Ad(this);od(this);this.w.error=!1;this.parent.reset.call(this)};
|
|
|
|
|
function Ad(a){a.T=65536;a.U=32768;a.aa=65535;a.Z=32768;a.N=15;a.u=[0,0,0,0,0,0,0,a.Rb];a.Wa=[0,0,0,0,0,0];a.Ia=[0,0,0,0];a.A=0;a.kb=0;a.Xc=[4,2,0,1];a.V=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.ya=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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.Mb=[0,0,0,0,0,0,0,0,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.K=0;a.D=a.H=0;a.g=a.f=a.tb=0;a.xa=-1;cc(a)}function cc(a){a.Wb=255;a.Ha=0;a.jc=0;a.J=0;a.Ac=0;a.Bc=0;a.pb=0;a.Ua=0;a.Za=0;a.Ub=262143;a.S=0;a.Hb=0;a.O=null;a.v&&Sc(a)}function Sc(a){a.Ua?(a.R=65536,a.ba=a.Vc,a.ra=a.Zd,a.Ob=a.Re,vc(a.v,a.pb&16?22:18)):(a.R=0,a.ba=a.Uc,a.ra=a.Ec,a.Ob=a.Lc,vc(a.v,16))}k.tc=function(){return 0};k.save=function(){var a=new N(this);a.set(0,[]);a.set(1,[this.pa,this.eb]);a.set(2,Ec(this.v));return a.data()};
|
|
|
|
|
k.restore=function(a){var b=a[1];this.pa=b[1];td(this,b[3]);a:{b=this.v;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),h=0;h<e.length-1;)for(var l=e[h++],m=e[h++];l--;)g[f++]=m;e=g}f=b.Y[d];if(!f||!f.restore(e)){q("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function Bd(a){return a.T&65536?1:0}function Cd(a){return a.U&32768?2:0}function Dd(a){return a.aa&65535?0:4}k.Ta=function(){return this.Z&32768?8:0};
|
|
|
|
|
function Ed(a){var b=a.u[7];a.S=0;a.Hb=b;var c=a.ra(b);a.u[7]=b+2&65535;return c}function Fd(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 Qc(a,b){return{de:a,xb:b,next:null}}function Oc(a,b){if(b!=a.O){var c=a.O;if(!c||c.xb<=b.xb)b.next=c,a.O=b;else{do{var d=c.next;if(!d||d.xb<=b.xb){b.next=d;c.next=b;break}c=d}while(c)}}a.K|=2}function Gd(a){return a.K&64?(a.ta(168,64,-1),!0):a.K&32?(a.ta(4,32,-5),!0):a.K&16?(a.ta(12,16,-4),!0):!1}
|
|
|
|
|
function Tc(a){return a.N=a.N&63728|a.Ta()|Dd(a)|Cd(a)|Bd(a)}function Uc(a,b){a.Z=b<<12;a.aa=~b&4;a.U=b<<14;a.T=b<<16;if((b^a.N)&2048)for(var c=a.Wa.length;0<=--c;){var d=a.u[c];a.u[c]=a.Wa[c];a.Wa[c]=d}a.A=b>>14&3;c=a.N>>14&3;a.A!=c&&(a.Ia[c]=a.u[6],a.u[6]=a.Ia[a.A]);a.N=b;a.K|=2}function Q(a,b){a.K&128||(a.Z=a.aa=b,a.U=0)}function Hd(a,b,c){a.K&128||(a.Z=a.aa=a.T=b,a.U=c||0)}function Id(a,b,c,d){a.K&128||(a.Z=a.aa=a.T=b,a.U=(c^b)&(d^b))}
|
|
|
|
|
function be(a,b){a.K&128||(a.Z=a.aa=a.T=b,a.U=a.Z^a.T>>1)}function ce(a,b,c,d){a.K&128||(a.Z=a.aa=a.T=b,a.U=(c^d)&(d^b))}k.ta=function(a,b,c){if(!this.M){0>this.xa?this.xa=Tc(this):this.A||(a=4,this.Ha|=4,this.u[6]=4);this.Hb=a;this.A=this.S=0;var d=this.ra(a|this.R),e=this.ra(a+2&65535|this.R);Uc(this,e&-12289|this.xa>>2&12288);de(this,this.xa);de(this,this.u[7]);O(this,d);this.K&=~(b|18);this.K|=1;this.xa=-1;this.K|=8;this.jd=a;this.Zc=c;if(-3!=c)throw a;}};
|
|
|
|
|
function ee(a){var b=fe(a),c=fe(a)&-1793;a.N&49152&&(c=c&-225|a.N&63712);O(a,b);Uc(a,c);a.K&=-17}function Dc(a,b){var c=b>>13&31;31>c&&a.pb&32&&(b=a.Mb[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)"));return b}
|
|
|
|
|
function ge(a,b,c){var d,e,f;if(!(c&a.Ua))return b;d=b>>13;a.pb&a.Xc[a.A]||(d&=7);e=a.V[a.A][d];f=(a.ya[a.A][d]<<6)+(b&8191)&a.Ub;var g=0;switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:128;break;default:g=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.V[a.A][d]=e;if(4194170!==f||a.A)a.Za=a.A,a.kb=d;b=!1;g&&(g&57344&&(0<=a.xa&&(g|=128),a.J&57344||(a.J=a.J|g|a.Za<<5|a.kb<<1),
|
|
|
|
|
b=!0),a.J&61440||!(4191360>f||4194239<f)||(a.J|=4096,a.J&512&&(a.K|=64)),b&&a.ta(168,0,-7));return f}function he(a,b){return a.v.Gb(b)}function fe(a){var b=a.ra(a.u[6]|a.R);a.u[6]=a.u[6]+2&65535;return b}function de(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.S=a.S<<8|246;ie(a,0,c);a.Ob(c,b)}function ie(a,b,c){!a.A&&c<=a.Wb&&(b||4<c)&&(1145<=a.cb&&c<=a.Wb-32?(a.Ha|=4,a.u[6]=4,a.ta(4,0,-5)):(a.Ha|=8,a.K|=32))}
|
|
|
|
|
function je(a,b,c,d){var e,f,g=d&8?0:a.R;switch(b){case 0:return a.ta(4,0,-6),0;case 1:return 6==c&&d&4&&ie(a,b,a.u[6]),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.ra(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.ra(e)|g;a.b-=8;break;case 6:return e=a.ra(Fd(a,2)),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=a.ra(Fd(a,2)),e=e+
|
|
|
|
|
a.u[c]&65535,e=a.ra(e|a.R)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;a.S=a.S<<8|f<<3&248|c;6==c&&0>f&&ie(a,b,a.u[6]);return e}k.Tb=function(a){if(!this.Ua)return this.v.Tb(a);this.M++;a=he(this,ge(this,a,3));this.M--;return a};k.bb=function(a){if(!this.Ua)return this.v.bb(a);this.M++;a=this.Ec(ge(this,a,2));this.M--;return a};k.qb=function(a,b){this.Ua?(this.M++,a=ge(this,a,5),a&1&&this.b--,this.v.Ab(a,b),this.M--):this.v.qb(a,b)};
|
|
|
|
|
k.Bb=function(a,b){this.Ua?(this.M++,this.Lc(ge(this,a,4),b),this.M--):this.v.Bb(a,b)};k.Uc=function(a,b,c){return je(this,a,b,c)};k.Vc=function(a,b,c){return ge(this,je(this,a,b,c),c)};k.Ec=function(a){return this.v.na(a)};k.Zd=function(a){return this.v.na(ge(this,a,2))};k.Lc=function(a,b){this.v.gb(a,b&65535)};k.Re=function(a,b){this.v.gb(ge(this,a,4),b)};
|
|
|
|
|
function ke(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=je(a,b,d,2),c&65536||61440!==(a.N&61440)&&(d&=65535),a.A=a.N>>12&3,c=a.ra(d|c&a.R),a.A=a.N>>14&3):c=6!=d||(a.N>>2&12288)===(a.N&12288)?a.u[d]:a.Ia[a.N>>12&3];return c}function le(a,b,c,d){a.S=22;var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=je(a,b,e,4),c&65536||(e&=65535),a.A=a.N>>12&3,e=ge(a,e|c&65536,4),a.A=a.N>>14&3,a.v.gb(e,d)):6!=e||(a.N>>2&12288)===(a.N&12288)?a.u[e]=d:a.Ia[a.N>>12&3]=d}
|
|
|
|
|
function me(a,b){b>>=6;var c=a.H=b&7;return(b=a.D=(b&56)>>3)?he(a,a.ba(b,c,3)):-c-1}function ne(a,b){var c;b>>=6;var d=a.H=b&7;(b=a.D=(b&56)>>3)?c=a.v.na(a.ba(b,d,2)):c=-d-1;return c}function oe(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return je(a,b,c,8)}function pe(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?he(a,a.ba(b,c,3)):a.u[c]&255}function qe(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?a.v.na(a.ba(b,c,2)):a.u[c]}
|
|
|
|
|
function R(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.tb=a.ba(b,e,7),c=0>c?a.u[-c-1]&255:c,c=d.call(a,c,he(a,e)),e&1&&a.b--,a.v.Ab(e,c)):(b=a.u[e],c=0>c?a.u[-c-1]&255:c,a.u[e]=b&65280|d.call(a,c,b&255))}function S(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.ba(b,e,6),a.v.gb(e,d.call(a,0>c?a.u[-c-1]:c,a.v.na(e)))):a.u[e]=d.call(a,0>c?a.u[-c-1]:c,a.u[e])}
|
|
|
|
|
function re(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(d=a.ba(b,e,5),e=c=0>c?a.u[-c-1]&255:c,d&1&&a.b--,a.v.Ab(d,e)):c?(c=0>c?a.u[-c-1]&255:c,a.u[e]=a.u[e]&~d|c<<24>>24&d):a.u[e]&=~d;return c}function se(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=a.ba(b,d,4),a.v.gb(d,0>c?a.u[-c-1]:c)):a.u[d]=0>c?a.u[-c-1]:c&65535;return c}function T(a,b,c){c&&(O(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3}
|
|
|
|
|
k.ib=function(a){this.w.complete=!0;var b=this.i&&te(this.i)?1:this.w.Xb?-1:0,c=a?this.w.Xb?0:1:-1;this.w.Xb=!1;this.ka=this.b=a;do{if(b){if(this.i&&ue(this.i,this.u[7],c)){this.fa();break}c||c++;b++}if(this.K){if(a=this.K&7){a=!1;if(this.K&2){this.K&=-3;var d=160,e=(this.jc&224)>>5,f=this.O&&this.O.xb>e?this.O:null;f&&(d=f.de,e=f.xb);e>(this.N&224)>>5?(this.K&4&&(Fd(this,2),this.K&=-5),this.ta(d,0,-3),e=!0):e=!1;if(e){if(f)if(a=f,f=this.O,f==a)this.O=a.next;else for(;f;){e=f.next;if(e==a){f.next=
|
|
|
|
|
e.next;break}f=e}a=!0}}else this.K&1&&this.K++;a=a&&0>c}if(a)break;if(this.K&112&&Gd(this)&&0>c)break}this.K=this.K&7|this.N&16;this.decode(Ed(this))}while(0<this.b);return this.w.complete?this.ka-this.b:void 0===this.w.complete?0:-1};Za(function(){for(var a=D(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new xd(d);B(d,c)}});function ve(a,b){var c=b+a;Id(this,c,a,b);return c&65535}function we(a,b){var c=b+a;Id(this,c<<8,a<<8,b<<8);return c&255}
|
|
|
|
|
function xe(a,b){a=b<<1;be(this,a);return a&65535}function ye(a,b){a=b<<1;be(this,a<<8);return a&255}function ze(a,b){a=b&32768|b>>1|b<<16;be(this,a);return a&65535}function Ae(a,b){a=b&128|b>>1|b<<8;be(this,a<<8);return a&255}function Be(a,b){a=b&~a;Q(this,a);return a}function Ce(a,b){a=b&~a;Q(this,a<<8);return a}function De(a,b){a|=b;Q(this,a);return a}function Ee(a,b){a|=b;Q(this,a<<8);return a}function Fe(a,b){a=~b|65536;Hd(this,a);return a&65535}
|
|
|
|
|
function Ge(a,b){a=~b|256;Hd(this,a<<8);return a&255}function He(a,b){a=b-a;this.K&128||(this.Z=this.aa=a,this.U=b&(b^a));return a&65535}function Ie(a,b){a=b-a;var c=a<<8;b<<=8;this.K&128||(this.Z=this.aa=c,this.U=b&(b^c));return a&255}function Je(a,b){a=b+a;this.K&128||(this.Z=this.aa=a,this.U=a&(b^a));return a&65535}function Ke(a,b){a=b+a;var c=a<<8;this.K&128||(this.Z=this.aa=c,this.U=c&(b<<8^c));return a&255}function Le(a,b){a=-b;Hd(this,a,a&b&32768);return a&65535}
|
|
|
|
|
function Me(a,b){a=-b;Hd(this,a<<8,(a&b&128)<<8);return a&255}function Ne(a,b){a=b<<1|this.T>>16&1;be(this,a);return a&65535}function Oe(a,b){a=b<<1|this.T>>16&1;be(this,a<<8);return a&255}function Pe(a,b){a=(this.T&65536|b)>>1|b<<16;be(this,a);return a&65535}function Qe(a,b){a=((this.T&65536)>>8|b)>>1|b<<8;be(this,a<<8);return a&255}function Re(a,b){var c=b-a;ce(this,c,a,b);return c&65535}function Se(a,b){var c=b-a;ce(this,c<<8,a<<8,b<<8);return c&255}
|
|
|
|
|
function Te(a,b){this.K&128||(this.Z=this.aa=b&65280,this.U=this.T=0);return(b<<8|b>>8)&65535}function Ue(a,b){a^=b;Q(this,a);return a&65535}function Ve(a){S(this,a,ne(this,a),ve);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}
|
|
|
|
|
function We(a){var b=qe(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.T=this.U=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.T=c<<17-b,c>>=b;else if(b)if(16<b)this.U=c,c=0;else{this.T=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.U=32768)}this.u[a]=c&65535;this.Z=this.aa=c;this.b-=(this.g?6:7)+b}
|
|
|
|
|
function Xe(a){var b=qe(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.T=this.U=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.T=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.T=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.U=32768)):d=c;this.u[a]=d>>16&65535;this.u[a|1]=d&65535;this.Z=d>>16;this.aa=d>>16|d;this.b-=(this.g?6:7)+b}function Ye(a){T(this,a,!Bd(this))}function Ze(a){T(this,a,Bd(this))}
|
|
|
|
|
function $e(a){S(this,a,ne(this,a),Be);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}function af(a){R(this,a,me(this,a),Ce);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}function bf(a){S(this,a,ne(this,a),De);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}function cf(a){R(this,a,me(this,a),Ee);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}
|
|
|
|
|
function df(a){var b=ne(this,a);a=qe(this,a);Q(this,(0>b?this.u[-b-1]:b)&a);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.D?4:3)+(7==this.f?2:0)}function ef(a){var b=me(this,a);a=pe(this,a);Q(this,((0>b?this.u[-b-1]&255:b)&a)<<8);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.D?4:3)+(7==this.f?2:0)}function ff(a){T(this,a,Dd(this))}function gf(a){T(this,a,!this.Ta()==!Cd(this))}function hf(a){T(this,a,!Dd(this)&&!this.Ta()==!Cd(this))}function jf(a){T(this,a,!Bd(this)&&!Dd(this))}
|
|
|
|
|
function kf(a){T(this,a,Dd(this)||!this.Ta()!=!Cd(this))}function lf(a){T(this,a,Bd(this)||Dd(this))}function mf(a){T(this,a,!this.Ta()!=!Cd(this))}function nf(a){T(this,a,this.Ta())}function of(a){T(this,a,!Dd(this))}function pf(a){T(this,a,!this.Ta())}function qf(){this.ta(12,0,-1);this.b-=5}function rf(a){T(this,a,!0)}function sf(a){T(this,a,!Cd(this))}function tf(a){T(this,a,Cd(this))}function U(a){a&1&&(this.T=0);a&2&&(this.U=0);a&4&&(this.aa=1);a&8&&(this.Z=0);this.b-=5}
|
|
|
|
|
function uf(a){var b=ne(this,a);a=qe(this,a);var c=(b=0>b?this.u[-b-1]:b)-a;ce(this,c,a,b);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.D?4:3)+(7==this.f?2:0)}function vf(a){var b=me(this,a);a=pe(this,a);var c=(b=(0>b?this.u[-b-1]&255:b)<<8)-(a<<=8);ce(this,c,a,b);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.D?4:3)+(7==this.f?2:0)}
|
|
|
|
|
function wf(a){var b=qe(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.T=this.U=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.u[a]=d&65535,this.u[a|1]=c-d*b&65535,this.aa=d>>16|d,this.Z=d>>16):(this.U=32768,this.aa=d>>15|d,this.Z=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.aa=this.Z=0,this.U=32768,this.T=65536,this.b-=7}function xf(){this.ta(24,0,-1);this.b-=25}
|
|
|
|
|
function yf(){this.N&49152?(this.Ha|=128,this.ta(4,0,-2)):(this.B&&this.B.setData(this.u[0],!0),this.i?zf(this.i):this.fa());this.b-=7}function Af(){this.ta(16,0,-1);this.b-=25}var Bf=[0,7,7,10,7,11,9,13];function Cf(a){this.I=this.b;O(this,oe(this,a));this.b=this.I-Bf[this.g]}var Df=[0,14,14,17,14,18,16,20];function Ef(a){this.I=this.b;var b=oe(this,a);a=a>>6&7;de(this,this.u[a]);this.u[a]=this.u[7];O(this,b);this.b=this.I-Df[this.g]}var Ff=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];
|
|
|
|
|
function Gf(a){var b=ne(this,a);this.I=this.b;Q(this,se(this,a,b));this.b=this.I-Ff[(this.D?8:0)+this.g]+(7!=this.f||this.g?0:2)}function Hf(a){var b=me(this,a);Q(this,re(this,a,b,65535)<<8);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}var If=[7,13,13,17,14,18,17,21];
|
|
|
|
|
function Jf(a){var b=qe(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.K&128||(this.Z=b>>16,this.aa=this.Z|b,this.U=0,this.T=-32768>b||32767<b?65536:0);this.b-=23}function Kf(){this.b-=5}function Lf(){this.N&49152||(this.v.reset(),cc(this));this.b-=667}function Mf(){ee(this);this.K|=this.N&16;this.b-=13}
|
|
|
|
|
function Nf(a){if(a&8)V.call(this,a);else{var b=fe(this);a&=7;7==a?O(this,b):(O(this,this.u[a]),this.u[a]=b);this.b-=9}}function W(a){a&1&&(this.T=65536);a&2&&(this.U=32768);a&4&&(this.aa=0);a&8&&(this.Z=32768);this.b-=5}function Of(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 Pf(a){S(this,a,ne(this,a),Re);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}
|
|
|
|
|
function Qf(a){S(this,a,0,Te);this.b-=this.g?9:3+(7==this.f?2:0)}function Rf(){this.ta(28,0,-1);this.b-=5}function Sf(){this.B&&(this.B.kc(this.u[7],!0),this.B.setData(this.u[0],!0));this.K|=4;Fd(this,-2);this.b-=3}function Tf(a){S(this,a,ne(this,a),Ue);this.b-=this.g?9:3+(7==this.f?2:0)}function V(a){var b;if(b=this.i)b=this.i,F(b,1)?(E(b,"undefined opcode "+J(b,a),!0,!0),b=zf(b)):b=!1;b||this.ta(8,0,-1)}function yd(a){Uf[a>>12].call(this,a)}function Vf(a){Wf[a>>6&3].call(this,a)}
|
|
|
|
|
function Xf(a){Yf[a>>6&3].call(this,a)}function Zf(a){$f[a>>6&3].call(this,a)}function ag(a){bg[a&15].call(this,a)}function cg(a){dg[a&15].call(this,a)}function eg(a){fg[a>>6&3].call(this,a)}function gg(a){hg[a>>6&3].call(this,a)}function ig(a){jg[a>>6&3].call(this,a)}
|
|
|
|
|
var Uf=[function(a){kg[a>>8&15].call(this,a)},Gf,uf,df,$e,bf,Ve,V,function(a){lg[a>>8&15].call(this,a)},Hf,vf,ef,af,cf,Pf,V],kg=[function(a){mg[a>>4&15].call(this,a)},rf,of,ff,gf,mf,hf,kf,Ef,Ef,Vf,Xf,Zf,V,V,V],Wf=[function(a){Hd(this,se(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Fe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,Je);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,He);this.b-=this.g?9:3+(7==this.f?2:0)}],Yf=[function(a){S(this,a,0,
|
|
|
|
|
Le);this.b-=this.g?11:6},function(a){S(this,a,Bd(this)?1:0,ve);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,Bd(this)?1:0,Re);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=qe(this,a);Hd(this,a);this.b-=this.g?4:3+(7==this.f?2:0)}],$f=[function(a){S(this,a,0,Pe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Ne);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,ze);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,xe);this.b-=this.g?9:3+(7==this.f?2:0)}],
|
|
|
|
|
mg=[function(a){ng[a&15].call(this,a)},V,V,V,Cf,Cf,Cf,Cf,Nf,V,ag,cg,Qf,Qf,Qf,Qf],ng=[yf,Sf,Mf,qf,Af,Lf,V,V,V,V,V,V,V,V,V,V],bg=[Kf,function(){this.T=0;this.b-=5},function(){this.U=0;this.b-=5},U,function(){this.aa=1;this.b-=5},U,U,U,function(){this.Z=0;this.b-=5},U,U,U,U,U,U,U],dg=[Kf,function(){this.T=65536;this.b-=5},function(){this.U=32768;this.b-=5},W,function(){this.aa=0;this.b-=5},W,W,W,function(){this.Z=32768;this.b-=5},W,W,W,W,W,W,W],lg=[pf,nf,jf,lf,sf,tf,Ye,Ze,xf,Rf,eg,gg,ig,V,V,V],fg=[function(a){Hd(this,
|
|
|
|
|
re(this,a,0,255));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,Ge);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)},function(a){R(this,a,1,Ie);this.b-=this.g?9:3+(7==this.f?2:0)}],hg=[function(a){R(this,a,0,Me);this.b-=this.g?11:6},function(a){R(this,a,Bd(this)?1:0,we);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,Bd(this)?1:0,Se);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=pe(this,a);Hd(this,a<<8);this.b-=this.g?4:3+
|
|
|
|
|
(7==this.f?2:0)}],jg=[function(a){R(this,a,0,Qe);this.b-=this.g?9+(this.tb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,Oe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,Ae);this.b-=this.g?9+(this.tb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,ye);this.b-=this.g?9:3+(7==this.f?2:0)}];function zd(a){og[a>>12].call(this,a)}
|
|
|
|
|
var og=[function(a){pg[a>>8&15].call(this,a)},Gf,uf,df,$e,bf,Ve,function(a){qg[a>>8&15].call(this,a)},function(a){rg[a>>8&15].call(this,a)},Hf,vf,ef,af,cf,Pf,V],pg=[function(a){sg[a>>4&15].call(this,a)},rf,of,ff,gf,mf,hf,kf,Ef,Ef,Vf,Xf,Zf,function(a){tg[a>>6&3].call(this,a)},V,V],tg=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.ra(a|this.R);O(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=ke(this,a,0);de(this,a);Q(this,a);this.b-=11},function(a){var b=fe(this);this.I=
|
|
|
|
|
this.b;le(this,a,0,b);Q(this,b);this.b=this.I-If[this.g]},function(a){Q(this,se(this,a,this.Ta?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],sg=[function(a){ug[a&15].call(this,a)},V,V,V,Cf,Cf,Cf,Cf,Nf,function(a){a&8?(this.N&49152||(this.N=this.N&-2017|(a&7)<<5,this.K|=1),this.b-=5):V.call(this,a)},ag,cg,Qf,Qf,Qf,Qf],ug=[yf,Sf,Mf,qf,Af,Lf,function(){ee(this);this.b-=13},function(){this.ta(8,0,-1)},V,V,V,V,V,V,V,V],qg=[Jf,Jf,wf,wf,We,We,Xe,Xe,Tf,Tf,V,V,V,V,Of,Of],rg=[pf,nf,jf,lf,sf,tf,Ye,Ze,xf,Rf,
|
|
|
|
|
eg,gg,ig,function(a){vg[a>>6&3].call(this,a)},V,V],vg=[V,function(a){a=ke(this,a,65536);de(this,a);Q(this,a);this.b-=11},function(a){var b=fe(this);this.I=this.b;le(this,a,65536,b);Q(this,b);this.b=this.I-If[this.g]},V];
|
|
|
|
|
function wg(a){t.call(this,"ROM",a,wg);this.ga=this.g=null;this.A=a.addr;this.f=a.size;this.D=!1;this.B=a.alias;this.C=a.file;this.H=ra(this.C);if(this.C){a=this.C;var b=sa(this.H);"json"!=b&&"hex"!=b&&(a=Fa()+"/api/v1/dump?file="+this.C+"&format=bytes&decimal=true");var c=this;Da(a,null,!0,function(a,b,f){f?(c.P("Unable to load ROM resource (error "+f+": "+a+")"),c.C=null):(qb(c.Qa,a,b),(a=Ea(a,b))?(c.g=a.da,c.ga=a.ga):c.C=null);xg(c)})}}z(wg);k=wg.prototype;
|
|
|
|
|
k.Ea=function(a,b,c,d){this.v=b;this.b=c;this.i=d;xg(this)};k.Ga=function(){this.ga&&(this.i&&Rg(this.i,this.id,this.A,this.f,this.ga),delete this.ga);return!0};k.Fa=function(){return!0};
|
|
|
|
|
function xg(a){if(!wb(a)){if(a.C){if(!a.g||!a.v)return;a.f||(a.f=a.g.length);if(a.g.length!=a.f)yb(a,"ROM size ("+p(a.g.length,8,!0)+") does not match specified size ("+p(a.f,8,!0)+")");else{var b;a:{b=a.A;a.status(a.f+"-byte ROM at "+qa(b));if(57344<=b&&b<57344+oc){var c={};b=(c[b]=[wg.prototype.Nd,wg.prototype.Fe,null,null,null,a.f>>1],c);if(Hb(a.v,a,b,256,a.Ya)){b=a.D=!0;break a}}else if(yc(a.v,b,a.f,ad)){for(c=0;c<a.g.length;c++)a.v.qb(b+c,a.g[c]);b=!0;break a}b=!1}if(b){b=[];"number"==typeof a.B?
|
|
|
|
|
b.push(a.B):null!=a.B&&a.B.length&&(b=a.B);for(c=0;c<b.length;c++){var d=a,e=b[c],f=xc(d.v,d.A,d.f);wc(d.v,e,d.f,f)}a.D||delete a.g}}}H(a)}}k.Nd=function(a){return this.g[a-this.A]};k.Fe=function(){};Za(function(){for(var a=D(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new wg(d);B(d,c)}});
|
|
|
|
|
function Sg(a){t.call(this,"RAM",a,Sg);this.ga=this.g=null;this.C=a.addr;this.A=a.size;this.La=a.load;this.Ka=a.exec;this.B=!1;this.f=a.file;this.D=ra(this.f);if(this.f){a=this.f;var b=sa(this.D);"json"!=b&&"hex"!=b&&(a=Fa()+"/api/v1/dump?file="+this.f+"&format=bytes&decimal=true");var c=this;Da(a,null,!0,function(a,b,f){f?(c.P("Unable to load RAM resource (error "+f+": "+a+")"),c.f=null):(qb(c.Qa,a,b),(a=Ea(a,b))?(c.g=a.da,c.ga=a.ga,null==c.La&&(c.La=a.La),null==c.Ka&&(c.Ka=a.Ka)):c.f=null);Tg(c)})}}
|
|
|
|
|
z(Sg);Sg.prototype.Ea=function(a,b,c,d){this.v=b;this.b=c;this.i=d;Tg(this)};Sg.prototype.Ga=function(){this.ga&&(this.i&&Rg(this.i,this.id,this.C,this.A,this.ga),delete this.ga);return!0};Sg.prototype.Fa=function(){return!0};function Tg(a){if(a.v&&(!a.B&&a.A&&yc(a.v,a.C,a.A,Bc)&&(a.B=!0),!wb(a))){if(!a.B)q("No RAM allocated");else if(a.f){if(!a.g||!a.v)return;Ug(a,a.g,a.La,a.Ka,a.C)}H(a)}}
|
|
|
|
|
Sg.prototype.reset=function(){if(this.B){for(var a=this.v,b=this.C,c=this.A,d=b&a.v,b=b>>>a.ja;0<c&&b<a.Y.length;){var e=a.Y[b];if(e.controller&&a.g&&a.g.length==a.B.length){var f=a.g.indexOf(e);0<=f&&(e=a.B[f])}if(e){var f=c,g=0,h,d=d||0,g=g&255;void 0===f&&(f=e.size);if(zb&&e.G)for(h=d;f--&&h<e.G.length;h++)e.G[h]=g;else for(h=d;f--&&h<e.size;h++)e.Zb(d,g,e.F+d)}c-=a.za;b++;d=0}this.g&&Ug(this,this.g,this.La,this.Ka,this.C,!0)}};
|
|
|
|
|
function Ug(a,b,c,d,e,f){var g=!1;if(null==c)for(var h=0;h<b.length-1;){var l=b[h]&255|(b[h+1]&255)<<8;if(l)if(l&255){if(1!=l)break;if(h+6>=b.length)break;for(var h=h+2,m=b[h++]&255|(b[h++]&255)<<8,n=b[h++]&255|(b[h++]&255)<<8,l=l+((m&255)+(m>>8)+(n&255)+(n>>8)),v=h,r=m-=6;0<m&&h<b.length;)l+=b[h++]&255,m--;if(m||h>=b.length)break;l+=b[h++]&255;if(l&255)break;if(r)for(E(a,"loading "+p(r,4,!0)+" bytes at "+p(n,4,!0)+"-"+p(n+r-1,4,!0),1048576);r--;)a.b.qb(n++,b[v++]&255);else n&1?a.b.fa():null==d&&
|
|
|
|
|
(d=n),null!=d&&E(a,"starting address: "+p(d,4,!0),1048576);g=!0}else h++;else h+=2}if(!g&&(null==c&&(c=e),null!=c)){for(g=0;g<b.length;g++)a.b.qb(c+g,b[g]);g=!0}g&&null!=d&&(a=a.b,a.Rb=d,O(a,d),!f&&a.i&&(a.fa()||qd(a.i)));return g}Za(function(){for(var a=D(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Sg(d);B(d,c)}});function Vg(a){t.call(this,"Keyboard",a,Vg,65536);H(this)}z(Vg);Vg.prototype.sa=function(){return!1};
|
|
|
|
|
Vg.prototype.Ea=function(a,b,c,d){this.C=a;this.b=c;this.i=d};Za(function(){for(var a=D(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Vg(d);B(d,c)}});
|
|
|
|
|
function X(a){this.M=a.baudReceive||9600;this.ca=a.baudTransmit||9600;this.$=a.upperCase;this.B=this.A=null;this.R=a.tabSize;this.O=a.charBOL;this.D=0;t.call(this,"SerialPort",a,X,8388608);var b=a.binding;if("console"==b)this.A="";else{var c;a=Wg;b&&(void 0===c&&(c="Panel"),(c=tb(c,this.id))&&(b=c.G[b])&&this.sa(null,a,b))}this.I=this.L=null;this.exports={connect:this.xc,receiveData:this.ic}}z(X);var Wg="buffer";k=X.prototype;
|
|
|
|
|
k.sa=function(a,b,c){var d=this;switch(b){case Wg:return this.G[b]=this.B=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.ic(b);return!0},c.onkeypress=function(a){a=a||window.event;d.ic(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
|
|
|
|
|
k.Ea=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.i=d;var e=this;this.ka=Qc(48,4);this.S=Nc(this.b,function(){e.f&128||!e.H.length||(e.J=e.H.shift()&255,e.$&&97<=e.J&&122>e.J&&(e.J-=32),e.f|=128,e.f&64&&Oc(e.b,e.ka))});this.X=Qc(52,4);this.ia=Nc(this.b,function(){e.g|=128;e.g&64&&Oc(e.b,e.X)});Hb(b,this,Xg);Jb(b,this.reset.bind(this));H(this)};
|
|
|
|
|
k.xc=function(){if(!this.I){var a=nd(this.C,"connection");if(a){var b=a.split("->");if(2==b.length){var c=xa(b[0]);if(c!=this.Ya)return;b=xa(b[1]);if(this.I=sb(b)){var d=this.I.exports;if(d){var e=d.connect;e&&e.call(this.I);if(this.L=d.receiveData){this.status(this.Qa+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};k.Ga=function(a,b){if(!b)if(this.xc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
|
|
|
|
|
k.Fa=function(a){return a?this.save():!0};k.reset=function(){Yg(this)};k.save=function(){var a=new N(this);a.set(0,[]);return a.data()};k.restore=function(){return Yg(this)};function Yg(a){a.J=0;a.f=0;a.g=128;return!0}k.ic=function(a){if("number"==typeof a)this.H.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.H.push(a.charCodeAt(b));else this.H=this.H.concat(a);Pc(this.b,this.S,1E3/Math.round(this.M/10));return!0};k.Hd=function(){return this.f&65534};
|
|
|
|
|
k.ze=function(a){this.f=this.f&-112|a&111};k.Gd=function(){this.f&=-129;0<this.H.length&&Pc(this.b,this.S,1E3/Math.round(this.M/10));return this.J};k.ye=function(){};k.ae=function(){return this.g};k.Te=function(a){this.g&128&&a&64&&Oc(this.b,this.X);this.g=this.g&-70|a&69};k.$d=function(){return 0};
|
|
|
|
|
k.Se=function(a){if(a&=255){E(this,"transmitByte("+p(a,2,!0)+")");this.L&&this.L.call(this.I,a);if(this.B)if(13==a)this.D=0;else if(8==a)this.B.value=this.B.value.slice(0,-1),0<this.D&&this.D--;else{var b;b=(b=ya[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.R||8,c=a-this.D%a,this.R&&(b=wa("",c)));this.O&&!this.D&&c&&(b=String.fromCharCode(this.O)+b);this.B.value+=b;this.B.scrollTop=this.B.scrollHeight;this.D+=c}else if(null!=this.A){if(10==a||1024<=this.A.length)this.j(this.A),
|
|
|
|
|
this.A="";10!=a&&(this.A+=String.fromCharCode(a))}this.g&=-129;Pc(this.b,this.ia,1E3/Math.round(this.ca/10))}};var Zg={},Xg=(Zg[65392]=[null,null,X.prototype.Hd,X.prototype.ze,"RCSR"],Zg[65394]=[null,null,X.prototype.Gd,X.prototype.ye,"RBUF"],Zg[65396]=[null,null,X.prototype.ae,X.prototype.Te,"XCSR"],Zg[65398]=[null,null,X.prototype.$d,X.prototype.Se,"XBUF"],Zg);Za(function(){for(var a=D(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new X(d);B(d,c)}});
|
|
|
|
|
function Vc(a){t.call(this,"PC11",a,Vc);this.g=a.autoMount||null;this.D=0;this.$=a.baudReceive||3600;this.J=this.L=this.f=0;this.I=[];this.H=$g;this.B=ah;this.M=this.A="";this.da=this.La=this.Ka=null;this.R=-1;this.O=!Ra("Mobi")&&window&&"FileReader"in window}z(Vc);var $g="",ah=0;k=Vc.prototype;
|
|
|
|
|
k.sa=function(a,b,c){var d=this,e=ah;switch(b){case "listTapes":return this.G[b]=c,c.onchange=function(){var a=d.G.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(l){q("PC11 option error: "+l.message)}b=e.desc;void 0===b&&(b="");e=e.href;void 0!==e&&(b='<a href="'+e+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descTape":return this.G[b]=c,!0;case "loadTape":e=2;case "attachTape":return e||(e=1),this.G[b]=c,c.onclick=
|
|
|
|
|
function(){var a=d.G.listTapes;a&&bh(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.O){c.parentNode.removeChild(c);break}this.G[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;bh(d,ra(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.G[b]=c,!0}return!1};
|
|
|
|
|
k.Ea=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.i=d;this.S=ch(a);var e=this;if((this.g=nd(this.C,"autoMount")||this.g)&&"string"==typeof this.g)try{this.g=eval("("+this.g+")")}catch(f){q("PC11 auto-mount error: "+f.message+" ("+this.g+")"),this.g=null}this.X=Qc(56,4);this.ca=Nc(this.b,function(){1==(e.f&32769)&&!(e.f&128)&&e.J<e.I.length&&(e.L=e.I[e.J++]&255,dh(e,e.J/e.I.length*100),e.f|=128,e.f&=-2049,e.f&64&&Oc(e.b,e.X))});Hb(b,this,eh);Jb(b,this.reset.bind(this));fh(this,"None",$g,!0);this.O&&
|
|
|
|
|
fh(this,"Local Tape","?");fh(this,"Remote Tape","??");gh(this)||H(this)};k.Ga=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};k.Fa=function(a){return a?this.save():!0};k.reset=function(){this.f&=-2241;this.L=0};function gh(a){a.D=0;if(a.g){var b=a.g.path||"",c;if(!(c=a.g.name))a:{if((c=a.G.listTapes)&&c.options)for(var d=0;d<c.options.length;d++){var e=c.options[d];if(e.value==b){c=e.text;break a}}c=ra(b,!0)}b&&c?hh(a,c,b,1,!0):ih(a)}return!!a.D}
|
|
|
|
|
function bh(a,b,c,d,e){if(c)if("?"==c)a.P('Use "Choose File" and "Mount" to select and load a local tape.');else{if("??"==c){c=window.prompt("Enter the URL of a remote tape image.","")||"";if(!c)return;b=ra(c);a.status("Attempting to load "+c+' as "'+b+'"');a.H="??"}else a.H=c;hh(a,b,c,d,!1,e)}else jh(a,!1)}
|
|
|
|
|
function hh(a,b,c,d,e,f){var g=-1;if(a.A.toLowerCase()!=c.toLowerCase()||a.B!=d)g++,jh(a,!0),a.w.ab?a.P("PC11 busy"):(e&&(a.D++,F(a)&&E(a,"auto-loading tape: "+b)),kh(a,b,c,d,f)?g++:a.w.ab=!0);g&&lh(a,a.M,a.A,a.B,a.da,a.La,a.Ka)}
|
|
|
|
|
function kh(a,b,c,d,e){var f=c;if(e){var g=new FileReader;g.onload=function(){var e=g.result;e&&(e=new Uint8Array(e,0,e.byteLength),lh(a,b,c,d,e),a.H="?");ih(a)};g.readAsArrayBuffer(e);return!0}0>c.indexOf("/api/v1/dump")&&(e=sa(c),f="json"==e||"gz"==e?encodeURI(c):Fa()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!Da(f,null,!0,function(e,f,g){var h=0>g&&a.C&&!a.C.w.ha;g?a.P('Unable to load tape "'+b+'" (error '+g+": "+e+")",h):(qb(a.Qa,e,f),(e=Ea(e,f))&&lh(a,b,c,d,e.da,e.La,
|
|
|
|
|
e.Ka));a.w.ab=!1;a.D&&(a.D--,a.D||H(a));ih(a)})}function fh(a,b,c,d){if((a=a.G.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 ih(a){var b=a.G.listTapes;if(b&&b.options){a=a.H||a.A;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 dh(a,b){b|=0;if(b!==a.R){var c=a.G.readProgress;c&&(c=(c=D(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.R=b}}
|
|
|
|
|
function lh(a,b,c,d,e,f,g){a.M=b;a.A=c;a.B=d;a.da=e;a.La=f;a.Ka=g;2==d?a.S&&Ug(a.S,e,f,g)?a.status("tape loaded: "+b):(a.M="",a.A="",a.H=$g,a.B=ah,a.P("No load address available for tape: "+b)):(a.J=0,a.I=e,a.status("tape attached: "+b),dh(a,0))}function jh(a,b){if(a.A||!1===b)a.M="",a.A="",b||(a.B&&a.status(1==a.B?"tape detached":"tape unloaded"),a.H=$g,a.B=ah,ih(a))}k.save=function(){return(new N(this)).data()};k.restore=function(){return!0};k.Ad=function(){return this.f&65534};
|
|
|
|
|
k.se=function(a){a&1&&(this.f&32768?(a&=-2,this.f&64&&Oc(this.b,this.X)):(this.f&=-129,this.f|=2048,this.L=0,Pc(this.b,this.ca,1E3/Math.round(this.$/10))));this.f=this.f&-66|a&65};k.zd=function(){this.f&=-129;this.f|=2048;return this.L};k.re=function(){};var mh={},eh=(mh[65384]=[null,null,Vc.prototype.Ad,Vc.prototype.se,"PRS"],mh[65386]=[null,null,Vc.prototype.zd,Vc.prototype.re,"PRB"],mh);
|
|
|
|
|
function nh(a,b,c){t.call(this,"Disk",{id:a.Qa+".disk"+p(++oh,4)},nh,4194304);this.controller=a;this.C=a.C;this.i=a.i;this.B=b;this.Xa=b.name;this.ec=b.ec;ph(this,c,b.ua,b.Aa,b.qa,b.Ma);H(this)}var oh=0;z(nh);k=nh.prototype;k.Ea=function(a,b,c,d){this.i=d};
|
|
|
|
|
function ph(a,b,c,d,e,f){a.mode=b;a.ua=c;a.Aa=d;a.qa=e;a.Ma=f;a.b=[];if("preload"!=a.mode){b=Array(a.ua);for(c=0;c<b.length;c++){d=Array(a.Aa);for(e=0;e<d.length;e++){f=Array(a.qa);for(var g=1;g<=f.length;g++)f[g-1]=qh(null,c,e,g,a.Ma,0);d[e]=f}b[c]=d}a.b=b}a.f=null}
|
|
|
|
|
function rh(a,b,c,d,e){var f=c;if(a.v)return!0;a.Xa=b;a.fb=c;a.Ic=ra(c);a.v=e;a.A=a.controller;if(d){var g=new FileReader;g.onload=function(){var b=g.result,c,d=b?b.byteLength:0,e=ka[d];if(e){a.ua=e[0];a.Aa=e[1];a.qa=e[2];a.Ma=e[3]||512;c=a.Ma>>2;var f=e=0,b=new DataView(b,0,d);a.b=Array(a.ua);for(d=0;d<a.b.length;d++)for(var r=a.b[d]=Array(a.Aa),w=0;w<r.length;w++)for(var y=r[w]=Array(a.qa),x=0;x<y.length;x++){for(var C=qh(null,d,w,x+1,a.Ma,0),ia=C.data,Ja=0;Ja<c;Ja++,f+=4)var P=ia[Ja]=b.getInt32(f,
|
|
|
|
|
!0),e=e+P&-1;C.Ba=c;y[x]=C}a.f=e;c=a}else a.P("Unrecognized disk format ("+d+" bytes)");a.v&&(a.v.call(a.controller,a.B,c,a.Xa,a.fb),a.v=null)};g.readAsArrayBuffer(d);return!0}0>c.indexOf("/api/v1/dump")&&(b=sa(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):ta(c,"/")&&(d="dir"),f=Fa()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.ec?"":e)+"&format=json"));return!!Da(f,
|
|
|
|
|
null,!0,function(b,c,d){sh(a,b,c,d)})}
|
|
|
|
|
function sh(a,b,c,d){var e=null;a.g=!1;var f=0>d&&a.C&&!a.C.w.ha;if(d)a.controller.P('Unable to load disk "'+a.Xa+'" (error '+d+": "+b+")",f);else{qb(a.controller.Qa,b,c);try{if(0<ra(a.Ic,!0).toLowerCase().indexOf("-readonly"))a.g=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.g=!0)}var h;"<"==c.substr(0,1)?h=["Missing disk image: "+a.Xa]:h=0>c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+
|
|
|
|
|
c+")");if(h.length)if(1==h.length)q(h[0]);else{a.ua=h.length;a.Aa=h[0].length;a.qa=h[0][0].length;var l=h[0][0][0];a.Ma=l&&l.length||512;for(d=c=0;d<a.ua;d++)for(f=0;f<a.Aa;f++)for(g=0;g<a.qa;g++)if(l=h[d][f][g]){var m=l.length;void 0===m&&(m=l.length=512);var m=m>>2,n=l.pattern;void 0===n&&(n=l.pattern=0);var v=l.data;if(void 0===v){var r=l.bytes;if(void 0!==r&&r.length){for(var w=m<<2,y=r.length;y<w;y++)r[y]=n;th(l,r)}else v=[],n=l.pattern=n|n<<8|n<<16|n<<24,l.data=v;delete l.bytes}qh(l,d,f);for(w=
|
|
|
|
|
0;w<v.length;w++)c=c+v[w]&-1}a.b=h;a.f=c;e=a}else q("Empty disk image: "+a.Xa)}catch(x){q("Disk image error ("+b+"): "+x.message)}}a.v&&(a.v.call(a.A,a.B,e,a.Xa,a.fb),a.v=null)}function qh(a,b,c,d,e,f){a||(a={sector:d,length:e,data:[],pattern:f});a.We=b;a.Xe=c;a.Pa=a.Ba=0;a.Sa=!1;return a}
|
|
|
|
|
k.seek=function(a,b,c,d,e){d=null;var f=this.B,g=this.b[a];if(g){var h=g[b];if(!h&&f.Oc&&b<f.Aa)for(h=g[b]=Array(f.Pc),g=0;g<h.length;g++)h[g]=qh(null,a,b,g+1,f.Cc,0);if(h){for(g=0;g<h.length;g++)if(h[g]&&h[g].sector==c){d=h[g];break}!d&&f.Oc&&9==f.oc&&(d=h[g]=qh(null,a,b,f.oc,f.Cc,0))}}e&&e(d,!1);return d};function th(a,b){for(var c=0,d=a.length>>2,e=Array(d),f=0;f<d;f++)e[f]=b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24,c+=4;a.data=e}
|
|
|
|
|
k.read=function(a,b){var c=-1;if(a&&b<a.length)var c=a.data,d=b>>2,c=(d<c.length?c[d]:a.pattern)>>((b&3)<<3)&255;return c};k.write=function(a,b,c){if(this.g)return!1;if(b<a.length){if(c!=this.read(a,b,!0)){var d=a.data,e=a.pattern,f=b>>2;b=(b&3)<<3;for(var g=d.length;g<=f;g++)d[g]=e;a.Ba?f<a.Pa?(a.Ba+=a.Pa-f,a.Pa=f):f>=a.Pa+a.Ba&&(a.Ba+=f-(a.Pa+a.Ba)+1):(a.Pa=f,a.Ba=1);d[f]=d[f]&~(255<<b)|c<<b}return!0}return null};
|
|
|
|
|
function vh(a,b){var c=a.za*a.pa,d=b/c|0;return d<a.ua?(b%=c,a.seek(d,b/a.pa|0,b%a.pa+1)):null}function wh(a,b,c){for(var d=1,e=0,f=0;d--;){var g=a.read(b,c++);if(0>g)break;e|=g<<f;f+=8}return e}
|
|
|
|
|
k.save=function(){var a=0,b=[];b[a++]=[this.gb,this.f,this.ua,this.za,this.pa,this.La];if(!this.g)for(var c=this.b,d=0;d<c.length;d++)for(var e=0;e<c[d].length;e++)for(var f=0;f<c[d][e].length;f++){var g=c[d][e][f];if(g&&g.Ba){for(var h=[],l=0,m=g.Pa,n=g.Pa+g.Ba;m<n;)h[l++]=g.data[m++];b[a++]=[d,e,f,g.Pa,h]}}return b};
|
|
|
|
|
k.restore=function(a){var b=0,c="unsupported restore format";if(a&&0<a.length){var d=0,e=a[d++];e&&2<=e.length&&(!this.b.length&&6<=e.length?qh(this,"local",e[2],e[3],e[4],e[5]):null!=e[1]&&null!=this.f&&e[1]!=this.f&&(c="original checksum ("+e[1]+") differs from current checksum ("+this.f+")",b=-2));for(this.b.length||(b=-1);d<a.length&&0<=b;){var f=0,g=a[d++],h=g[f++],l=g[f++],m=g[f++];if(h>=this.b.length||l>=this.b[h].length||m>=this.b[h][l].length){c="sector (CHS="+h+":"+l+":"+m+") out of range ("+
|
|
|
|
|
function uh(a,b){var c=a.Aa*a.qa,d=b/c|0;return d<a.ua?(b%=c,a.seek(d,b/a.qa|0,b%a.qa+1)):null}function vh(a,b,c){for(var d=1,e=0,f=0;d--;){var g=a.read(b,c++);if(0>g)break;e|=g<<f;f+=8}return e}
|
|
|
|
|
k.save=function(){var a=0,b=[];b[a++]=[this.fb,this.f,this.ua,this.Aa,this.qa,this.Ma];if(!this.g)for(var c=this.b,d=0;d<c.length;d++)for(var e=0;e<c[d].length;e++)for(var f=0;f<c[d][e].length;f++){var g=c[d][e][f];if(g&&g.Ba){for(var h=[],l=0,m=g.Pa,n=g.Pa+g.Ba;m<n;)h[l++]=g.data[m++];b[a++]=[d,e,f,g.Pa,h]}}return b};
|
|
|
|
|
k.restore=function(a){var b=0,c="unsupported restore format";if(a&&0<a.length){var d=0,e=a[d++];e&&2<=e.length&&(!this.b.length&&6<=e.length?ph(this,"local",e[2],e[3],e[4],e[5]):null!=e[1]&&null!=this.f&&e[1]!=this.f&&(c="original checksum ("+e[1]+") differs from current checksum ("+this.f+")",b=-2));for(this.b.length||(b=-1);d<a.length&&0<=b;){var f=0,g=a[d++],h=g[f++],l=g[f++],m=g[f++];if(h>=this.b.length||l>=this.b[h].length||m>=this.b[h][l].length){c="sector (CHS="+h+":"+l+":"+m+") out of range ("+
|
|
|
|
|
b+" changes applied)";b=-1;break}if(this.g){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(h=this.b[h][l][m]){for(l=h.data.length;l<e;)h.data[l++]=h.pattern;l=0;h.Pa=e;for(h.Ba=f.length;e<g;)h.data[e++]=f[l++];b++}}}0>b&&-2!=b&&this.controller.P("Unable to restore disk '"+this.Xa+": "+c);return b};
|
|
|
|
|
k.toJSON=function(){var a;a=0;for(var b;b=vh(this,a++);)xh(b);a=JSON.stringify(this.b,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")};
|
|
|
|
|
function xh(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}function M(a){t.call(this,"RL11",a,M,4194304);this.B=a.autoMount||null;this.H=0;this.f=Array(4);this.L=!Ra("Mobi")&&window&&"FileReader"in window}z(M);k=M.prototype;
|
|
|
|
|
k.ra=function(a,b,c){var d=this;switch(b){case "listDisks":return this.G[b]=c,c.onchange=function(){var a=d.G.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(h){q("RL11 option error: "+h.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.G[b]=c,c.onchange=function(){var a=pa(c.value,10);null!=a&&yh(d,a)},!0;case "loadDrive":return this.G[b]=
|
|
|
|
|
c,c.onclick=function(){var a=d.G.listDisks;a&&zh(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":if(!this.L){c.parentNode.removeChild(c);break}this.G[b]=c;c.onclick=function(){var a=d.G.listDrives;if(a&&a.options&&d.f)if(a=d.f[pa(a.value,10)||0])if(a=a.Ca){var b;b="";for(var c=0,h;h=vh(a,c++);)for(var l=0,m=h.length;l<m;l++)b+=String.fromCharCode(wh(a,h,l));b=btoa(b);a=a.Gc.replace(".json",".img");c=null;b="data:application/octet-stream;base64,"+b;a&&(c=document.createElement("a"),
|
|
|
|
|
k.toJSON=function(){var a;a=0;for(var b;b=uh(this,a++);)wh(b);a=JSON.stringify(this.b,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")};
|
|
|
|
|
function wh(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}function M(a){t.call(this,"RL11",a,M,4194304);this.B=a.autoMount||null;this.H=0;this.f=Array(4);this.L=!Ra("Mobi")&&window&&"FileReader"in window}z(M);k=M.prototype;
|
|
|
|
|
k.sa=function(a,b,c){var d=this;switch(b){case "listDisks":return this.G[b]=c,c.onchange=function(){var a=d.G.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(h){q("RL11 option error: "+h.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.G[b]=c,c.onchange=function(){var a=pa(c.value,10);null!=a&&xh(d,a)},!0;case "loadDrive":return this.G[b]=
|
|
|
|
|
c,c.onclick=function(){var a=d.G.listDisks;a&&yh(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":if(!this.L){c.parentNode.removeChild(c);break}this.G[b]=c;c.onclick=function(){var a=d.G.listDrives;if(a&&a.options&&d.f)if(a=d.f[pa(a.value,10)||0])if(a=a.Ca){var b;b="";for(var c=0,h;h=uh(a,c++);)for(var l=0,m=h.length;l<m;l++)b+=String.fromCharCode(vh(a,h,l));b=btoa(b);a=a.Ic.replace(".json",".img");c=null;b="data:application/octet-stream;base64,"+b;a&&(c=document.createElement("a"),
|
|
|
|
|
"string"!=typeof c.download&&(c=null));c?(c.href=b,c.download=a,document.body.appendChild(c),c.click(),document.body.removeChild(c),a="Check your Downloads folder for "+a+"."):(window.open(b),a="Check your browser for a new window/tab containing the requested data"+(a?" ("+a+")":"")+".");q(a)}else d.P("No disk loaded in drive.");else d.P("No disk drive selected.")};return!0;case "mountDrive":if(this.L)return this.G[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;zh(d,ra(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};
|
|
|
|
|
k.Ea=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.i=d;if((this.B=nd(this.C,"autoMount")||this.B)&&"string"==typeof this.B)try{this.B=eval("("+this.B+")")}catch(e){q("RL11 auto-mount error: "+e.message+" ("+this.B+")"),this.B=null}Ah(this);this.O=Qc(112,5);Hb(b,this,Bh,4194304);Ch(this,"None","",!0);this.L&&Ch(this,"Local Disk","?");Ch(this,"Remote Disk","??");Dh(this)||H(this)};
|
|
|
|
|
k.Ga=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.C.sc){for(a=0;a<this.f.length;a++)Eh(this,a,!0);Dh(this,!0)}}else if(!this.restore(a))return!1;if(a=this.G.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;4>b;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";yh(this,0)}}return!0};k.Fa=function(a){return a?this.save():!0};k.reset=function(){Ah(this)};k.save=function(){return(new N(this)).data()};
|
|
|
|
|
k.restore=function(a){return Ah(this,a[0])};function Dh(a,b){b||(a.H=0);if(a.B)for(var c in a.B){var d=a.B[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.G.listDisks)&&f.options)for(var g=0;g<f.options.length;g++){var h=f.options[g];if(h.value==e){f=h.text;break a}}f=ra(e,!0)}if(e&&f&&(g=-1,c&&(g=c.charCodeAt(c.length-1)-48,0>g||9<g)&&(g=-1),0<=g&&g<a.f.length)){!Fh(a,g,f,e,!0)&&b&&H(a,!1);continue}a.P("Incorrect auto-mount settings for drive "+c+" ("+JSON.stringify(d)+")")}return!!a.H}
|
|
|
|
|
function zh(a,b,c,d){var e=a.G.listDrives,e=e&&pa(e.value,10);if(void 0===e||0>e||e>=a.f.length)a.P("Unable to load the selected drive");else if(c)if("?"==c)a.P('Use "Choose File" and "Mount" to select and load a local disk.');else{if("??"==c){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=ra(c);a.status("Attempting to load "+c+' as "'+b+'"')}Fh(a,e,b,c,!1,d)}else Eh(a,e)}
|
|
|
|
|
function Fh(a,b,c,d,e,f){var g=-1,h=a.f[b];h.gb.toLowerCase()!=d.toLowerCase()&&(g++,Eh(a,b,!0),h.ec?a.P("RL11 busy"):(h.ec=!0,e&&(h.dc=!0,a.H++,F(a)&&E(a,"auto-loading disk: "+c)),h.Pb=!!f,sh(new oh(a,h,"preload"),c,d,f,a.Pc)&&g++));return g}
|
|
|
|
|
k.Pc=function(a,b,c,d,e){var f;a.ec=!1;b&&(f=b.b.length?[b.b.length,b.b[0].length,b.b[0][0].length,b.b[0][0][0].length]:[0,0,0,0],b&&f[0]>a.ua||f[1]>a.za)&&(this.P('Disk "'+c+'" too large for drive '+("RL"+a.gc)),b=null);b?(a.Ca=b,a.Xa=c,a.gb=d,this.P('Mounted disk "'+c+'" in drive '+("RL"+a.gc),a.dc||e),this.C&&this.C.rb()):a.Pb=!1;a.dc&&(a.dc=!1,--this.H||H(this));yh(this,a.gc)};
|
|
|
|
|
function Ch(a,b,c,d){if((a=a.G.listDisks)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
|
|
|
|
|
function yh(a,b){if(0<=b&&b<a.f.length){var c=a.f[b],d=a.G.listDisks;a=a.G.listDrives;if(d&&a&&d.options&&a.options&&(a=pa(a.value,10),c=c.Pb?"?":c.gb,!isNaN(a)&&a==b)){for(b=0;b<d.options.length;b++)if(d.options[b].value==c){d.selectedIndex!=b&&(d.selectedIndex=b);break}b==d.options.length&&(d.selectedIndex=0)}}}function Eh(a,b,c){var d=a.f[b];if(d.Ca||!1===c)d.Xa="",d.gb="",d.Ca=null,d.Pb=!1,c||(a.P("Drive RL"+b+" unloaded",c),yh(a,b))}
|
|
|
|
|
function Ah(a,b){var c=0;b||(b=[]);a.ea=b[c++]||0;a.I=b[c++]||0;a.g=b[c++]||0;a.A=b[c++]||0;a.D=b[c++]||0;a.J=b[c]||0;for(b=0;b<a.f.length;b++){var d=a.f[b];void 0===d&&(d=a.f[b]={});c=a;d.gc=b;d.ec=d.Pb=!1;d.name=c.Ya;d.ua=512;d.za=2;d.pa=40;d.La=256;d.fc=!0;d.Te=0;d.Se=0;d.pc=1;d.Nc=d.pa;d.Ac=d.La;d.We=0;d.Ye=null;d.Ca||(d.gb="");d.status=29|(512==d.ua?128:0)}return!0}
|
|
|
|
|
k.Qc=function(a,b,c,d,e,f){this.I=f&65535;this.ea=this.ea&-49|f>>12&48;this.J=f>>16&63;this.A=this.g=b<<7|(c?64:0)|d&63;this.D=65536-e&65535;a&&(this.ea=this.ea|a|32768);return!0};
|
|
|
|
|
k.ld=function(a,b,c,d,e,f,g){var h=0,l=a.Ca,m=null,n;l||(h=5120,e=0);for(;e--;){if(!m){m=a.Ca.seek(b,c,d+1);if(!m){h=5120;break}n=0}var v,r;if(0>(v=a.Ca.read(m,n++))||0>(r=a.Ca.read(m,n++))){h=5120;break}this.v.hb(f,v|r<<8);if(Mc(this.v)){h=8192;break}f+=2;if(n>=l.La&&(m=null,++d>=l.pa&&(d=0,++c>=l.za&&(c=0,++b>=l.ua)))){h=5120;break}}return g(h,b,c,d,e,f)};
|
|
|
|
|
k.fe=function(a,b,c,d,e,f,g){var h=0,l=a.Ca,m=null,n;l||(h=5120,e=0);for(;e--;){var v=this.v.na(f);if(Mc(this.v)){h=8192;break}f+=2;if(!m){m=a.Ca.seek(b,c,d+1,!0);if(!m){h=5120;break}n=0}if(!a.Ca.write(m,n++,v&255)||!a.Ca.write(m,n++,v>>8)){h=5120;break}if(n>=l.La&&(m=null,++d>=l.pa&&(d=0,++c>=l.za&&(c=0,++b>=l.ua)))){h=5120;break}}return g(h,b,c,d,e,f)};k.Id=function(){return this.ea&65535};
|
|
|
|
|
k.Ae=function(a){this.ea=this.ea&-1023|a&1022;this.M=this.M&-4|(a&48)>>4;if(!(this.ea&128)){var b;a=!0;var c=this.f[(this.ea&768)>>8],d,e,f,g;this.ea&=-2;switch(this.ea&14){case 4:this.g&8&&(this.ea&=63);this.D=c.status|this.A&64;break;case 6:1==(this.g&3)&&(b=this.g&65408,c=(this.g&16)<<2,this.A=this.g&4?this.A+b:this.A-b,this.g=this.A=this.A&65408|c);break;case 8:this.D=this.A;break;case 12:b=this.ld;case 10:b||(b=this.fe),d=this.g>>7,e=this.g&64?1:0,f=this.g&63,d>=c.ua||f>=c.pa?this.ea|=37888:
|
|
|
|
|
(g=(this.J&63)<<16|this.I,a=65536-this.D&65535,a=b.call(this,c,d,e,f,a,g,this.Qc.bind(this)))}a&&(this.ea|=129,this.ea&64&&Oc(this.b,this.O))}};k.Gd=function(){return this.I};k.ye=function(a){this.I=a&65534};k.Jd=function(){return this.g};k.Be=function(a){this.g=a};k.Kd=function(){return this.D};k.Ce=function(a){this.D=a};k.Hd=function(){return this.J};k.ze=function(a){this.J=a&63};
|
|
|
|
|
var Gh={},Bh=(Gh[63744]=[null,null,M.prototype.Id,M.prototype.Ae,"RLCS"],Gh[63746]=[null,null,M.prototype.Gd,M.prototype.ye,"RLBA"],Gh[63748]=[null,null,M.prototype.Jd,M.prototype.Be,"RLDA"],Gh[63750]=[null,null,M.prototype.Kd,M.prototype.Ce,"RLMP"],Gh[63752]=[null,null,M.prototype.Hd,M.prototype.ze,"RLBE"],Gh);function Hh(a){t.call(this,"Debugger",a,Hh);this.ca=a.base||16;this.Aa=!1;this.J=0;this.R=!1;this.A=-1;this.g=[];this.X={}}z(Hh);
|
|
|
|
|
var Ih={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};Hh.prototype.vc=function(){return-1};Hh.prototype.wc=function(){};
|
|
|
|
|
function Jh(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.R?b="end":b=a.g[a.A+1];a=[];if(b){b=b.replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var g=b.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==d&&!e||!g)a.push(xa(b.substring(c,f))),c=f+1}}return a}
|
|
|
|
|
function Kh(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;
|
|
|
|
|
!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;yh(d,ra(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};
|
|
|
|
|
k.Ea=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.i=d;if((this.B=nd(this.C,"autoMount")||this.B)&&"string"==typeof this.B)try{this.B=eval("("+this.B+")")}catch(e){q("RL11 auto-mount error: "+e.message+" ("+this.B+")"),this.B=null}zh(this);this.O=Qc(112,5);Hb(b,this,Ah,4194304);Jb(b,this.reset.bind(this));Bh(this,"None","",!0);this.L&&Bh(this,"Local Disk","?");Bh(this,"Remote Disk","??");Ch(this)||H(this)};
|
|
|
|
|
k.Ga=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.C.rc){for(a=0;a<this.f.length;a++)Dh(this,a,!0);Ch(this,!0)}}else if(!this.restore(a))return!1;if(a=this.G.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;4>b;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";xh(this,0)}}return!0};k.Fa=function(a){return a?this.save():!0};k.reset=function(){zh(this)};k.save=function(){return(new N(this)).data()};
|
|
|
|
|
k.restore=function(a){return zh(this,a[0])};function Ch(a,b){b||(a.H=0);if(a.B)for(var c in a.B){var d=a.B[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.G.listDisks)&&f.options)for(var g=0;g<f.options.length;g++){var h=f.options[g];if(h.value==e){f=h.text;break a}}f=ra(e,!0)}if(e&&f&&(g=-1,c&&(g=c.charCodeAt(c.length-1)-48,0>g||9<g)&&(g=-1),0<=g&&g<a.f.length)){!Eh(a,g,f,e,!0)&&b&&H(a,!1);continue}a.P("Incorrect auto-mount settings for drive "+c+" ("+JSON.stringify(d)+")")}return!!a.H}
|
|
|
|
|
function yh(a,b,c,d){var e=a.G.listDrives,e=e&&pa(e.value,10);if(void 0===e||0>e||e>=a.f.length)a.P("Unable to load the selected drive");else if(c)if("?"==c)a.P('Use "Choose File" and "Mount" to select and load a local disk.');else{if("??"==c){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=ra(c);a.status("Attempting to load "+c+' as "'+b+'"')}Eh(a,e,b,c,!1,d)}else Dh(a,e)}
|
|
|
|
|
function Eh(a,b,c,d,e,f){var g=-1,h=a.f[b];h.fb.toLowerCase()!=d.toLowerCase()&&(g++,Dh(a,b,!0),h.dc?a.P("RL11 busy"):(h.dc=!0,e&&(h.cc=!0,a.H++,F(a)&&E(a,"auto-loading disk: "+c)),h.Pb=!!f,rh(new nh(a,h,"preload"),c,d,f,a.Rc)&&g++));return g}
|
|
|
|
|
k.Rc=function(a,b,c,d,e){var f;a.dc=!1;b&&(f=b.b.length?[b.b.length,b.b[0].length,b.b[0][0].length,b.b[0][0][0].length]:[0,0,0,0],b&&f[0]>a.ua||f[1]>a.Aa)&&(this.P('Disk "'+c+'" too large for drive '+("RL"+a.fc)),b=null);b?(a.Ca=b,a.Xa=c,a.fb=d,this.P('Mounted disk "'+c+'" in drive '+("RL"+a.fc),a.cc||e),this.C&&this.C.rb()):a.Pb=!1;a.cc&&(a.cc=!1,--this.H||H(this));xh(this,a.fc)};
|
|
|
|
|
function Bh(a,b,c,d){if((a=a.G.listDisks)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
|
|
|
|
|
function xh(a,b){if(0<=b&&b<a.f.length){var c=a.f[b],d=a.G.listDisks;a=a.G.listDrives;if(d&&a&&d.options&&a.options&&(a=pa(a.value,10),c=c.Pb?"?":c.fb,!isNaN(a)&&a==b)){for(b=0;b<d.options.length;b++)if(d.options[b].value==c){d.selectedIndex!=b&&(d.selectedIndex=b);break}b==d.options.length&&(d.selectedIndex=0)}}}function Dh(a,b,c){var d=a.f[b];if(d.Ca||!1===c)d.Xa="",d.fb="",d.Ca=null,d.Pb=!1,c||(a.P("Drive RL"+b+" unloaded",c),xh(a,b))}
|
|
|
|
|
function zh(a,b){var c=0;b||(b=[]);a.ea=b[c++]||0;a.I=b[c++]||0;a.g=b[c++]||0;a.A=b[c++]||0;a.D=b[c++]||0;a.J=b[c]||0;for(b=0;b<a.f.length;b++){var d=a.f[b];void 0===d&&(d=a.f[b]={});c=a;d.fc=b;d.dc=d.Pb=!1;d.name=c.Ya;d.ua=512;d.Aa=2;d.qa=40;d.Ma=256;d.ec=!0;d.Ve=0;d.Ue=0;d.oc=1;d.Pc=d.qa;d.Cc=d.Ma;d.Ye=0;d.$e=null;d.Ca||(d.fb="");d.status=29|(512==d.ua?128:0)}return!0}
|
|
|
|
|
k.Sc=function(a,b,c,d,e,f){this.I=f&65535;this.ea=this.ea&-49|f>>12&48;this.J=f>>16&63;this.A=this.g=b<<7|(c?64:0)|d&63;this.D=65536-e&65535;a&&(this.ea=this.ea|a|32768);return!0};
|
|
|
|
|
k.nd=function(a,b,c,d,e,f,g){var h=0,l=a.Ca,m=null,n;l||(h=5120,e=0);for(;e--;){if(!m){m=a.Ca.seek(b,c,d+1);if(!m){h=5120;break}n=0}var v,r;if(0>(v=a.Ca.read(m,n++))||0>(r=a.Ca.read(m,n++))){h=5120;break}this.v.gb(f,v|r<<8);if(Mc(this.v)){h=8192;break}f+=2;if(n>=l.Ma&&(m=null,++d>=l.qa&&(d=0,++c>=l.Aa&&(c=0,++b>=l.ua)))){h=5120;break}}return g(h,b,c,d,e,f)};
|
|
|
|
|
k.he=function(a,b,c,d,e,f,g){var h=0,l=a.Ca,m=null,n;l||(h=5120,e=0);for(;e--;){var v=this.v.na(f);if(Mc(this.v)){h=8192;break}f+=2;if(!m){m=a.Ca.seek(b,c,d+1,!0);if(!m){h=5120;break}n=0}if(!a.Ca.write(m,n++,v&255)||!a.Ca.write(m,n++,v>>8)){h=5120;break}if(n>=l.Ma&&(m=null,++d>=l.qa&&(d=0,++c>=l.Aa&&(c=0,++b>=l.ua)))){h=5120;break}}return g(h,b,c,d,e,f)};k.Kd=function(){return this.ea&65535};
|
|
|
|
|
k.Ce=function(a){this.ea=this.ea&-1023|a&1022;this.M=this.M&-4|(a&48)>>4;if(!(this.ea&128)){var b;a=!0;var c=this.f[(this.ea&768)>>8],d,e,f,g;this.ea&=-2;switch(this.ea&14){case 4:this.g&8&&(this.ea&=63);this.D=c.status|this.A&64;break;case 6:1==(this.g&3)&&(b=this.g&65408,c=(this.g&16)<<2,this.A=this.g&4?this.A+b:this.A-b,this.g=this.A=this.A&65408|c);break;case 8:this.D=this.A;break;case 12:b=this.nd;case 10:b||(b=this.he),d=this.g>>7,e=this.g&64?1:0,f=this.g&63,d>=c.ua||f>=c.qa?this.ea|=37888:
|
|
|
|
|
(g=(this.J&63)<<16|this.I,a=65536-this.D&65535,a=b.call(this,c,d,e,f,a,g,this.Sc.bind(this)))}a&&(this.ea|=129,this.ea&64&&Oc(this.b,this.O))}};k.Id=function(){return this.I};k.Ae=function(a){this.I=a&65534};k.Ld=function(){return this.g};k.De=function(a){this.g=a};k.Md=function(){return this.D};k.Ee=function(a){this.D=a};k.Jd=function(){return this.J};k.Be=function(a){this.J=a&63};
|
|
|
|
|
var Fh={},Ah=(Fh[63744]=[null,null,M.prototype.Kd,M.prototype.Ce,"RLCS"],Fh[63746]=[null,null,M.prototype.Id,M.prototype.Ae,"RLBA"],Fh[63748]=[null,null,M.prototype.Ld,M.prototype.De,"RLDA"],Fh[63750]=[null,null,M.prototype.Md,M.prototype.Ee,"RLMP"],Fh[63752]=[null,null,M.prototype.Jd,M.prototype.Be,"RLBE"],Fh);function Gh(a){t.call(this,"Debugger",a,Gh);this.ca=a.base||16;this.xa=!1;this.J=0;this.R=!1;this.A=-1;this.g=[];this.X={}}z(Gh);
|
|
|
|
|
var Hh={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};Gh.prototype.uc=function(){return-1};Gh.prototype.vc=function(){};
|
|
|
|
|
function Ih(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.R?b="end":b=a.g[a.A+1];a=[];if(b){b=b.replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var g=b.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==d&&!e||!g)a.push(xa(b.substring(c,f))),c=f+1}}return a}
|
|
|
|
|
function Jh(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 Lh(a,b,c){var d;if(b){b=Mh(a,b);for(var e=0,f=!1,g=b,h=[],l=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<m.length;){var n=m[e++],v=n.length,n=xa(n);if(!n){f=!0;break}n=Nh(a,n,null,!1===c);if(void 0===n){f=!0;c=!1;break}h.push(n);if(e==m.length)break;var n=m[e++],r=n.length;l.length&&Ih[n]<Ih[l[l.length-1]]&&Kh(h,l,1);l.push(n);b=b.substr(v+r)}Kh(h,l)&&1==h.length||(f=!0);f?c&&a.j("error parsing '"+g+"' at character "+(g.length-b.length)):(d=h.pop(),c&&Oh(a,null,
|
|
|
|
|
d))}return d}function Mh(a,b){for(var c,d=a.Aa?"(":"{",e=a.Aa?")":"}",f=new RegExp(a.Aa?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(f))&&!(0<=c[1].indexOf(d));){var g=Lh(a,c[1]);b=b.replace(d+c[1]+e,null!=g?J(a,g):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(a=b;b=a.match(/\$([a-z]+)/i);){c=null;switch(b[1].toLowerCase()){case "ops":c=0}if(null==c)break;a=a.replace(b[0],c.toString())}return a}
|
|
|
|
|
function Nh(a,b,c,d){var e;null!=b?(e=a.vc(b),0<=e?e=a.wc(e):(e=a.X[b],null==e&&(e=pa(b,a.ca))),null!=e||d||a.j("invalid "+(c?c:"value")+": "+b)):d||a.j("missing "+(c||"value"));return e}
|
|
|
|
|
function Oh(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=0,g="";if(!f||4<f)f=4;for(var h=0;h<f;h++){g&&(g=","+g);var l=d&255,m=8,n="";m?32<m&&(m=32):m=32;if(null==l||isNaN(l))for(;0<m--;)n="?"+n;else for(;0<m--;)n=(l&1?"1":"0")+n,l>>=1;g=n+g;d>>=8}d=p(c,0,!0)+" "+c+". "+qa(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.j((null!=b?b+": ":"")+d);return e}function Ph(a,b){if(b)return Oh(a,b,a.X[b]);var c=0;for(b in a.X)Oh(a,b,a.X[b]),c++;return 0<c}
|
|
|
|
|
function Kh(a,b,c){var d;if(b){b=Lh(a,b);for(var e=0,f=!1,g=b,h=[],l=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<m.length;){var n=m[e++],v=n.length,n=xa(n);if(!n){f=!0;break}n=Mh(a,n,null,!1===c);if(void 0===n){f=!0;c=!1;break}h.push(n);if(e==m.length)break;var n=m[e++],r=n.length;l.length&&Hh[n]<Hh[l[l.length-1]]&&Jh(h,l,1);l.push(n);b=b.substr(v+r)}Jh(h,l)&&1==h.length||(f=!0);f?c&&a.j("error parsing '"+g+"' at character "+(g.length-b.length)):(d=h.pop(),c&&Nh(a,null,
|
|
|
|
|
d))}return d}function Lh(a,b){for(var c,d=a.xa?"(":"{",e=a.xa?")":"}",f=new RegExp(a.xa?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(f))&&!(0<=c[1].indexOf(d));){var g=Kh(a,c[1]);b=b.replace(d+c[1]+e,null!=g?J(a,g):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(a=b;b=a.match(/\$([a-z]+)/i);){c=null;switch(b[1].toLowerCase()){case "ops":c=0}if(null==c)break;a=a.replace(b[0],c.toString())}return a}
|
|
|
|
|
function Mh(a,b,c,d){var e;null!=b?(e=a.uc(b),0<=e?e=a.vc(e):(e=a.X[b],null==e&&(e=pa(b,a.ca))),null!=e||d||a.j("invalid "+(c?c:"value")+": "+b)):d||a.j("missing "+(c||"value"));return e}
|
|
|
|
|
function Nh(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=0,g="";if(!f||4<f)f=4;for(var h=0;h<f;h++){g&&(g=","+g);var l=d&255,m=8,n="";m?32<m&&(m=32):m=32;if(null==l||isNaN(l))for(;0<m--;)n="?"+n;else for(;0<m--;)n=(l&1?"1":"0")+n,l>>=1;g=n+g;d>>=8}d=p(c,0,!0)+" "+c+". "+qa(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.j((null!=b?b+": ":"")+d);return e}function Oh(a,b){if(b)return Nh(a,b,a.X[b]);var c=0;for(b in a.X)Nh(a,b,a.X[b]),c++;return 0<c}
|
|
|
|
|
function J(a,b,c,d){switch(a.ca){case 8:a=qa(b,3*c-(2<c?1:0));break;case 10:a=b.toString();break;default:a=p(b,2*c)}d?d=a.replace(/^0+([0-9A-F]+)$/i,"$1"):d=a;return d}
|
|
|
|
|
function Qh(a){Hh.call(this,a);this.kb=!1;this.Aa=!0;this.L=Y(0);this.lb=Y(0);this.O=Y(0);this.I=[];this.f=this.M=this.D=[];Rh(this);this.ta=0;Sh(this);this.Na={};Th(this,a.messages);this.Za=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return rd(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return rd(b,a)})}z(Qh,Hh);
|
|
|
|
|
var Uh={"?":"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"},Vh=".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(" "),
|
|
|
|
|
Wh={61440:{4096:[62,4032,63],8192:[47,4032,63],12288:[18,4032,63],16384:[14,4032,63],20480:[16,4032,63],24576:[3,4032,63],36864:[63,4032,63],40960:[48,4032,63],45056:[19,4032,63],49152:[15,4032,63],53248:[17,4032,63],57344:[94,4032,63]},65024:{2048:[57,448,63],28672:[100,63,448],29184:[101,63,448],29696:[102,63,448],30208:[103,63,448],30720:[104,448,63],32256:[105,448,8192]},65280:{256:[27,4096],512:[24,4096],768:[10,4096],1024:[11,4096],1280:[22,4096],1536:[12,4096],1792:[20,4096],32768:[25,4096],
|
|
|
|
|
function Ph(a){Gh.call(this,a);this.jb=!1;this.xa=!0;this.L=Y(0);this.kb=Y(0);this.O=Y(0);this.I=[];this.f=this.M=this.D=[];Qh(this);this.pa=0;Rh(this);this.Ja={};Sh(this,a.messages);this.Za=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return rd(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return rd(b,a)})}z(Ph,Gh);
|
|
|
|
|
var Th={"?":"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"},Uh=".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(" "),
|
|
|
|
|
Vh={61440:{4096:[62,4032,63],8192:[47,4032,63],12288:[18,4032,63],16384:[14,4032,63],20480:[16,4032,63],24576:[3,4032,63],36864:[63,4032,63],40960:[48,4032,63],45056:[19,4032,63],49152:[15,4032,63],53248:[17,4032,63],57344:[94,4032,63]},65024:{2048:[57,448,63],28672:[100,63,448],29184:[101,63,448],29696:[102,63,448],30208:[103,63,448],30720:[104,448,63],32256:[105,448,8192]},65280:{256:[27,4096],512:[24,4096],768:[10,4096],1024:[11,4096],1280:[22,4096],1536:[12,4096],1792:[20,4096],32768:[25,4096],
|
|
|
|
|
33024:[23,4096],33280:[13,4096],33536:[21,4096],33792:[28,4096],34048:[29,4096],34304:[8,4096],34560:[9,4096],34816:[106,32768],35072:[107,32768]},65472:{64:[56,63],192:[95,63],2560:[39,63],2624:[49,63],2688:[53,63],2752:[51,63],2816:[67,63],2880:[1,63],2944:[77,63],3008:[97,63],3072:[73,63],3136:[71,63],3200:[6,63],3264:[4,63],3328:[58,24576],3392:[60,63],3456:[65,63],3520:[96,63],35328:[40,63],35392:[50,63],35456:[54,63],35520:[52,63],35584:[68,63],35648:[2,63],35712:[78,63],35776:[98,63],35840:[74,
|
|
|
|
|
63],35904:[72,63],35968:[7,63],36032:[5,63],36096:[66,63],36160:[59,63],36224:[64,63],36288:[61,63]},65528:{128:[76,7],152:[108,12288]},65535:{0:[55],1:[99],2:[75],3:[26],4:[109],5:[70],6:[110],7:[111],160:[69],161:[31],162:[41],163:[33],164:[45],165:[36],166:[43],167:[35],168:[38],169:[32],170:[42],171:[34],172:[46],173:[37],174:[44],175:[30],176:[69],177:[80],178:[88],179:[82],180:[92],181:[85],182:[90],183:[84],184:[87],185:[81],186:[89],187:[83],188:[93],189:[86],190:[91],191:[79]}},Xh=[0],Yh=
|
|
|
|
|
[58,60,65,96,108,110,100,101,102,103,104,105,59,64];k=Qh.prototype;
|
|
|
|
|
k.Ea=function(a,b,c,d){this.v=b;this.C=a;this.b=c;this.B=a.B;(a=nd(a,"messages"))&&Th(this,a);this.ub=Wh;this.Eb=1145>this.b.cb?Yh:[];Zh(this,function(a){a:{var b=d.v.Y,c=a[0],e=a=0,l=b.length;if(c){a=d.aa($h(d,c));if(-1===a){d.j("invalid address: "+c);break a}e=a>>>d.v.ja;l=1}d.j("blockid physical blockaddr used size type");d.j("-------- --------- ---------- ------ ------ ----");for(var c=-1,m=0;l--;){var n=b[e];n.type==c?m++||d.j("..."):(c=n.type,m=Cc[c],n&&d.j(p(n.id,8)+" %"+
|
|
|
|
|
p(e<<d.v.ja,8)+" %%"+p(n.F,8)+" "+p(n.Mb,4,!0)+" "+p(n.size,4,!0)+" "+m),c!=$c&&(c=-1),m=0);a+=d.v.ya;e++}}});H(this)};
|
|
|
|
|
k.ra=function(a,b,c){var d=this;switch(b){case "debugInput":return this.ka=this.G[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",rd(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.G[b]=c,Ta(c,function(){if(d.ka){var a=d.ka.value;
|
|
|
|
|
d.ka.value="";rd(d,a,!0);return!0}return!1}),!0;case "step":return this.G[b]=c,Ta(c,function(a){var b=!1;vb(d,!0)||(ub(d,!0),b=d.jb(a?1:0),ub(d,!1));return b}),!0}return!1};k.rb=function(a){if(this.ka){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.ka.focus();!a&&window&&window.scrollTo(b,c)}};k.aa=function(a){a=a&&a.F;null==a&&(a=-1);return a};k.Fb=function(a,b){var c=255,d=this.aa(a,!1,1);-1!==d&&(c=a.Qb?this.v.Tb(d):this.b.Tb(d),b&&ai(a,b));return c};
|
|
|
|
|
k.na=function(a,b){var c=65535,d=this.aa(a,!1,2);-1!==d&&(c=a.Qb?this.v.bb(d):this.b.bb(d),b&&ai(a,b));return c};k.Xb=function(a,b,c){var d=this.aa(a,!0,1);-1!==d&&(a.Qb?this.v.qb(d,b):this.b.qb(d,b),c&&ai(a,c),this.C.oa(-1))};k.hb=function(a,b,c){var d=this.aa(a,!0,2);-1!==d&&(a.Qb?this.v.Bb(d,b):this.b.Bb(d,b),c&&ai(a,c),this.C.oa(-1))};function Y(a,b){return{F:a,Qb:b,Oa:!1}}k.lc=function(a,b){a.F=b;a.Oa=!1;return a};function bi(a){return[a.F,a.Oa]}function ci(a){return{F:a[0],Oa:a[1]}}
|
|
|
|
|
function $h(a,b,c){var d,e=(c?a.L:a.lb).F;c=!1;if(void 0!==b){b=Mh(a,b);"%"==b.charAt(0)&&(c=!0,b=b.substr(1));d=b;var f;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),e=0;e<a.I.length;e++){var g=a.I[e].ga[d];if(void 0!==g){d=g.o;void 0!==d&&(f=Y(d));break}}if(d=f)return d;e=Lh(a,b,void 0)}null!=e&&(d=Y(e,c));return d}function di(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Kc=Jh(a,b.Fc=c[2]))}function ai(a,b){null!=a.F&&(a.F+=b||1)}
|
|
|
|
|
function Th(a,b){a.i=a;a.ma=a.Oc=536870912;a.ia=null;a.va=[];b=Jh(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in Bb){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.ma|=Bb[c],a.j(c+" messages enabled"))}}function Zh(a,b){for(var c in Bb)if(64==Bb[c]){a.Na[c]=b;break}}
|
|
|
|
|
k.vc=function(a){var b=-1;a=a.toUpperCase();switch(a){case "SP":b=6;break;case "PC":b=7;break;case "SW":b=21;break;default:"R"==a.charAt(0)&&(b=+a.charAt(1),0>b||7<b)&&(b=-1)}return b};function ei(a){return 6>a?"R"+a:6==a?"SP":"PC"}k.wc=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Wa[a-8]:20>a?b=this.b.Ia[a-16]:20==a?b=Tc(this.b):21==a&&this.B&&lc(this.B)&&(b=this.B.Va));return b};
|
|
|
|
|
k.message=function(a,b){b&&(a+=" @"+J(this,Y(this.b.Kb).F));this.ma&1073741824?this.va.push(a):this.ia&&a==this.ia||(this.ia=a,this.ma&-2147483648&&this.b&&this.b.w.W&&(this.fa(),a+=" (cpu halted)"),this.j(a),this.b&&(a=this.b,vd(a),a.va=0,a.oa()))};function Sh(a){var b;if(!ue(a))a.H&&a.H.length&&a.j("instruction history buffer freed"),a.ba=0,a.H=[];else if(!a.H||!a.H.length){a.H=Array(1E3);for(b=0;b<a.H.length;b++)a.H[b]=Y();a.ba=0;a.j("instruction history buffer allocated")}}
|
|
|
|
|
k.ib=function(a,b){if(!fi(this,b))return!1;this.b.ib(a);return!0};k.jb=function(a,b,c){if(!fi(this))return!1;this.J=0;a||ue(this)&&ve(this,this.b.u[7],0);try{a=wd(this.b,a);var d=this.b.jb(a);0<d&&(dc(this.b,d),this.J+=d,ec(this.b,d,!0),fc(this.b,d),this.wa++)}catch(e){"number"!=typeof e&&(this.J=0,yb(this.b,e.stack||e.message))}!1!==c&&this.C.oa(-1);qd(this,b||!1);return 0<this.J};k.fa=function(a){this.b&&this.b.fa(a)};
|
|
|
|
|
function qd(a,b){if(a.kb){void 0===b&&(b=!0);var c;c=a.b;if(c=c.K&8?c.Yc|c.Xc<<8:0){var d=c>>8;a.j("trapped to "+J(a,c&255,1)+" ("+(0>d?Ab[-d]:J(a,d))+")")}a.L=Y(a.b.u[7]);b&&1!=a.S?gi(a):hi(a)}}function fi(a,b){var c;(c=!a.b||!wb(a.b))||(c=a.b,c.w.ha?c=!0:(c.j(c.toString()+" not powered"),c=!1),c=!c);return c||a.b.w.W?(b||a.j("cpu busy or unavailable, command ignored"),!1):!xb(a.b)}k.Ga=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};
|
|
|
|
|
k.Fa=function(a,b){b&&this.j(a?"suspending":"shutting down");return a?this.save():!0};k.reset=function(a){Sh(this);this.wa=0;this.ia=null;this.J=0;this.L=Y(this.b.u[7]);this.w.W=!1;ii(this);a||qd(this)};k.save=function(){var a=new N(this);a.set(0,bi(this.L));a.set(1,bi(this.O));a.set(2,[this.g,this.R,this.ma]);a.set(3,this.I);return a.data()};
|
|
|
|
|
k.restore=function(a){var b=0;void 0!==a[2]&&(this.L=ci(a[b++]),this.O=ci(a[b++]),this.g=a[b][0],"string"==typeof this.g&&(this.g=[this.g]),this.R=a[b][1],this.ma|=a[b][2]);a[3]&&(this.I=a[3]);return!0};k.start=function(a,b){this.S||this.j("running");this.w.W=!0;this.Ob=a;this.Sb=b};
|
|
|
|
|
k.stop=function(a,b){if(this.w.W){this.w.W=!1;this.J=b-this.Sb;if(!this.S){b="stopped";if(this.J){a-=this.Ob;var c=0<a?Math.round(1E3*this.J/a):0;b+=" (";ue(this)&&(b+=this.wa+" instructions, ",this.wa=0);b+=this.J+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.j(b)}qd(this,!0);this.rb();ii(this,this.b.u[7]);this.ia=null}};function ue(a){return 1<a.f.length||!!a.ta}
|
|
|
|
|
function ve(a,b,c){var d=-1;c||(d=a.b.bb(b),0==d&&(b=Fd(a.b,2)));if(0<c&&(a.ta&&!--a.ta||id(a,b,1,a.f)))return!0;0<=c&&a.H.length&&(a.wa++,0>d&&(d=a.b.bb(b)),65535!=(d&65535)&&(a.lc(a.H[a.ba],b),++a.ba==a.H.length&&(a.ba=0)));return!1}function Af(a){var b=a.b;if(b.w.W)throw O(b,a.b.Kb),a.fa(),-1;return!1}
|
|
|
|
|
function Rh(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.v;c=a.aa(c);jd(d.Y[c>>>d.ja],!1)}a.M=["br"];if(a.D)for(b=1;b<a.D.length;b++)c=a.D[b],d=a.v,c=a.aa(c),jd(d.Y[c>>>d.ja],!0);a.D=["bw"];a.mb=0}k.nb=function(a,b,c){var d=!0;c||ji(this,a,b,!1,!0);if(a!=this.f){var e=this.aa(b);if(-1===e)this.j("invalid address: "+J(this,b.F)),d=!1;else{var f=this.v;f.Y[e>>>f.ja].nb(e&f.v,a==this.D)}}d&&(a.push(b),c?b.Oa=!0:(ki(this,a,a.length-1,"set"),Sh(this)));return d};
|
|
|
|
|
function ji(a,b,c,d,e){var f=!1;c=a.aa(c);for(var g=1;g<b.length;g++){var h=b[g];if(c==a.aa(h)&&(!d||h.Oa)){f=!0;h.Oa||e||ki(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.v,jd(d.Y[c>>>d.ja],b==a.D));h.Oa||Sh(a);break}}return f}function li(a,b){for(var c=1;c<b.length;c++)ki(a,b,c);return b.length-1}function ki(a,b,c,d){c=b[c];a.j(b[0]+" "+J(a,c.F)+(d?" "+d:c.Fc?' "'+c.Fc+'"':""))}
|
|
|
|
|
function ii(a,b){if(void 0!==b)id(a,b,1,a.f,!0),a.S=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Oa){if(!ji(a,a.f,c,!0))break;b=0}}}
|
|
|
|
|
function id(a,b,c,d,e){var f=!1;if(!a.mb++)for(var g=1;!f&&g<d.length;g++){var h=d[g];if(!e||h.Oa)for(var l=a.aa(h)&65535,m=0;m<c;m++)if(b+m==l){var n,f=!0;h.Oa&&(ji(a,d,h,!0),e=!0);if(n=h.Kc){for(var f=!1,v=0;v<n.length;v++)if(!mi(a,n[v],!0)){if(n[v].indexOf("if")){f=!0;break}for(var r=v+1;r<n.length&&n[r].indexOf("else");r++)v++;if(r==n.length){f=!0;break}}a.b.w.W||(f=!0)}if(f){e||ki(a,d,g,"hit");break}}}a.mb--;return f}
|
|
|
|
|
function ni(a,b,c,d){var e=Y(b.F),f=a.na(b,2),g,h;for(h in a.ub)if(g=a.ub[h][f&h])break;g||(g=Xh);var l=g[0];0<=a.Eb.indexOf(l)&&(g=Xh,l=g[0]);var m=h="",n=Vh[l],v=g.length-1;l||v||(h=J(a,f));for(l=1;l<=v;l++){var r=g[l];if(void 0!==r){var w;w=a;var y=r,r=b,x="",C=y&61440;if(4096==C)r=r.F+((f&255)<<24>>23)&65535,x=J(w,r);else if(8192==C)r=r.F-((f&63)<<1)&65535,x=J(w,r);else if(12288==C)x=J(w,f&7,1);else if(24576==C)x=J(w,f&63,1);else if(32768==C)x=J(w,f&255,1);else if(C=f&y,y&4032&&(C>>=6,y>>=6),
|
|
|
|
|
y&63)switch(y=C&7,C&56){case 0:x=ei(y);break;case 8:x="@"+ei(y);break;case 16:7>y?x="("+ei(y)+")+":(C=w.na(r,2),x="#"+J(w,C,0,!0));break;case 24:7>y?x="@("+ei(y)+")+":(C=w.na(r,2),x="@#"+J(w,C,0,!0));break;case 32:x="-("+ei(y)+")";break;case 40:x="@-("+ei(y)+")";break;case 48:C=w.na(r,2);x=J(w,C,0,!0)+"("+ei(y)+")";7==y&&(x=J(w,C+r.F&65535));break;case 56:C=w.na(r,2),x="@"+J(w,C)+"("+ei(y)+")",7==y&&(x="@"+J(w,C+r.F&65535))}w=x;if(!w||!w.length){h="INVALID";break}"string"!=typeof w&&(m=w[1],w=w[0]);
|
|
|
|
|
0<h.length&&(h+=",");h+=w||"???"}}f="";g=J(a,e.F)+":";if(-1!==e.F&&-1!==b.F){do if(f+=" "+J(a,a.na(e,2)),null==e.F)break;while(e.F!=b.F)}g+=wa(f,24);g+=wa(n,5);h&&(g+=" "+h);if(c||m)g=wa(g,60)+";"+(c||""),g=a.b.w.vb?g+("cycles="+sd(a.b).toString()+" cs="+p(a.b.Hb)):g+(null!=d?"="+d.toString():""),m&&(g+=" @"+m);return g}function oi(a,b){switch(b){case "N":a=a.b.Ta();break;case "Z":a=Dd(a.b);break;case "V":a=Cd(a.b);break;case "C":a=Bd(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
|
|
|
|
|
function pi(a,b){var c="",d=a.b;8>b?(c=ei(b),c+="="+J(a,d.u[b])):13>b?c="A"+(b-8)+"="+J(a,d.Wa[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+J(a,d.Ia[b-16]):20==b?c="PS="+J(a,Tc(d)):21==b&&a.B&&lc(a.B)&&(c="SW="+J(a,a.B.Va,3));c&&(c+=" ");return c}function qi(a){var b,c="";for(b=0;6>b;b++)c+=pi(a,b);c=c+"\n"+(pi(a,6)+pi(a,7));c+=pi(a,20)+pi(a,21);return c+=oi(a,"T")+oi(a,"N")+oi(a,"Z")+oi(a,"V")+oi(a,"C")}k.qc=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
|
|
|
|
|
function Sg(a,b,c,d,e){var f=[],g;for(g in e){var h=e[g];"number"==typeof h&&(e[g]=h={o:h});var l=h.o,m=h.a;if(void 0!==l){var n=f,l=[l>>>0,g],v=za(n,l,a.qc);0>v&&n.splice(-(v+1),0,l)}m&&(h.a=m.replace(/''/g,'"'))}a.I.push({Xe:b,F:c,Wc:d,ga:e,oc:f})}function ri(a,b,c){var d=[],e=a.aa(b)>>>0;for(b=0;b<a.I.length;b++){var f=a.I[b],g=f.F>>>0,h=f.Wc;if(e>=g&&e<g+h){e=za(f.oc,[e-g],a.qc);0<=e?si(a,b,e,d):c&&(e=~e,si(a,b,e-1,d),si(a,b,e,d));break}}return d}
|
|
|
|
|
function si(a,b,c,d){var e={},f=a.I[b].oc,g=0,h=null;0<=c&&c<f.length&&(g=f[c][0],h=f[c][1]);h&&(e=a.I[b].ga[h],h="."==h.charAt(0)?null:e.l||h);d.push(h);d.push(g);d.push(e.a);d.push(e.c)}function ti(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return Ph(a)||a.j("no variables"),!0;if(!c[2])return Ph(a,c[1]);if(!c[3])return delete a.X[c[1]],!0;b=Lh(a,c[3]);return void 0!==b?(a.X[c[1]]=b,!0):!1}a.j("invalid assignment:"+b);return!1}
|
|
|
|
|
function ui(a,b,c){var d=null;if(b=$h(a,b,!0)){a.aa(b);var e=ri(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.F-e[1])&&(g=" + "+p(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.F)&&(g=" - "+p(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 gi(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=Lh(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.L=Y(d.u[7]);break;case "N":d.Z=f?32768:0;break;case "Z":d.$=
|
|
|
|
|
f?0:1;break;case "V":d.U=f?32768:0;break;case "C":d.T=f?65536:0;break;case "SW":if(a.B&&lc(a.B)){jc(a.B,f);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.C.oa();a.j("updated registers:")}a.j(qi(a));c&&(a.L=Y(d.u[7]),hi(a,J(a,a.L.F)))}}function vi(a,b){b=xa(b);var c=b.match(/^(['"])(.*?)\1$/);c?1<c[2].length?a.j(c[2]):Oh(a,null,c[2].charCodeAt(0)):Lh(a,b,!0)}
|
|
|
|
|
function wi(a,b,c){var d="t"!=b;c=Nh(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Sa(c,function(){return ub(a,!0)&&a.jb(e,d,!1)},function(){a.B&&a.B.stop&&a.B.stop();a.C.oa();ub(a,!1)})}
|
|
|
|
|
function hi(a,b,c,d){if(b=$h(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c)if("l"==c.charAt(0))c=Nh(a,c.substr(1)),null!=c&&(d=c);else{d=$h(a,c,!0);if(!d||d.F<b.F)return;e=d.F-b.F;if(256<e){a.j("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=vb(a,!1)||a.S?a.J:null;var g=null!=f?"cycles":null,h=ri(a,b),l=b.F;if(h[0]&&d&&(!c&&d||0>h[0].indexOf("+"))){var m=h[0]+":";h[2]&&(m+=" "+h[2]);a.j(m)}h[3]&&(g=h[3],f=null);f=ni(a,b,g,f);a.j(f);a.L=b;e-=b.F-l;c++}}}
|
|
|
|
|
function mi(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.j(">> "+b):(a.R&&(a.j("ended assemble at "+J(a,a.O.F)),a.L=a.O,a.R=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ia=null;if(wb(a)&&0<b.length){a.R&&(b="a "+J(a,a.O.F)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");g[0]=g[0].toLowerCase();if(g&&g.length)for(var h=g[0],l=h.charAt(0),m=1;m<h.length;m++){var n=h.charAt(m);if("?"==l||"r"==l||"a">n||"z"<n){g[0]=h.substr(m);g.unshift(h.substr(0,m));break}}switch(g[0].charAt(0)){case "a":var v=
|
|
|
|
|
$h(a,g[1],!0);if(v)if(a.O=v,void 0===g[2])a.j("begin assemble at "+J(a,v.F)),a.R=!0,a.C.oa();else{var r;a.j("not supported yet");r=[];if(r.length){for(var w=0;w<r.length;w++)a.Xb(v,r[w],1);a.j(ni(a,a.O))}}break;case "b":a:{var y=g[0],x=g[1],C=b;if("?"==x)a.j("breakpoint commands:"),a.j("\tbp [a]\tset exec breakpoint at addr [a]"),a.j("\tbr [a]\tset read breakpoint at addr [a]"),a.j("\tbw [a]\tset write breakpoint at addr [a]"),a.j("\tbc [a]\tclear breakpoint at addr [a]"),a.j("\tbl\tlist all breakpoints"),
|
|
|
|
|
a.j("\tbn [n]\tbreak after [n] instruction(s)");else{var ia=y.charAt(1);if("l"==ia){var Ja;Ja=0+li(a,a.f);Ja+=li(a,a.M);(Ja+=li(a,a.D))||a.j("no breakpoints")}else if("n"==ia)a.ta=Nh(a,x),a.j("break after "+a.ta+" instruction(s)");else if(void 0===x)a.j("missing breakpoint address");else{var P=Y();if("*"!=x&&(P=$h(a,x,!0),!P))break a;"c"==ia?null==P.F?(Rh(a),a.j("all breakpoints cleared")):ji(a,a.f,P)||ji(a,a.M,P)||ji(a,a.D,P)||a.j("breakpoint missing: "+J(a,P.F)):null!=P.F&&(di(a,P,C),"p"==ia?a.nb(a.f,
|
|
|
|
|
P):"r"==ia?a.nb(a.M,P):"w"==ia?a.nb(a.D,P):a.j("unknown breakpoint command: "+ia))}}}break;case "c":a.Ra&&(a.Ra.value="");break;case "d":a:{var hb,La=g[0],la=g[1],Ma=g[2],Pi=g[3];if("?"==la){var ib="";for(hb in Bb)a.Na[hb]&&(ib&&(ib+=","),ib+=hb);ib+=",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");
|
|
|
|
|
ib.length&&a.j("dump extension commands:\n\t"+ib)}else if("state"==la){var zg=xi(a.C,!0);"console"==Ma?console.log(zg):(a.Ra&&(a.Ra.value=""),a.j(zg))}else if("symbols"==la)for(var Jd=0;Jd<a.I.length;Jd++){var Kd=a.I[Jd],jb;for(jb in Kd.ga)if("."!=jb.charAt(0)){var Ag=Kd.ga[jb].o;if(void 0!==Ag){var Bg=Kd.ga[jb].l;Bg&&(jb=Bg);a.j(J(a,Ag)+" "+jb)}}}else{if("d"==La){for(hb in Bb)if(g[1]==hb){var Cg=a.Na[hb];Cg?(g.shift(),g.shift(),Cg(g)):a.j("no dump registered for "+la);break a}la||(La=a.Ub||"dw")}else a.Ub=
|
|
|
|
|
La;if("dh"==La){var Dg=la,Eg=Ma,Fg="",Gg=0,fa=a.ba,ma=a.H;if(ma.length){var Z=+Dg||a.tb,Nb=+Eg||10;isNaN(Z)?Z=Nb:Fg="more ";Z>ma.length&&(a.j("note: only "+ma.length+" available"),Z=ma.length);fa-=Z;0>fa&&(null==ma[ma.length-1].F?(Z=fa+Z,fa=0):fa+=ma.length);var Ld=[];"call"==Eg&&(Nb=1E5,Ld=["CALL"]);for(void 0!==Dg&&a.j(Z+" instructions earlier:");0<Nb&&fa!=a.ba;){var Hg=ma[fa++];if(null==Hg.F)break;var Ob=Y(Hg.F),Qi=Z--,Ig=ni(a,Ob,"history",Qi);(!Ld.length||0<=Ig.indexOf(Ld[0]))&&a.j(Ig);Ob.bc&&
|
|
|
|
|
(fa+=Ob.bc,Nb-=Ob.bc,Z-=Ob.bc);fa>=ma.length&&(fa=0);a.tb=Z;Gg++;Nb--}}Gg||(a.j("no "+Fg+"history available"),a.tb=void 0)}else{var kb=$h(a,la);if(kb){var Pb=0,Md=!1,Nd="ds"==La;Ma&&(Md=!0,"l"==Ma.charAt(0)&&(Md=!1,Ma=Ma.substr(1)||Pi),Pb=Nh(a,Ma)>>>0,65536<Pb&&(Pb=65536));for(var lb="dd"==La?4:"db"==La?1:2,Ec=(Md?Pb-kb.F:lb*Pb)||128,Od=Nd?16:a.ca,Ri=(Ec+Od-1)/Od|0||1,Na="";Ri--&&0<Ec;){var Oa="",Jg="",la=J(a,kb.F),Qb,mb,Rb=0,Sb=0;for(Qb=Od;0<Qb&&0<Ec;Qb-=mb,Ec-=mb){mb=1;var Fc=1==lb?a.Fb(kb,mb):
|
|
|
|
|
a.na(kb,mb=2),Rb=Rb|Fc<<(Sb<<3),Sb=Sb+mb;Sb==lb&&(Nd?(Oa&&(Oa+=","),Oa+="0x"+p(Rb,2*lb)):(Oa+=J(a,Rb,lb),Oa+=1==lb?9==Qb?"-":" ":" "),Rb=Sb=0);Jg+=32<=Fc&&128>Fc?String.fromCharCode(Fc):"."}Na&&(Na+="\n");Na=Nd?Na+(Oa+","):Na+(la+" "+Oa+(0==Qb?" "+Jg:""))}Na&&a.j(Na);a.lb=kb}}}}break;case "e":if("else"==g[0])break;var nb,Pd,Qd,Rd,Sd=g[0],Td=g[1];"eb"==Sd?(nb=1,Pd=255,Qd=a.Fb,Rd=a.Xb):"e"==Sd||"ew"==Sd?(nb=2,Pd=65535,Qd=a.na,Rd=a.hb):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 Gc=$h(a,Td);if(Gc)for(var Hc=2;Hc<g.length;Hc++){var Tb=Lh(a,g[Hc]);if(void 0===Tb){a.j("unrecognized value: "+g[Hc]);break}Tb&~Pd&&a.j("warning: "+p(Tb)+" exceeds "+nb+"-byte value");a.j("changing "+J(a,Gc.F)+(F(a,64)?"":" from "+J(a,Qd.call(a,Gc),nb))+" to "+J(a,Tb,nb));Rd.call(a,Gc,Tb,nb)}}break;case "g":a:{var Kg=g[1],Si=b;if(void 0!==Kg){var Ud=$h(a,Kg,!0);if(!Ud)break a;di(a,Ud,Si);a.nb(a.f,Ud,!0)}a.ib(!0,c)}break;case "h":a.w.W?(c||a.j("halting"),
|
|
|
|
|
a.fa()):vb(a,!0)||c||a.j("already halted");break;case "i":if("if"==g[0]){var Vd;var Ub=b.substr(2),Ub=xa(Ub);Lh(a,Ub)?(c||a.j("true: "+Ub),Vd=!0):(c||a.j("false: "+Ub),Vd=!1);Vd||(d=!1);break}f=!0;break;case "k":var Ti=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=Y(),Vb=Y(a.b.u[6]);for(a.j("stack trace for "+J(a,Vb.F));10>Wd;){for(var Pa=null,Ui=256;65536>Vb.F>>>0;){Xd.F=a.na(Vb,2);if(null==Vb.F||!Ui--)break;
|
|
|
|
|
if(!(Xd.F&1)){for(var Vi=a,Ic=Xd,Lg=null,Wb=Ic.F,Mg=Wb,Yd=1;6>=Yd&&Wb;Yd++){if(2<Yd){Ic.F=Wb;var Jc=ni(Vi,Ic);if(0<=Jc.indexOf("JSR")){var Ng=Jc.indexOf(" ");if(Wb+(Jc.indexOf(" ",Ng+1)-Ng-1)/2==Mg){Lg=Jc;break}}}Wb-=2}Ic.F=Mg;if(Pa=Lg)break}}if(!Pa||null==Pa)break;var Og=null;if("ks"==Ti){var Pg=Pa.match(/[0-9A-F]+$/);Pg&&(Og=ui(a,Pg[0]))}Pa=wa(Pa,50)+" ;"+(Og||"stack="+J(a,Vb.F));a.j(Pa);Wd++}Wd||a.j("no return addresses found")}break;case "l":if("ln"==g[0]){ui(a,g[1],!0);break}f=!0;break;case "m":a:{var na,
|
|
|
|
|
oa=null,G=g[1];"?"==G&&(G=void 0);if(void 0!==G){var Ca=0;if("all"==G)Ca=1878917119,G=null;else if("on"==G)oa=!0,G=null;else if("off"==G)oa=!1,G=null;else{"keys"==G&&(G="key");"kbd"==G&&(G="keyboard");for(na in Bb)if(G==na){Ca=Bb[na];oa=!!(a.ma&Ca);break}if(!Ca){a.j("unknown message category: "+G);break a}}if(Ca)if("on"==g[2])a.ma|=Ca,oa=!0;else if("off"==g[2]&&(a.ma&=~Ca,oa=!1,1073741824==Ca)){for(var Zd=0;Zd<a.va.length;Zd++)a.j(a.va[Zd]);a.va=[]}}var Wi=0,Xb="";for(na in Bb)if(!G||G==na){var Xi=
|
|
|
|
|
!!(a.ma&Bb[na]);if(null===oa||oa==Xi)Xb&&(Xb+=","),++Wi%10||(Xb+="\n\t"),"key"==na&&(na="keys"),Xb+=na}void 0===G&&a.j("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.j((null!==oa?oa?"messages on: ":"messages off: ":"message categories:\n\t")+(Xb||"none"));Sh(a)}break;case "p":if("print"==g[0]){vi(a,b.substr(5));break}var Yi="pr"==g[0]?1:0;if(a.S)a.j("step in progress");else{var Qg=Y(a.b.u[7]);a.Fb(Qg);a.S?(a.nb(a.f,Qg,!0),a.ib()||(a.C&&a.C.rb(),a.S=0)):wi(a,Yi?"tr":"t")}break;
|
|
|
|
|
case "r":if("reset"==b){a.C&&a.C.reset();break}gi(a,g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var Yb=+g[2];if(8==Yb||10==Yb||16==Yb)a.ca=Yb;else{a.j("invalid base: "+Yb);break}}a.j("default base: "+a.ca);break;case "cs":var Zb;void 0!==g[3]&&(Zb=+g[3]);switch(g[2]){case "int":a.b.wb=Zb;break;case "start":a.b.Ib=Zb;break;case "stop":a.b.xb=Zb;break;default:a.j("unknown cs option");break a}void 0!==Zb&&pd(a.b);a.j("checksums "+(a.b.w.vb?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&
|
|
|
|
|
(td(a.b,+g[2])||a.j("warning: using 1x multiplier, previous target not reached"));a.j("target speed: "+(a.b.ob.toFixed(2)+"Mhz")+" ("+a.b.eb+"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":wi(a,
|
|
|
|
|
g[0],g[1]);break;case "u":hi(a,g[1],g[2],8);break;case "v":if("var"==g[0]){ti(a,b.substr(3))||(d=!1);break}if("ver"==g[0]){a.j("PDPjs version 1.30.3 ("+a.b.cb+",RELEASE"+(zb?",TYPEDARRAYS":",LONGARRAYS")+")");a.j(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){vi(a,b.substr(1));break}var $d="commands:",ae;for(ae in Uh)$d+="\n"+wa(ae,9)+Uh[ae];ue(a)||($d+="\nnote: history disabled if no exec breakpoints");a.j($d);break;default:f=!0}f&&(a.j("unknown command: "+b),d=!1)}}catch(Rg){a.j("debugger error: "+
|
|
|
|
|
(Rg.stack||Rg.message)),d=!1}return d}function rd(a,b,c){b=Jh(a,b,c);for(var d in b)if(!mi(a,b[+d]))return!1;return!0}Za(function(){for(var a=D(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Qh(d);B(d,c)}});
|
|
|
|
|
function yi(a,b,c){t.call(this,"Computer",a,yi,67108864);this.w.ha=!1;zi(this,b);this.L=nd(this,"autoPower",a);this.C=0;this.X=a.busWidth||a.buswidth;this.f=Ai;this.I=null;this.D=this.R=!1;this.ba=nd(this,"url")||"";(Math.random()+.1).toString(36);this.g=Bi(this);if(this.b=tb("CPU",this.id)){this.i=tb("Debugger",this.id);this.v=new nc({id:this.Qa+".bus",busWidth:this.X},this.b,this.i);var d,e=rb(this.id);if((this.B=tb("Panel",this.id))&&this.B.Ra)for(b=0;b<e.length;b++)d=e[b],d.P=this.B.P,d.j=this.B.j,
|
|
|
|
|
d.Ra=this.B.Ra;this.j("PDPjs v1.30.3\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.j("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.Ea&&d.Ea(this,this.v,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=nd(this,"state")||(f=!0,a.state))b=this.M=a,f||(this.D=!0,this.f=Ai),this.f&&(this.J=
|
|
|
|
|
new N(this,"1.30.3"),Ci(this.J)?b=null:delete this.J);!b&&this.f&&(b=Di(this))&&(this.D=!0);if(b){var g=this;Da(b,null,!0,function(a,b,c){c?(g.H=null,g.D=!1,g.P("Unable to load machine state from server (error "+c+(b?": "+xa(b):"")+")")):(g.I=b,g.R=!0);H(g)})}else H(this);this.G.power||(this.L=!0);!c&&this.L&&Ei(this,this.Jb)}else q("Unable to find CPU component")}z(yi);var Ai=0;
|
|
|
|
|
function zi(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){q(d.message+" ("+c+")")}}a.S=b}function nd(a,b,c){var d=b.toLowerCase(),d=db[b]||db[d];void 0===d&&a.S&&(d=a.S[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Ei(a,b,c){for(var d=rb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!wb(f)){wb(f,function(){Ei(a,b,c)});return}}b.call(a,c)}
|
|
|
|
|
function Fi(a,b){var c=new N(a,"1.30.3","validate");if(Ci(c)&&Gi(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.P("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}k=yi.prototype;
|
|
|
|
|
k.Jb=function(a){void 0===a&&(a=this.f||(this.I?1:Ai));if(!this.C){this.C++;var b=!1,c=!1;this.O=!1;var d=this.J||new N(this,"1.30.3");if(-1==a)b=!0;else if(a>Ai){if(Ci(d,this.I)){this.A=new N(this,"1.30.3","failsafe");Ci(this.A)&&(Hi(this,d),a=2,Ii(this.A));this.A.set("timestamp",Ba());Ji(this.A);var e=this.f&&!this.D;if(1==a||Ga("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=Gi(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Ci(d,g):("error"==
|
|
|
|
|
f&&"no machine state"!=g?(this.P("Error: "+g),"unable to verify user"==g&&(Qa("user",""),this.g=null)):this.j(f+": "+g),Ii(d),Ci(d)?(c=Gi(d),e=!0):c=!1))}e&&Fi(this,c?d:null)}else 2==a&&d.clear()}else Fi(this);delete this.I;delete this.J}e=rb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=Ki(this,g,d,b,c));b=[d,a,c];-1!=a?Ei(this,this.rc,b):this.rc(b)}};
|
|
|
|
|
function Ki(a,b,c,d,e){if(!b.w.ha){b.w.ha=!0;if(b.Ga){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.Ga(f,d)&&f&&(q("Unable to restore state for "+b.type),a.M&&!a.R?(c.clear(),a.f=Ai,window&&window.location.reload()):a.O=!0,b.Ga(null),e=!1)}if(!d&&b.tc)for(a=b.tc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
|
|
|
|
k.rc=function(a){var b=a[0],c=0>a[1];a=a[2];this.ca=!0;this.w.ha=!0;var d=this.G.power;d&&(d.textContent="Shutdown");this.b&&(Ki(this,this.b,b,c,a),this.oa(),this.b.sb());this.O&&(Hi(this,b),b.clear());!c&&this.A&&(this.A.clear(),delete this.A);this.C=0};
|
|
|
|
|
function Hi(a,b){if(Ga("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.g||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.3"};d.url=a.ba;d.user=c;d.type="bug";d.data=b;Da("http://www.pcjs.org/api/v1/report",d,!0)}}
|
|
|
|
|
function xi(a,b,c){var d,e="none";if(a.C)return null;a.C--;var f=new N(a,"1.30.3"),g=new N(a,"1.30.3","validate"),h=Ba();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.30.3");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.Fa&&(c&&a.b.fa(),d=a.b.Fa(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.w.ha=!1,!1===d&&(e=null)));for(var h=rb(a.id),l=0;l<h.length;l++){var m=h[l];m.w.ha&&(m.Fa&&(d=m.Fa(b,c),"object"===typeof d&&f.set(m.id,
|
|
|
|
|
d)),c&&(m.w.ha=!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.g&&Li(a,a.g,f.toString()),Ji(g)&&Ji(f)||(e=null,d=h=!0)):a.f&&(d=!0,h=3==a.f),d&&f.clear(h)):e=f.toString());c&&(a.w.ha=!1,b=a.G.power)&&(b.textContent="Power");a.C=0;return e}
|
|
|
|
|
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]}},Wh=[0],Xh=
|
|
|
|
|
[58,60,65,96,108,110,100,101,102,103,104,105,59,64];k=Ph.prototype;
|
|
|
|
|
k.Ea=function(a,b,c,d){this.v=b;this.C=a;this.b=c;this.B=a.B;(a=nd(a,"messages"))&&Sh(this,a);this.tb=Vh;this.Eb=1145>this.b.cb?Xh:[];Yh(this,function(a){a:{var b=d.v.Y,c=a[0],e=a=0,l=b.length;if(c){a=d.ba(Zh(d,c));if(-1===a){d.j("invalid address: "+c);break a}e=a>>>d.v.ja;l=1}d.j("blockid physical blockaddr used size type");d.j("-------- --------- ---------- ------ ------ ----");for(var c=-1,m=0;l--;){var n=b[e];n.type==c?m++||d.j("..."):(c=n.type,m=Cc[c],n&&d.j(p(n.id,8)+" %"+
|
|
|
|
|
p(e<<d.v.ja,8)+" %%"+p(n.F,8)+" "+p(n.Nb,4,!0)+" "+p(n.size,4,!0)+" "+m),c!=$c&&(c=-1),m=0);a+=d.v.za;e++}}});H(this)};
|
|
|
|
|
k.sa=function(a,b,c){var d=this;switch(b){case "debugInput":return this.ka=this.G[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",rd(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.G[b]=c,Ta(c,function(){if(d.ka){var a=d.ka.value;
|
|
|
|
|
d.ka.value="";rd(d,a,!0);return!0}return!1}),!0;case "step":return this.G[b]=c,Ta(c,function(a){var b=!1;vb(d,!0)||(ub(d,!0),b=d.ib(a?1:0),ub(d,!1));return b}),!0}return!1};k.rb=function(a){if(this.ka){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.ka.focus();!a&&window&&window.scrollTo(b,c)}};k.ba=function(a){a=a&&a.F;null==a&&(a=-1);return a};k.Gb=function(a,b){var c=255,d=this.ba(a,!1,1);-1!==d&&(c=a.Qb?this.v.Tb(d):this.b.Tb(d),b&&$h(a,b));return c};
|
|
|
|
|
k.na=function(a,b){var c=65535,d=this.ba(a,!1,2);-1!==d&&(c=a.Qb?this.v.bb(d):this.b.bb(d),b&&$h(a,b));return c};k.Ab=function(a,b,c){var d=this.ba(a,!0,1);-1!==d&&(a.Qb?this.v.qb(d,b):this.b.qb(d,b),c&&$h(a,c),this.C.oa(-1))};k.gb=function(a,b,c){var d=this.ba(a,!0,2);-1!==d&&(a.Qb?this.v.Bb(d,b):this.b.Bb(d,b),c&&$h(a,c),this.C.oa(-1))};function Y(a,b){return{F:a,Qb:b,Oa:!1}}k.kc=function(a,b){a.F=b;a.Oa=!1;return a};function ai(a){return[a.F,a.Oa]}function bi(a){return{F:a[0],Oa:a[1]}}
|
|
|
|
|
function Zh(a,b,c){var d,e=(c?a.L:a.kb).F;c=!1;if(void 0!==b){b=Lh(a,b);"%"==b.charAt(0)&&(c=!0,b=b.substr(1));d=b;var f;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),e=0;e<a.I.length;e++){var g=a.I[e].ga[d];if(void 0!==g){d=g.o;void 0!==d&&(f=Y(d));break}}if(d=f)return d;e=Kh(a,b,void 0)}null!=e&&(d=Y(e,c));return d}function ci(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Mc=Ih(a,b.Hc=c[2]))}function $h(a,b){null!=a.F&&(a.F+=b||1)}
|
|
|
|
|
function Sh(a,b){a.i=a;a.ma=a.Qc=536870912;a.ia=null;a.va=[];b=Ih(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in Bb){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.ma|=Bb[c],a.j(c+" messages enabled"))}}function Yh(a,b){for(var c in Bb)if(64==Bb[c]){a.Ja[c]=b;break}}
|
|
|
|
|
k.uc=function(a){var b=-1;a=a.toUpperCase();switch(a){case "SP":b=6;break;case "PC":b=7;break;case "SW":b=21;break;default:"R"==a.charAt(0)&&(b=+a.charAt(1),0>b||7<b)&&(b=-1)}return b};function di(a){return 6>a?"R"+a:6==a?"SP":"PC"}k.vc=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Wa[a-8]:20>a?b=this.b.Ia[a-16]:20==a?b=Tc(this.b):21==a&&this.B&&lc(this.B)&&(b=this.B.Va));return b};
|
|
|
|
|
k.message=function(a,b){b&&(a+=" @"+J(this,Y(this.b.Hb).F));this.ma&1073741824?this.va.push(a):this.ia&&a==this.ia||(this.ia=a,this.ma&-2147483648&&this.b&&this.b.w.W&&(this.fa(),a+=" (cpu halted)"),this.j(a),this.b&&(a=this.b,vd(a),a.wa=0,a.oa()))};function Rh(a){var b;if(!te(a))a.H&&a.H.length&&a.j("instruction history buffer freed"),a.$=0,a.H=[];else if(!a.H||!a.H.length){a.H=Array(1E3);for(b=0;b<a.H.length;b++)a.H[b]=Y();a.$=0;a.j("instruction history buffer allocated")}}
|
|
|
|
|
k.hb=function(a,b){if(!ei(this,b))return!1;this.b.hb(a);return!0};k.ib=function(a,b,c){if(!ei(this))return!1;this.J=0;a||te(this)&&ue(this,this.b.u[7],0);try{a=wd(this.b,a);var d=this.b.ib(a);0<d&&(dc(this.b,d),this.J+=d,ec(this.b,d,!0),fc(this.b,d),this.wa++)}catch(e){"number"!=typeof e&&(this.J=0,yb(this.b,e.stack||e.message))}!1!==c&&this.C.oa(-1);qd(this,b||!1);return 0<this.J};k.fa=function(a){this.b&&this.b.fa(a)};
|
|
|
|
|
function qd(a,b){if(a.jb){void 0===b&&(b=!0);var c;c=a.b;if(c=c.K&8?c.jd|c.Zc<<8:0){var d=c>>8;a.j("trapped to "+J(a,c&255,1)+" ("+(0>d?Ab[-d]:J(a,d))+")")}a.L=Y(a.b.u[7]);b&&1!=a.S?fi(a):gi(a)}}function ei(a,b){var c;(c=!a.b||!wb(a.b))||(c=a.b,c.w.ha?c=!0:(c.j(c.toString()+" not powered"),c=!1),c=!c);return c||a.b.w.W?(b||a.j("cpu busy or unavailable, command ignored"),!1):!xb(a.b)}k.Ga=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};
|
|
|
|
|
k.Fa=function(a,b){b&&this.j(a?"suspending":"shutting down");return a?this.save():!0};k.reset=function(a){Rh(this);this.wa=0;this.ia=null;this.J=0;this.L=Y(this.b.u[7]);this.w.W=!1;hi(this);a||qd(this)};k.save=function(){var a=new N(this);a.set(0,ai(this.L));a.set(1,ai(this.O));a.set(2,[this.g,this.R,this.ma]);a.set(3,this.I);return a.data()};
|
|
|
|
|
k.restore=function(a){var b=0;void 0!==a[2]&&(this.L=bi(a[b++]),this.O=bi(a[b++]),this.g=a[b][0],"string"==typeof this.g&&(this.g=[this.g]),this.R=a[b][1],this.ma|=a[b][2]);a[3]&&(this.I=a[3]);return!0};k.start=function(a,b){this.S||this.j("running");this.w.W=!0;this.Fb=a;this.Rb=b};
|
|
|
|
|
k.stop=function(a,b){if(this.w.W){this.w.W=!1;this.J=b-this.Rb;if(!this.S){b="stopped";if(this.J){a-=this.Fb;var c=0<a?Math.round(1E3*this.J/a):0;b+=" (";te(this)&&(b+=this.wa+" instructions, ",this.wa=0);b+=this.J+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.j(b)}qd(this,!0);this.rb();hi(this,this.b.u[7]);this.ia=null}};function te(a){return 1<a.f.length||!!a.pa}
|
|
|
|
|
function ue(a,b,c){var d=-1;c||(d=a.b.bb(b),0==d&&(b=Fd(a.b,2)));if(0<c&&(a.pa&&!--a.pa||id(a,b,1,a.f)))return!0;0<=c&&a.H.length&&(a.wa++,0>d&&(d=a.b.bb(b)),65535!=(d&65535)&&(a.kc(a.H[a.$],b),++a.$==a.H.length&&(a.$=0)));return!1}function zf(a){var b=a.b;if(b.w.W)throw O(b,a.b.Hb),a.fa(),-1;return!1}
|
|
|
|
|
function Qh(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.v;c=a.ba(c);jd(d.Y[c>>>d.ja],!1)}a.M=["br"];if(a.D)for(b=1;b<a.D.length;b++)c=a.D[b],d=a.v,c=a.ba(c),jd(d.Y[c>>>d.ja],!0);a.D=["bw"];a.lb=0}k.mb=function(a,b,c){var d=!0;c||ii(this,a,b,!1,!0);if(a!=this.f){var e=this.ba(b);if(-1===e)this.j("invalid address: "+J(this,b.F)),d=!1;else{var f=this.v;f.Y[e>>>f.ja].mb(e&f.v,a==this.D)}}d&&(a.push(b),c?b.Oa=!0:(ji(this,a,a.length-1,"set"),Rh(this)));return d};
|
|
|
|
|
function ii(a,b,c,d,e){var f=!1;c=a.ba(c);for(var g=1;g<b.length;g++){var h=b[g];if(c==a.ba(h)&&(!d||h.Oa)){f=!0;h.Oa||e||ji(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.v,jd(d.Y[c>>>d.ja],b==a.D));h.Oa||Rh(a);break}}return f}function ki(a,b){for(var c=1;c<b.length;c++)ji(a,b,c);return b.length-1}function ji(a,b,c,d){c=b[c];a.j(b[0]+" "+J(a,c.F)+(d?" "+d:c.Hc?' "'+c.Hc+'"':""))}
|
|
|
|
|
function hi(a,b){if(void 0!==b)id(a,b,1,a.f,!0),a.S=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Oa){if(!ii(a,a.f,c,!0))break;b=0}}}
|
|
|
|
|
function id(a,b,c,d,e){var f=!1;if(!a.lb++)for(var g=1;!f&&g<d.length;g++){var h=d[g];if(!e||h.Oa)for(var l=a.ba(h)&65535,m=0;m<c;m++)if(b+m==l){var n,f=!0;h.Oa&&(ii(a,d,h,!0),e=!0);if(n=h.Mc){for(var f=!1,v=0;v<n.length;v++)if(!li(a,n[v],!0)){if(n[v].indexOf("if")){f=!0;break}for(var r=v+1;r<n.length&&n[r].indexOf("else");r++)v++;if(r==n.length){f=!0;break}}a.b.w.W||(f=!0)}if(f){e||ji(a,d,g,"hit");break}}}a.lb--;return f}
|
|
|
|
|
function mi(a,b,c,d){var e=Y(b.F),f=a.na(b,2),g,h;for(h in a.tb)if(g=a.tb[h][f&h])break;g||(g=Wh);var l=g[0];0<=a.Eb.indexOf(l)&&(g=Wh,l=g[0]);var m=h="",n=Uh[l],v=g.length-1;l||v||(h=J(a,f));for(l=1;l<=v;l++){var r=g[l];if(void 0!==r){var w;w=a;var y=r,r=b,x="",C=y&61440;if(4096==C)r=r.F+((f&255)<<24>>23)&65535,x=J(w,r);else if(8192==C)r=r.F-((f&63)<<1)&65535,x=J(w,r);else if(12288==C)x=J(w,f&7,1);else if(24576==C)x=J(w,f&63,1);else if(32768==C)x=J(w,f&255,1);else if(C=f&y,y&4032&&(C>>=6,y>>=6),
|
|
|
|
|
y&63)switch(y=C&7,C&56){case 0:x=di(y);break;case 8:x="@"+di(y);break;case 16:7>y?x="("+di(y)+")+":(C=w.na(r,2),x="#"+J(w,C,0,!0));break;case 24:7>y?x="@("+di(y)+")+":(C=w.na(r,2),x="@#"+J(w,C,0,!0));break;case 32:x="-("+di(y)+")";break;case 40:x="@-("+di(y)+")";break;case 48:C=w.na(r,2);x=J(w,C,0,!0)+"("+di(y)+")";7==y&&(x=J(w,C+r.F&65535));break;case 56:C=w.na(r,2),x="@"+J(w,C)+"("+di(y)+")",7==y&&(x="@"+J(w,C+r.F&65535))}w=x;if(!w||!w.length){h="INVALID";break}"string"!=typeof w&&(m=w[1],w=w[0]);
|
|
|
|
|
0<h.length&&(h+=",");h+=w||"???"}}f="";g=J(a,e.F)+":";if(-1!==e.F&&-1!==b.F){do if(f+=" "+J(a,a.na(e,2)),null==e.F)break;while(e.F!=b.F)}g+=wa(f,24);g+=wa(n,5);h&&(g+=" "+h);if(c||m)g=wa(g,60)+";"+(c||""),g=a.b.w.ub?g+("cycles="+sd(a.b).toString()+" cs="+p(a.b.Jb)):g+(null!=d?"="+d.toString():""),m&&(g+=" @"+m);return g}function ni(a,b){switch(b){case "N":a=a.b.Ta();break;case "Z":a=Dd(a.b);break;case "V":a=Cd(a.b);break;case "C":a=Bd(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
|
|
|
|
|
function oi(a,b){var c="",d=a.b;8>b?(c=di(b),c+="="+J(a,d.u[b])):13>b?c="A"+(b-8)+"="+J(a,d.Wa[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+J(a,d.Ia[b-16]):20==b?c="PS="+J(a,Tc(d)):21==b&&a.B&&lc(a.B)&&(c="SW="+J(a,a.B.Va,3));c&&(c+=" ");return c}function pi(a){var b,c="";for(b=0;6>b;b++)c+=oi(a,b);c=c+"\n"+(oi(a,6)+oi(a,7));c+=oi(a,20)+oi(a,21);return c+=ni(a,"T")+ni(a,"N")+ni(a,"Z")+ni(a,"V")+ni(a,"C")}k.pc=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
|
|
|
|
|
function Rg(a,b,c,d,e){var f=[],g;for(g in e){var h=e[g];"number"==typeof h&&(e[g]=h={o:h});var l=h.o,m=h.a;if(void 0!==l){var n=f,l=[l>>>0,g],v=za(n,l,a.pc);0>v&&n.splice(-(v+1),0,l)}m&&(h.a=m.replace(/''/g,'"'))}a.I.push({Ze:b,F:c,Wc:d,ga:e,nc:f})}function qi(a,b,c){var d=[],e=a.ba(b)>>>0;for(b=0;b<a.I.length;b++){var f=a.I[b],g=f.F>>>0,h=f.Wc;if(e>=g&&e<g+h){e=za(f.nc,[e-g],a.pc);0<=e?ri(a,b,e,d):c&&(e=~e,ri(a,b,e-1,d),ri(a,b,e,d));break}}return d}
|
|
|
|
|
function ri(a,b,c,d){var e={},f=a.I[b].nc,g=0,h=null;0<=c&&c<f.length&&(g=f[c][0],h=f[c][1]);h&&(e=a.I[b].ga[h],h="."==h.charAt(0)?null:e.l||h);d.push(h);d.push(g);d.push(e.a);d.push(e.c)}function si(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return Oh(a)||a.j("no variables"),!0;if(!c[2])return Oh(a,c[1]);if(!c[3])return delete a.X[c[1]],!0;b=Kh(a,c[3]);return void 0!==b?(a.X[c[1]]=b,!0):!1}a.j("invalid assignment:"+b);return!1}
|
|
|
|
|
function ti(a,b,c){var d=null;if(b=Zh(a,b,!0)){a.ba(b);var e=qi(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.F-e[1])&&(g=" + "+p(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.F)&&(g=" - "+p(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 fi(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=Kh(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.L=Y(d.u[7]);break;case "N":d.Z=f?32768:0;break;case "Z":d.aa=
|
|
|
|
|
f?0:1;break;case "V":d.U=f?32768:0;break;case "C":d.T=f?65536:0;break;case "SW":if(a.B&&lc(a.B)){jc(a.B,f);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.C.oa();a.j("updated registers:")}a.j(pi(a));c&&(a.L=Y(d.u[7]),gi(a,J(a,a.L.F)))}}function ui(a,b){b=xa(b);var c=b.match(/^(['"])(.*?)\1$/);c?1<c[2].length?a.j(c[2]):Nh(a,null,c[2].charCodeAt(0)):Kh(a,b,!0)}
|
|
|
|
|
function vi(a,b,c){var d="t"!=b;c=Mh(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Sa(c,function(){return ub(a,!0)&&a.ib(e,d,!1)},function(){a.B&&a.B.stop&&a.B.stop();a.C.oa();ub(a,!1)})}
|
|
|
|
|
function gi(a,b,c,d){if(b=Zh(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c)if("l"==c.charAt(0))c=Mh(a,c.substr(1)),null!=c&&(d=c);else{d=Zh(a,c,!0);if(!d||d.F<b.F)return;e=d.F-b.F;if(256<e){a.j("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=vb(a,!1)||a.S?a.J:null;var g=null!=f?"cycles":null,h=qi(a,b),l=b.F;if(h[0]&&d&&(!c&&d||0>h[0].indexOf("+"))){var m=h[0]+":";h[2]&&(m+=" "+h[2]);a.j(m)}h[3]&&(g=h[3],f=null);f=mi(a,b,g,f);a.j(f);a.L=b;e-=b.F-l;c++}}}
|
|
|
|
|
function li(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.j(">> "+b):(a.R&&(a.j("ended assemble at "+J(a,a.O.F)),a.L=a.O,a.R=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ia=null;if(wb(a)&&0<b.length){a.R&&(b="a "+J(a,a.O.F)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");g[0]=g[0].toLowerCase();if(g&&g.length)for(var h=g[0],l=h.charAt(0),m=1;m<h.length;m++){var n=h.charAt(m);if("?"==l||"r"==l||"a">n||"z"<n){g[0]=h.substr(m);g.unshift(h.substr(0,m));break}}switch(g[0].charAt(0)){case "a":var v=
|
|
|
|
|
Zh(a,g[1],!0);if(v)if(a.O=v,void 0===g[2])a.j("begin assemble at "+J(a,v.F)),a.R=!0,a.C.oa();else{var r;a.j("not supported yet");r=[];if(r.length){for(var w=0;w<r.length;w++)a.Ab(v,r[w],1);a.j(mi(a,a.O))}}break;case "b":a:{var y=g[0],x=g[1],C=b;if("?"==x)a.j("breakpoint commands:"),a.j("\tbp [a]\tset exec breakpoint at addr [a]"),a.j("\tbr [a]\tset read breakpoint at addr [a]"),a.j("\tbw [a]\tset write breakpoint at addr [a]"),a.j("\tbc [a]\tclear breakpoint at addr [a]"),a.j("\tbl\tlist all breakpoints"),
|
|
|
|
|
a.j("\tbn [n]\tbreak after [n] instruction(s)");else{var ia=y.charAt(1);if("l"==ia){var Ja;Ja=0+ki(a,a.f);Ja+=ki(a,a.M);(Ja+=ki(a,a.D))||a.j("no breakpoints")}else if("n"==ia)a.pa=Mh(a,x),a.j("break after "+a.pa+" instruction(s)");else if(void 0===x)a.j("missing breakpoint address");else{var P=Y();if("*"!=x&&(P=Zh(a,x,!0),!P))break a;"c"==ia?null==P.F?(Qh(a),a.j("all breakpoints cleared")):ii(a,a.f,P)||ii(a,a.M,P)||ii(a,a.D,P)||a.j("breakpoint missing: "+J(a,P.F)):null!=P.F&&(ci(a,P,C),"p"==ia?a.mb(a.f,
|
|
|
|
|
P):"r"==ia?a.mb(a.M,P):"w"==ia?a.mb(a.D,P):a.j("unknown breakpoint command: "+ia))}}}break;case "c":a.Ra&&(a.Ra.value="");break;case "d":a:{var hb,La=g[0],la=g[1],Ma=g[2],Oi=g[3];if("?"==la){var ib="";for(hb in Bb)a.Ja[hb]&&(ib&&(ib+=","),ib+=hb);ib+=",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");
|
|
|
|
|
ib.length&&a.j("dump extension commands:\n\t"+ib)}else if("state"==la){var yg=wi(a.C,!0);"console"==Ma?console.log(yg):(a.Ra&&(a.Ra.value=""),a.j(yg))}else if("symbols"==la)for(var Jd=0;Jd<a.I.length;Jd++){var Kd=a.I[Jd],jb;for(jb in Kd.ga)if("."!=jb.charAt(0)){var zg=Kd.ga[jb].o;if(void 0!==zg){var Ag=Kd.ga[jb].l;Ag&&(jb=Ag);a.j(J(a,zg)+" "+jb)}}}else{if("d"==La){for(hb in Bb)if(g[1]==hb){var Bg=a.Ja[hb];Bg?(g.shift(),g.shift(),Bg(g)):a.j("no dump registered for "+la);break a}la||(La=a.Ub||"dw")}else a.Ub=
|
|
|
|
|
La;if("dh"==La){var Cg=la,Dg=Ma,Eg="",Fg=0,fa=a.$,ma=a.H;if(ma.length){var Z=+Cg||a.nb,Ob=+Dg||10;isNaN(Z)?Z=Ob:Eg="more ";Z>ma.length&&(a.j("note: only "+ma.length+" available"),Z=ma.length);fa-=Z;0>fa&&(null==ma[ma.length-1].F?(Z=fa+Z,fa=0):fa+=ma.length);var Ld=[];"call"==Dg&&(Ob=1E5,Ld=["CALL"]);for(void 0!==Cg&&a.j(Z+" instructions earlier:");0<Ob&&fa!=a.$;){var Gg=ma[fa++];if(null==Gg.F)break;var Pb=Y(Gg.F),Pi=Z--,Hg=mi(a,Pb,"history",Pi);(!Ld.length||0<=Hg.indexOf(Ld[0]))&&a.j(Hg);Pb.ac&&(fa+=
|
|
|
|
|
Pb.ac,Ob-=Pb.ac,Z-=Pb.ac);fa>=ma.length&&(fa=0);a.nb=Z;Fg++;Ob--}}Fg||(a.j("no "+Eg+"history available"),a.nb=void 0)}else{var kb=Zh(a,la);if(kb){var Qb=0,Md=!1,Nd="ds"==La;Ma&&(Md=!0,"l"==Ma.charAt(0)&&(Md=!1,Ma=Ma.substr(1)||Oi),Qb=Mh(a,Ma)>>>0,65536<Qb&&(Qb=65536));for(var lb="dd"==La?4:"db"==La?1:2,Fc=(Md?Qb-kb.F:lb*Qb)||128,Od=Nd?16:a.ca,Qi=(Fc+Od-1)/Od|0||1,Na="";Qi--&&0<Fc;){var Oa="",Ig="",la=J(a,kb.F),Rb,mb,Sb=0,Tb=0;for(Rb=Od;0<Rb&&0<Fc;Rb-=mb,Fc-=mb){mb=1;var Gc=1==lb?a.Gb(kb,mb):a.na(kb,
|
|
|
|
|
mb=2),Sb=Sb|Gc<<(Tb<<3),Tb=Tb+mb;Tb==lb&&(Nd?(Oa&&(Oa+=","),Oa+="0x"+p(Sb,2*lb)):(Oa+=J(a,Sb,lb),Oa+=1==lb?9==Rb?"-":" ":" "),Sb=Tb=0);Ig+=32<=Gc&&128>Gc?String.fromCharCode(Gc):"."}Na&&(Na+="\n");Na=Nd?Na+(Oa+","):Na+(la+" "+Oa+(0==Rb?" "+Ig:""))}Na&&a.j(Na);a.kb=kb}}}}break;case "e":if("else"==g[0])break;var nb,Pd,Qd,Rd,Sd=g[0],Td=g[1];"eb"==Sd?(nb=1,Pd=255,Qd=a.Gb,Rd=a.Ab):"e"==Sd||"ew"==Sd?(nb=2,Pd=65535,Qd=a.na,Rd=a.gb):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 Hc=Zh(a,Td);if(Hc)for(var Ic=2;Ic<g.length;Ic++){var Ub=Kh(a,g[Ic]);if(void 0===Ub){a.j("unrecognized value: "+g[Ic]);break}Ub&~Pd&&a.j("warning: "+p(Ub)+" exceeds "+nb+"-byte value");a.j("changing "+J(a,Hc.F)+(F(a,64)?"":" from "+J(a,Qd.call(a,Hc),nb))+" to "+J(a,Ub,nb));Rd.call(a,Hc,Ub,nb)}}break;case "g":a:{var Jg=g[1],Ri=b;if(void 0!==Jg){var Ud=Zh(a,Jg,!0);if(!Ud)break a;ci(a,Ud,Ri);a.mb(a.f,Ud,!0)}a.hb(!0,c)}break;case "h":a.w.W?(c||a.j("halting"),
|
|
|
|
|
a.fa()):vb(a,!0)||c||a.j("already halted");break;case "i":if("if"==g[0]){var Vd;var Vb=b.substr(2),Vb=xa(Vb);Kh(a,Vb)?(c||a.j("true: "+Vb),Vd=!0):(c||a.j("false: "+Vb),Vd=!1);Vd||(d=!1);break}f=!0;break;case "k":var Si=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=Y(),Wb=Y(a.b.u[6]);for(a.j("stack trace for "+J(a,Wb.F));10>Wd;){for(var Pa=null,Ti=256;65536>Wb.F>>>0;){Xd.F=a.na(Wb,2);if(null==Wb.F||!Ti--)break;
|
|
|
|
|
if(!(Xd.F&1)){for(var Ui=a,Jc=Xd,Kg=null,Xb=Jc.F,Lg=Xb,Yd=1;6>=Yd&&Xb;Yd++){if(2<Yd){Jc.F=Xb;var Kc=mi(Ui,Jc);if(0<=Kc.indexOf("JSR")){var Mg=Kc.indexOf(" ");if(Xb+(Kc.indexOf(" ",Mg+1)-Mg-1)/2==Lg){Kg=Kc;break}}}Xb-=2}Jc.F=Lg;if(Pa=Kg)break}}if(!Pa||null==Pa)break;var Ng=null;if("ks"==Si){var Og=Pa.match(/[0-9A-F]+$/);Og&&(Ng=ti(a,Og[0]))}Pa=wa(Pa,50)+" ;"+(Ng||"stack="+J(a,Wb.F));a.j(Pa);Wd++}Wd||a.j("no return addresses found")}break;case "l":if("ln"==g[0]){ti(a,g[1],!0);break}f=!0;break;case "m":a:{var na,
|
|
|
|
|
oa=null,G=g[1];"?"==G&&(G=void 0);if(void 0!==G){var Ca=0;if("all"==G)Ca=1878917119,G=null;else if("on"==G)oa=!0,G=null;else if("off"==G)oa=!1,G=null;else{"keys"==G&&(G="key");"kbd"==G&&(G="keyboard");for(na in Bb)if(G==na){Ca=Bb[na];oa=!!(a.ma&Ca);break}if(!Ca){a.j("unknown message category: "+G);break a}}if(Ca)if("on"==g[2])a.ma|=Ca,oa=!0;else if("off"==g[2]&&(a.ma&=~Ca,oa=!1,1073741824==Ca)){for(var Zd=0;Zd<a.va.length;Zd++)a.j(a.va[Zd]);a.va=[]}}var Vi=0,Yb="";for(na in Bb)if(!G||G==na){var Wi=
|
|
|
|
|
!!(a.ma&Bb[na]);if(null===oa||oa==Wi)Yb&&(Yb+=","),++Vi%10||(Yb+="\n\t"),"key"==na&&(na="keys"),Yb+=na}void 0===G&&a.j("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.j((null!==oa?oa?"messages on: ":"messages off: ":"message categories:\n\t")+(Yb||"none"));Rh(a)}break;case "p":if("print"==g[0]){ui(a,b.substr(5));break}var Xi="pr"==g[0]?1:0;if(a.S)a.j("step in progress");else{var Pg=Y(a.b.u[7]);a.Gb(Pg);a.S?(a.mb(a.f,Pg,!0),a.hb()||(a.C&&a.C.rb(),a.S=0)):vi(a,Xi?"tr":"t")}break;
|
|
|
|
|
case "r":if("reset"==b){a.C&&a.C.reset();break}fi(a,g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var Zb=+g[2];if(8==Zb||10==Zb||16==Zb)a.ca=Zb;else{a.j("invalid base: "+Zb);break}}a.j("default base: "+a.ca);break;case "cs":var $b;void 0!==g[3]&&($b=+g[3]);switch(g[2]){case "int":a.b.vb=$b;break;case "start":a.b.Kb=$b;break;case "stop":a.b.wb=$b;break;default:a.j("unknown cs option");break a}void 0!==$b&&pd(a.b);a.j("checksums "+(a.b.w.ub?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&
|
|
|
|
|
(td(a.b,+g[2])||a.j("warning: using 1x multiplier, previous target not reached"));a.j("target speed: "+(a.b.ob.toFixed(2)+"Mhz")+" ("+a.b.eb+"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":vi(a,
|
|
|
|
|
g[0],g[1]);break;case "u":gi(a,g[1],g[2],8);break;case "v":if("var"==g[0]){si(a,b.substr(3))||(d=!1);break}if("ver"==g[0]){a.j("PDPjs version 1.30.3 ("+a.b.cb+",RELEASE"+(zb?",TYPEDARRAYS":",LONGARRAYS")+")");a.j(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){ui(a,b.substr(1));break}var $d="commands:",ae;for(ae in Th)$d+="\n"+wa(ae,9)+Th[ae];te(a)||($d+="\nnote: history disabled if no exec breakpoints");a.j($d);break;default:f=!0}f&&(a.j("unknown command: "+b),d=!1)}}catch(Qg){a.j("debugger error: "+
|
|
|
|
|
(Qg.stack||Qg.message)),d=!1}return d}function rd(a,b,c){b=Ih(a,b,c);for(var d in b)if(!li(a,b[+d]))return!1;return!0}Za(function(){for(var a=D(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Ph(d);B(d,c)}});
|
|
|
|
|
function xi(a,b,c){t.call(this,"Computer",a,xi,67108864);this.w.ha=!1;yi(this,b);this.L=nd(this,"autoPower",a);this.C=0;this.X=a.busWidth||a.buswidth;this.f=zi;this.I=null;this.D=this.R=!1;this.$=nd(this,"url")||"";(Math.random()+.1).toString(36);this.g=Ai(this);if(this.b=tb("CPU",this.id)){this.i=tb("Debugger",this.id);this.v=new nc({id:this.Qa+".bus",busWidth:this.X},this.b,this.i);var d,e=rb(this.id);if((this.B=tb("Panel",this.id))&&this.B.Ra)for(b=0;b<e.length;b++)d=e[b],d.P=this.B.P,d.j=this.B.j,
|
|
|
|
|
d.Ra=this.B.Ra;this.j("PDPjs v1.30.3\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.j("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.Ea&&d.Ea(this,this.v,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=nd(this,"state")||(f=!0,a.state))b=this.M=a,f||(this.D=!0,this.f=zi),this.f&&(this.J=
|
|
|
|
|
new N(this,"1.30.3"),Bi(this.J)?b=null:delete this.J);!b&&this.f&&(b=Ci(this))&&(this.D=!0);if(b){var g=this;Da(b,null,!0,function(a,b,c){c?(g.H=null,g.D=!1,g.P("Unable to load machine state from server (error "+c+(b?": "+xa(b):"")+")")):(g.I=b,g.R=!0);H(g)})}else H(this);this.G.power||(this.L=!0);!c&&this.L&&Di(this,this.Lb)}else q("Unable to find CPU component")}z(xi);var zi=0;
|
|
|
|
|
function yi(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){q(d.message+" ("+c+")")}}a.S=b}function nd(a,b,c){var d=b.toLowerCase(),d=db[b]||db[d];void 0===d&&a.S&&(d=a.S[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Di(a,b,c){for(var d=rb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!wb(f)){wb(f,function(){Di(a,b,c)});return}}b.call(a,c)}
|
|
|
|
|
function Ei(a,b){var c=new N(a,"1.30.3","validate");if(Bi(c)&&Fi(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.P("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}k=xi.prototype;
|
|
|
|
|
k.Lb=function(a){void 0===a&&(a=this.f||(this.I?1:zi));if(!this.C){this.C++;var b=!1,c=!1;this.O=!1;var d=this.J||new N(this,"1.30.3");if(-1==a)b=!0;else if(a>zi){if(Bi(d,this.I)){this.A=new N(this,"1.30.3","failsafe");Bi(this.A)&&(Gi(this,d),a=2,Hi(this.A));this.A.set("timestamp",Ba());Ii(this.A);var e=this.f&&!this.D;if(1==a||Ga("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=Fi(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Bi(d,g):("error"==
|
|
|
|
|
f&&"no machine state"!=g?(this.P("Error: "+g),"unable to verify user"==g&&(Qa("user",""),this.g=null)):this.j(f+": "+g),Hi(d),Bi(d)?(c=Fi(d),e=!0):c=!1))}e&&Ei(this,c?d:null)}else 2==a&&d.clear()}else Ei(this);delete this.I;delete this.J}e=rb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=Ji(this,g,d,b,c));b=[d,a,c];-1!=a?Di(this,this.qc,b):this.qc(b)}};
|
|
|
|
|
function Ji(a,b,c,d,e){if(!b.w.ha){b.w.ha=!0;if(b.Ga){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.Ga(f,d)&&f&&(q("Unable to restore state for "+b.type),a.M&&!a.R?(c.clear(),a.f=zi,window&&window.location.reload()):a.O=!0,b.Ga(null),e=!1)}if(!d&&b.sc)for(a=b.sc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
|
|
|
|
k.qc=function(a){var b=a[0],c=0>a[1];a=a[2];this.ca=!0;this.w.ha=!0;var d=this.G.power;d&&(d.textContent="Shutdown");this.b&&(Ji(this,this.b,b,c,a),this.oa(),this.b.sb());this.O&&(Gi(this,b),b.clear());!c&&this.A&&(this.A.clear(),delete this.A);this.C=0};
|
|
|
|
|
function Gi(a,b){if(Ga("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.g||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.3"};d.url=a.$;d.user=c;d.type="bug";d.data=b;Da("http://www.pcjs.org/api/v1/report",d,!0)}}
|
|
|
|
|
function wi(a,b,c){var d,e="none";if(a.C)return null;a.C--;var f=new N(a,"1.30.3"),g=new N(a,"1.30.3","validate"),h=Ba();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.30.3");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.Fa&&(c&&a.b.fa(),d=a.b.Fa(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.w.ha=!1,!1===d&&(e=null)));for(var h=rb(a.id),l=0;l<h.length;l++){var m=h[l];m.w.ha&&(m.Fa&&(d=m.Fa(b,c),"object"===typeof d&&f.set(m.id,
|
|
|
|
|
d)),c&&(m.w.ha=!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.g&&Ki(a,a.g,f.toString()),Ii(g)&&Ii(f)||(e=null,d=h=!0)):a.f&&(d=!0,h=3==a.f),d&&f.clear(h)):e=f.toString());c&&(a.w.ha=!1,b=a.G.power)&&(b.textContent="Power");a.C=0;return e}
|
|
|
|
|
k.reset=function(){this.v&&this.v.reset&&(E(this,"Resetting "+this.v.type),this.v.reset());this.b&&this.b.reset&&(E(this,"Resetting "+this.b.type),this.b.reset());for(var a=rb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.v&&c!==this.b&&c.reset&&(E(this,"Resetting "+c.type),c.reset())}this.oa(-1)};k.start=function(a,b){for(var c=rb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.oa(-1)};
|
|
|
|
|
k.stop=function(a,b){for(var c=rb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.oa(-1)};
|
|
|
|
|
k.oa=function(a){if(this.b){var b=this.b,c=b.G.speed;c&&(c.textContent=b.w.W&&b.ba?b.ba.toFixed(2)+"Mhz":"Stopped")}if(this.B&&(b=this.B,b.H)){var c=b.b.w.W,d=!!(b.b.K&4);if(!(0<a&&60>(b.J+=a))){for(var e=0;e<b.b.u.length;e++)bc(b,"R"+e,b.b.u[e]);e=Tc(b.b);bc(b,"PS",e);bc(b,"NF",e&8?1:0,1);bc(b,"ZF",e&4?1:0,1);bc(b,"VF",e&2?1:0,1);bc(b,"CF",e&1?1:0,1);b.J=0}ic(b,0<a&&c&&!d?b.b.u[7]:b.f);hc(b,b.D);a=b.b.Ua?b.b.pb&16?1:2:4;kc(b,"B22",a&1);kc(b,"B18",a&2);kc(b,"B16",a&4)}};
|
|
|
|
|
k.ra=function(a,b,c){var d=this;switch(b){case "power":return this.G[b]=c,c.onclick=function(){d.C||(d.w.ha?xi(d,!1,!0):Ei(d,d.Jb))},!0;case "reset":return this.G[b]=c,c.onclick=function(){if(d.w.ha&&!d.C)if(d.f&&!d.H){var a=Ga("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");xi(d,a,!0);!a&&d.M?window&&window.location.reload():(a||(d.sc=!0),d.Jb(Ai),d.sc=!1)}else d.reset(),d.b&&d.b.sb()},!0;case "save":if(ta(Fa(),"pcjs.org"))c.parentNode.removeChild(c);
|
|
|
|
|
else return this.G[b]=c,c.onclick=function(){var a=Bi(d,!0);if(a){var b=!!(d.f&&!d.H||d.M),c=xi(d,b);b?Li(d,a,c):d.P("Resume disabled, machine state not saved")}},!0}return!1};
|
|
|
|
|
function Bi(a,b){var c=a.g;c||((c=Ka("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=Mi(a,c))||a.P("The user ID is invalid.")):b&&a.P("Browser local storage is not available"));return c}
|
|
|
|
|
function Mi(a,b){a.g=null;b=Da(Fa()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Qa("user",b.data),a.g=b.data)}catch(d){q(d.message+" ("+c+")")}return a.g}function Di(a){var b=null;a.g&&(b=Fa()+"/api/v1/user?req=load&user="+a.g+"&state="+Ni(a,"1.30.3"));return b}
|
|
|
|
|
function Li(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Ni(a,"1.30.3");d.data=c;b=Da(Fa()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.P("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.P(c),Qa("user",""),a.g=null)}}
|
|
|
|
|
function dh(a){var b;a=rb(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}k.rb=function(a){if(this.Ra){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.Ra.focus();!a&&window&&window.scrollTo(b,c)}};Za(function(){for(var a=D(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=A(c),c=D(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=A(f),g=new yi(g,d,!0);B(g,f);g.L&&Ei(g,g.Jb)}});
|
|
|
|
|
Ua.show.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=tb("Computer",c.id))&&c.ca&&!c.w.ha&&c.Jb(-1)}});Ua.exit.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=tb("Computer",c.id))&&c.w.ha&&xi(c,!(!c.f||c.H),!0)}});function N(a,b,c){this.id=a.id;this.key=Ni(a,b,c);this.i=a.i;Ii(this,a.Vc)}function Ni(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){Ii(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 Ii(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function Ji(a){var b=!0;if(Ia()){var c=JSON.stringify(a[a.id]);Qa(a.key,c)||(q("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Gi(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){q(c.message||c),b=!1}return b}function Ci(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:Ia()&&(b=Ka(a.key))?(a[a.id]=b,a.b=!0):!1}var Oi=0;
|
|
|
|
|
function Zi(a,b,c,d,e,f){e("Loading "+a+"...");Da(a,null,!0,function(g,h,l){l?(h||(h="unable to load "+a+" ("+l+")"),f(h,null)):$i(h,a,b,c,d,e,f)})}
|
|
|
|
|
function $i(a,b,c,d,e,f,g){function h(a,f){if(f)g(f,null);else{c&&(qb(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(n){f=null,a=n.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?aj(a,f,h):h(a,null):g("no data"+(b?" for file: "+b:""),null)}
|
|
|
|
|
function aj(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");Da(e,null,!0,function(f,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(f=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=h[0],m,n=/( [a-z]+=)(['"])(.*?)\2/g;m=n.exec(f);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=l&&(g=g.replace(h[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
|
|
|
|
|
"");a=a.replace(d[0],g);aj(a,b,c)}})}else c(a,null)}
|
|
|
|
|
function bj(a,b,c,d){function e(a){if(void 0===h){var b=g&&D(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=va(a))}function f(a){e("Error: "+a);l&&(--Oi||ab(!0));l=!1}var g,h,l=!0;Oi++;pb[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],v=document.createElement("style");v.type="text/css";v.styleSheet?v.styleSheet.cssText=m:v.appendChild(document.createTextNode(m));n.appendChild(v)}c||
|
|
|
|
|
(c="/versions/pdpjs/1.30.3/components.xsl");m=function(d,h){h?Zi(c,null,null,!1,e,function(d,l){l?(qb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=h.transformNode(l))?(g.outerHTML=l,--Oi||ab(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(l),(l=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--Oi||ab(!0)):f("invalid machine element: "+
|
|
|
|
|
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Zi(b,a,d,!0,e,m):$i(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(r){f(r.message)}return l}window.embedPDP11=function(a,b,c,d){ab(!1);return bj(a,b,c,d)};window.enableEvents=ab;window.sendEvent=bb;})();//# sourceMappingURL=/tmp/pdpjs/1.30.3/pdp11-dbg.map
|
|
|
|
|
k.oa=function(a){if(this.b){var b=this.b,c=b.G.speed;c&&(c.textContent=b.w.W&&b.ca?b.ca.toFixed(2)+"Mhz":"Stopped")}if(this.B&&(b=this.B,b.H)){var c=b.b.w.W,d=!!(b.b.K&4);if(!(0<a&&60>(b.J+=a))){for(var e=0;e<b.b.u.length;e++)bc(b,"R"+e,b.b.u[e]);e=Tc(b.b);bc(b,"PS",e);bc(b,"NF",e&8?1:0,1);bc(b,"ZF",e&4?1:0,1);bc(b,"VF",e&2?1:0,1);bc(b,"CF",e&1?1:0,1);b.J=0}ic(b,0<a&&c&&!d?b.b.u[7]:b.f);hc(b,b.D);a=b.b.Ua?b.b.pb&16?1:2:4;kc(b,"B22",a&1);kc(b,"B18",a&2);kc(b,"B16",a&4)}};
|
|
|
|
|
k.sa=function(a,b,c){var d=this;switch(b){case "power":return this.G[b]=c,c.onclick=function(){d.C||(d.w.ha?wi(d,!1,!0):Di(d,d.Lb))},!0;case "reset":return this.G[b]=c,c.onclick=function(){if(d.w.ha&&!d.C)if(d.f&&!d.H){var a=Ga("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");wi(d,a,!0);!a&&d.M?window&&window.location.reload():(a||(d.rc=!0),d.Lb(zi),d.rc=!1)}else d.reset(),d.b&&d.b.sb()},!0;case "save":if(ta(Fa(),"pcjs.org"))c.parentNode.removeChild(c);
|
|
|
|
|
else return this.G[b]=c,c.onclick=function(){var a=Ai(d,!0);if(a){var b=!!(d.f&&!d.H||d.M),c=wi(d,b);b?Ki(d,a,c):d.P("Resume disabled, machine state not saved")}},!0}return!1};
|
|
|
|
|
function Ai(a,b){var c=a.g;c||((c=Ka("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=Li(a,c))||a.P("The user ID is invalid.")):b&&a.P("Browser local storage is not available"));return c}
|
|
|
|
|
function Li(a,b){a.g=null;b=Da(Fa()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Qa("user",b.data),a.g=b.data)}catch(d){q(d.message+" ("+c+")")}return a.g}function Ci(a){var b=null;a.g&&(b=Fa()+"/api/v1/user?req=load&user="+a.g+"&state="+Mi(a,"1.30.3"));return b}
|
|
|
|
|
function Ki(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Mi(a,"1.30.3");d.data=c;b=Da(Fa()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.P("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.P(c),Qa("user",""),a.g=null)}}
|
|
|
|
|
function ch(a){var b;a=rb(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}k.rb=function(a){if(this.Ra){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.Ra.focus();!a&&window&&window.scrollTo(b,c)}};Za(function(){for(var a=D(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=A(c),c=D(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=A(f),g=new xi(g,d,!0);B(g,f);g.L&&Di(g,g.Lb)}});
|
|
|
|
|
Ua.show.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=tb("Computer",c.id))&&c.ca&&!c.w.ha&&c.Lb(-1)}});Ua.exit.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=tb("Computer",c.id))&&c.w.ha&&wi(c,!(!c.f||c.H),!0)}});function N(a,b,c){this.id=a.id;this.key=Mi(a,b,c);this.i=a.i;Hi(this,a.Yc)}function Mi(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){Hi(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 Hi(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function Ii(a){var b=!0;if(Ia()){var c=JSON.stringify(a[a.id]);Qa(a.key,c)||(q("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Fi(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){q(c.message||c),b=!1}return b}function Bi(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:Ia()&&(b=Ka(a.key))?(a[a.id]=b,a.b=!0):!1}var Ni=0;
|
|
|
|
|
function Yi(a,b,c,d,e,f){e("Loading "+a+"...");Da(a,null,!0,function(g,h,l){l?(h||(h="unable to load "+a+" ("+l+")"),f(h,null)):Zi(h,a,b,c,d,e,f)})}
|
|
|
|
|
function Zi(a,b,c,d,e,f,g){function h(a,f){if(f)g(f,null);else{c&&(qb(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(n){f=null,a=n.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?$i(a,f,h):h(a,null):g("no data"+(b?" for file: "+b:""),null)}
|
|
|
|
|
function $i(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");Da(e,null,!0,function(f,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(f=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=h[0],m,n=/( [a-z]+=)(['"])(.*?)\2/g;m=n.exec(f);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=l&&(g=g.replace(h[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
|
|
|
|
|
"");a=a.replace(d[0],g);$i(a,b,c)}})}else c(a,null)}
|
|
|
|
|
function aj(a,b,c,d){function e(a){if(void 0===h){var b=g&&D(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=va(a))}function f(a){e("Error: "+a);l&&(--Ni||ab(!0));l=!1}var g,h,l=!0;Ni++;pb[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],v=document.createElement("style");v.type="text/css";v.styleSheet?v.styleSheet.cssText=m:v.appendChild(document.createTextNode(m));n.appendChild(v)}c||
|
|
|
|
|
(c="/versions/pdpjs/1.30.3/components.xsl");m=function(d,h){h?Yi(c,null,null,!1,e,function(d,l){l?(qb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=h.transformNode(l))?(g.outerHTML=l,--Ni||ab(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(l),(l=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--Ni||ab(!0)):f("invalid machine element: "+
|
|
|
|
|
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Yi(b,a,d,!0,e,m):Zi(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(r){f(r.message)}return l}window.embedPDP11=function(a,b,c,d){ab(!1);return aj(a,b,c,d)};window.enableEvents=ab;window.sendEvent=bb;})();//# sourceMappingURL=/tmp/pdpjs/1.30.3/pdp11-dbg.map
|
|
|
|
|
|