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