|
|
|
|
@ -683,239 +683,221 @@
|
|
|
|
|
*/
|
|
|
|
|
var h;
|
|
|
|
|
function aa(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 ca(a,b,c){var d="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}function l(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}
|
|
|
|
|
function da(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 fa(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function ga(){var a=ha();return-1!==a.indexOf("pcjs.org",a.length-8)}var ia={"&":"&","<":"<",">":">",'"':""","'":"'"};function ja(a){return a.replace(/[&<>"']/g,function(a){return ia[a]})}function oa(a,b){return(a+" ").slice(0,b)}
|
|
|
|
|
function pa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var qa={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 ra(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a<b?-1:0});d<e;){var g=d+e>>1,k;k=c(b,a[g]);0<k?d=g+1:(e=g,f=!k)}return f?d:~d}var sa=Date.now||function(){return+new Date};function ta(){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 ua(a,b,c,d){var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var k=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(k.onreadystatechange=function(){4===k.readyState&&(f=k.responseText,200==k.status||!k.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=k.status||-1),d&&d(a,f,e))});if(b&&"object"==
|
|
|
|
|
typeof b){var m="",n;for(n in b)b.hasOwnProperty(n)&&(m&&(m+="&"),m+=n+"="+encodeURIComponent(b[n]));m=m.replace(/%20/g,"+");k.open("POST",a,!!c);k.setRequestHeader("Content-type","application/x-www-form-urlencoded");k.send(m)}else k.open("GET",a,!!c),"bytes"==b&&k.overrideMimeType("text/plain; charset=x-user-defined"),k.send();c||(f=k.responseText,200!=k.status&&(e=k.status||-1),d&&d(a,f,e),g=[f,e]);return g}function ha(){return"http://"+(window?window.location.host:"www.pcjs.org")}
|
|
|
|
|
function q(a){window&&window.alert(a)}function wa(a){var b=!1;window&&(b=window.confirm(a));return b}var xa=null;function ya(){if(null==xa){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}xa=a}return xa}function za(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}
|
|
|
|
|
function Da(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Ea(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 Fa(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
|
|
|
|
|
function Ga(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 Ha={init:[],show:[],exit:[]},Ia=!1,Ja=!1,Ka=!0;function La(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ma(a){Ha.init.push(a)}
|
|
|
|
|
function Na(a){if(Ka)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){q(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Oa(a){!Ka&&a?(Ka=!0,Ia&&Ua("init"),Ja&&Ua("show")):Ka=a}function Ua(a){Ha[a]&&Na(Ha[a])}La("onload",function(){Ia=!0;Na(Ha.init)});La("onpageshow",function(){Ja=!0;Na(Ha.show)});La(Ea("Opera")||Ea("iOS")?"onunload":"onbeforeunload",function(){Na(Ha.exit)});
|
|
|
|
|
function u(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.yc=b.comment;this.$c=b;b=this.id.indexOf(".");0>b?this.Sb=this.id:(this.fc=this.id.substr(0,b),this.Sb=this.id.substr(b+1));this[a]=c;this.v={ready:!1,Gb:!1,gc:!1,ja:!1,error:!1};this.Ub=null;this.v.error=!1;this.L={};this.j=null;this.ma=d||0;v.push(this)}var Va=void 0,Wa={};
|
|
|
|
|
if(window){Va||(Va=window.location.search.substr(1));for(var Xa,Ya=/\+/g,Za=/([^&=]+)=?([^&]*)/g;Xa=Za.exec(Va);)Wa[decodeURIComponent(Xa[1].replace(Ya," "))]=decodeURIComponent(Xa[2].replace(Ya," "))}function $a(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 y(a,b){b||(b=u);a.prototype=$a(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var ab=window.PCjs.Machines||(window.PCjs.Machines={}),v=window.PCjs.Components||(window.PCjs.Components=[])}else ab={},v=[];function bb(a,b,c){ab[a]&&b&&(ab[a][b]=c)}function cb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<v.length;b++){var d=v[b];a&&d.id.indexOf(a)||c.push(d)}return c}
|
|
|
|
|
function db(a){if(void 0!==a){var b;for(b=0;b<v.length;b++)if(v[b].id===a)return v[b]}return null}function eb(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<v.length;d++)if(c)c==v[d]&&(c=null);else if(!(a!=v[d].type||b&&v[d].id.indexOf(b)))return v[d]}return null}function z(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){q(c.message+" ("+a+")")}return b}
|
|
|
|
|
function fb(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 k=g.split(" "),m=0;m<k.length;m++)switch(g=k[m],g){case "pdp11-binding":(g=z(f))&&g.binding&&a.pa(g.type,g.binding,f,g.value),m=k.length}}}}
|
|
|
|
|
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function ba(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 da(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 ea(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function fa(){var a=ga();return-1!==a.indexOf("pcjs.org",a.length-8)}var ha={"&":"&","<":"<",">":">",'"':""","'":"'"};function ma(a){return a.replace(/[&<>"']/g,function(a){return ha[a]})}function na(a,b){return(a+" ").slice(0,b)}
|
|
|
|
|
function oa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var pa={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 qa(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 ra=Date.now||function(){return+new Date};function sa(){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 ua(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 n="",p;for(p in b)b.hasOwnProperty(p)&&(n&&(n+="&"),n+=p+"="+encodeURIComponent(b[p]));n=n.replace(/%20/g,"+");l.open("POST",a,!!c);l.setRequestHeader("Content-type","application/x-www-form-urlencoded");l.send(n)}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 ga(){return"http://"+(window?window.location.host:"www.pcjs.org")}
|
|
|
|
|
function m(a){window&&window.alert(a)}function va(a){var b=!1;window&&(b=window.confirm(a));return b}var wa=null;function xa(){if(null==wa){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}wa=a}return wa}function Ba(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}
|
|
|
|
|
function Ca(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Da(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 Ea(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
|
|
|
|
|
function Fa(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 Ga={init:[],show:[],exit:[]},Ha=!1,Ia=!1,Ja=!0;function Ka(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function La(a){Ga.init.push(a)}
|
|
|
|
|
function Ma(a){if(Ja)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){m(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Sa(a){!Ja&&a?(Ja=!0,Ha&&Ta("init"),Ia&&Ta("show")):Ja=a}function Ta(a){Ga[a]&&Ma(Ga[a])}Ka("onload",function(){Ha=!0;Ma(Ga.init)});Ka("onpageshow",function(){Ia=!0;Ma(Ga.show)});Ka(Da("Opera")||Da("iOS")?"onunload":"onbeforeunload",function(){Ma(Ga.exit)});
|
|
|
|
|
function r(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Rb=b.comment;this.xc=b;b=this.id.indexOf(".");0>b?this.Ya=this.id:(this.zb=this.id.substr(0,b),this.Ya=this.id.substr(b+1));this[a]=c;this.v={ready:!1,ib:!1,xb:!1,fa:!1,error:!1};this.rb=null;this.v.error=!1;this.J={};this.j=null;this.ha=d||0;t.push(this)}var Ua=void 0,Va={};
|
|
|
|
|
if(window){Ua||(Ua=window.location.search.substr(1));for(var Wa,Xa=/\+/g,Ya=/([^&=]+)=?([^&]*)/g;Wa=Ya.exec(Ua);)Va[decodeURIComponent(Wa[1].replace(Xa," "))]=decodeURIComponent(Wa[2].replace(Xa," "))}function Za(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 y(a,b){b||(b=r);a.prototype=Za(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var $a=window.PCjs.Machines||(window.PCjs.Machines={}),t=window.PCjs.Components||(window.PCjs.Components=[])}else $a={},t=[];function ab(a,b,c){$a[a]&&b&&($a[a][b]=c)}function bb(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 cb(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 db(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){m(c.message+" ("+a+")")}return b}
|
|
|
|
|
function eb(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(" "),n=0;n<l.length;n++)switch(g=l[n],g){case "pdp11-binding":(g=z(f))&&g.binding&&a.ja(g.type,g.binding,f,g.value),n=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}
|
|
|
|
|
u.prototype={constructor:u,parent:null,toString:function(){return this.name?this.name:this.id||this.type},pa:function(a,b,c){switch(b){case "clear":return this.L[b]||(this.L[b]=c,c.onclick=function(a){return function(){a.L.print&&(a.L.print.value="")}}(this)),!0;case "print":return this.L[b]||(this.kb=this.L[b]=c,c.value="",this.i=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.ta=function(a){this.i(a,this.Sb)}),!0;default:return!1}},log:function(){},i:function(){},status:function(a){this.i(this.Sb+": "+a)},ta:function(a,b,c){c=c||this.type;b||q((c?c+": ":"")+a)},Ka:function(){return this.v.ja=!0},Ja:function(a,b){b&&(this.v.ja=!1);return!0}};function D(a,b,c,d){a.j&&(!0===c||F(a,c|0))&&a.j.message(b,d)}function F(a,b){if(a.j){a===a.j?b|=0:b=b||a.ma;var c=a.j.ma&b;return!!b&&c===b||!!(c&a.j.Tc)}return!1}
|
|
|
|
|
function gb(a,b){if(a.v.gc)return a.v.Gb=!1,a.v.gc=!1;if(a.v.error)return a.i(a.toString()+" error"),!1;a.v.Gb=b;return a.v.Gb}function hb(a,b){a.v.Gb&&(b?a.v.gc=!0:void 0===b&&a.i(a.toString()+" busy"));return a.v.Gb}function G(a){if(!a.v.error&&(a.v.ready=!0,a.v.ready)){var b=a.Ub;a.Ub=null;b&&b()}}function ib(a,b){b&&(a.v.ready?b():a.Ub=b);return a.v.ready}function jb(a){return a.v.error?(a.i(a.toString()+" error"),!0):!1}function kb(a,b){a.v.error=!0;a.ta(b)}
|
|
|
|
|
r.prototype={constructor:r,parent:null,toString:function(){return this.name?this.name:this.id||this.type},ja:function(a,b,c){switch(b){case "clear":return this.J[b]||(this.J[b]=c,c.onclick=function(a){return function(){a.J.print&&(a.J.print.value="")}}(this)),!0;case "print":return this.J[b]||(this.Ta=this.J[b]=c,c.value="",this.i=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.i(a,this.Ya)}),!0;default:return!1}},log:function(){},i:function(){},status:function(a){this.i(this.Ya+": "+a)},na:function(a,b,c){c=c||this.type;b||m((c?c+": ":"")+a)},Ca:function(){return this.v.fa=!0},Ba:function(a,b){b&&(this.v.fa=!1);return!0}};function D(a,b,c,d){a.j&&(!0===c||F(a,c|0))&&a.j.message(b,d)}function F(a,b){if(a.j){a===a.j?b|=0:b=b||a.ha;var c=a.j.ha&b;return!!b&&c===b||!!(c&a.j.qc)}return!1}
|
|
|
|
|
function fb(a,b){if(a.v.xb)return a.v.ib=!1,a.v.xb=!1;if(a.v.error)return a.i(a.toString()+" error"),!1;a.v.ib=b;return a.v.ib}function gb(a,b){a.v.ib&&(b?a.v.xb=!0:void 0===b&&a.i(a.toString()+" busy"));return a.v.ib}function G(a){if(!a.v.error&&(a.v.ready=!0,a.v.ready)){var b=a.rb;a.rb=null;b&&b()}}function hb(a,b){b&&(a.v.ready?b():a.rb=b);return a.v.ready}function ib(a){return a.v.error?(a.i(a.toString()+" error"),!0):!1}function vb(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 xb="undefined"!==typeof ArrayBuffer,yb={cpu:1,trap:16,bus:64,mem:128,keyboard:65536,key:131072,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};function zb(a){u.call(this,"Panel",a,zb)}y(zb);h=zb.prototype;h.pa=function(a,b,c,d){return this.D&&this.D.pa(a,b,c,d)||this.b&&this.b.pa(a,b,c,d)||this.j&&this.j.pa(a,b,c,d)?!0:this.parent.pa.call(this,a,b,c,d)};h.Pa=function(a,b,c,d){this.D=a;this.F=b;this.b=c;this.j=d};
|
|
|
|
|
h.Ka=function(a,b){b||Ab();return!0};h.Ja=function(){return!0};h.Ga=function(){};function Ab(){for(var a=!1,b=A(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=z(d),f=db(e.id);f||(a=!0,f=new zb(e));fb(f,d);a&&G(f)}}Ma(Ab);
|
|
|
|
|
function Bb(a,b,c){u.call(this,"Bus",a,Bb,64);this.b=b;this.j=c;this.B=a.busWidth||16;this.F=Math.pow(2,this.B);this.g=this.F-1|0;this.ca=(this.B>>1)+2;10>this.ca&&(this.ca=10);15<this.ca&&(this.ca=15);this.Da=1<<this.ca;this.G=this.Da>>2;this.f=this.Da-1;this.w=this.F/this.Da|0;this.Ua=[];this.D=null;this.Hb=this.Jd;a=new H;Cb(a,this.j);this.aa=Array(this.w);for(b=0;b<this.w;b++)this.aa[b]=a;this.Db=Array(4);this.Db[0]=Db;this.Db[1]=Eb;this.Db[2]=Fb;this.Db[3]=Gb;Hb(this,this.F-8192,8192,Ib,this);
|
|
|
|
|
Hb(this,57344,8192,Ib,this);G(this)}y(Bb);function Db(a,b){var c=-1,d=this.controller,e=d.Ua[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.Ua[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);if(0<=c)return this.j&&F(this.j,64)&&D(this.j,e[5]+".readByte("+I(this.j,b)+"): "+I(this.j,c),!0,!0),c;c=d.Hb(b|4186112,-1,1);this.j&&F(this.j,64)&&D(this.j,"warning: unconverted read access to byte @"+I(this.j,b)+": "+I(this.j,c));return c}
|
|
|
|
|
function Eb(a,b,c){var d=!1,e=this.controller,f=e.Ua[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](c):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.Ua[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](c):0,f[3](a&255|b<<8,c),d=!0);d?this.j&&F(this.j,64)&&D(this.j,f[5]+".writeByte("+I(this.j,c)+","+I(this.j,b)+")",!0,!0):(e.Hb(c|4186112,b,1),this.j&&F(this.j,64)&&D(this.j,"warning: unconverted write access to byte @"+I(this.j,c)+": "+I(this.j,b)))}
|
|
|
|
|
function Fb(a,b){var c=-1,d=this.controller;(a=d.Ua[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));if(0<=c)return this.j&&F(this.j,64)&&D(this.j,a[5]+".readWord("+I(this.j,b)+"): "+I(this.j,c),!0,!0),c;c=d.Hb(b|4186112,-1,0);this.j&&F(this.j,64)&&D(this.j,"warning: unconverted read access to word @"+I(this.j,b)+": "+I(this.j,c));return c}
|
|
|
|
|
function Gb(a,b,c){var d=!1,e=this.controller;if(a=e.Ua[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.j&&F(this.j,64)&&D(this.j,a[5]+".writeWord("+I(this.j,c)+","+I(this.j,b)+")",!0,!0):(e.Hb(c|4186112,b,0),this.j&&F(this.j,64)&&D(this.j,"warning: unconverted write access to word @"+I(this.j,c)+": "+I(this.j,b)))}h=Bb.prototype;h.reset=function(){this.D&&this.D()};
|
|
|
|
|
h.Jd=function(a,b,c){this.j&&F(this.j,64)&&D(this.j,"warning: unrecognized I/O access("+I(this.j,a)+","+I(this.j,b)+","+c+")");return 0};h.Ka=function(a,b){b||this.reset();return!0};
|
|
|
|
|
function Hb(a,b,c,d,e){for(var f=b,g=c,k=f>>>a.ca;0<g&&k<a.aa.length;){var m=a.aa[k],n=k*a.Da,p=a.Da-(f-n);p>g&&(p=g);if(m&&m.size){if(m.type==d&&m.controller==e){if(f+g<=m.A)return m.Rb+=m.A-f,m.A=f,!0;if(f>=m.A+m.Rb){p=m.size-(f-n);p>g&&(p=g);m.Rb=f-m.A+p;f=n+a.Da;g-=p;k++;continue}}return Jb(1,f,g)}f=new H(f,p,a.Da,d,e);Cb(f,a.j,m);a.aa[k++]=f;f=n+a.Da;g-=p}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Kb[d]+" at "+l(b,8,!0)),!0):Jb(2,b,c)}
|
|
|
|
|
h.mb=function(a){return this.aa[(a&this.g)>>>this.ca].Zb(a&this.f,a)};h.Ia=function(a){return this.aa[(a&this.g)>>>this.ca].Hc(a&this.f,a)};function Lb(a,b){return a.aa[(b&a.g)>>>a.ca].mc(b&a.f,b)}h.Ob=function(a,b){this.aa[(a&this.g)>>>this.ca].cc(a&this.f,b&255,a)};h.qc=function(a,b){this.aa[(a&this.g)>>>this.ca].Pc(a&this.f,b&65535,a)};
|
|
|
|
|
function Mb(a){for(var b=0,c=[],d=0;d<a.w;d++){var e=a.aa[d];if(e.Xa||e.Vc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,k=0,m=[];g<e.length;){for(var n=e[g],p=g+1;p<e.length&&e[p]===n;)p++;m[k++]=p-g;m[k++]=n;g=p}m.length<e.length&&(e=m)}c[f]=e}}return c}
|
|
|
|
|
function Nb(a,b,c){for(var d in c)for(var e=c[d],f=e[0]?e[0].bind(b):null,g=e[1]?e[1].bind(b):null,k=e[2]?e[2].bind(b):null,m=e[3]?e[3].bind(b):null,n=a,p=+d,e=e[4],t=+d;t<=p;t+=2){var r=t&8191;void 0!==n.Ua[r]?q("I/O address already registered: "+l(t,8,!0)):n.Ua[r]=[f,g,k,m,!1,e||"unknown"]}}function Ob(a,b,c){a.D=b;a.Hb=c}function Jb(a,b,c){q("Memory block error ("+a+": "+l(b)+","+l(c)+")");return!1}
|
|
|
|
|
function J(a){u.call(this,"Device",a,J);this.g={data:0,de:0,tb:20,Id:0};this.f={M:0,sc:-1};this.D={Mb:2496,oa:0,P:128,Nb:0,Lb:0,xa:0,Jc:0,sa:[],ib:[406,406,406,406],da:[12,12,12,12]};this.w={M:129,Fb:0,fa:0,Za:0,Va:0,gb:0,sa:[],da:[40,40,40,40],ib:[1024,1024,512,512],Qc:[157,157,29,29]};this.B={b:[8210,8208,8210,8226],da:[22,22,22,50],hb:[19,19,19,32],ec:[815,411,815,630],sa:[],T:2176,zb:0,xb:0,Fa:[0,0,0,0,0,0,0,0],Ea:0,ua:[4544,4544,4544,4544,4544,4544,4544,4544],yb:[0,0,0,0,0,0,0,0],ob:0,Fd:[0,
|
|
|
|
|
0,0,0,0,0,0,0],Kc:0,Lc:[0,0,0,0,0,0,0,0],j:[0,0,0,0,0,0,0,0],Gd:[1,2,3,4,5,6,7,8],Mc:[0,0,0,0,0,0,0,0],Ra:[0,0,0,0,0,0,0,0],bc:[0,0,0,0,0,0,0,0],Dd:[0,0,0,0,0,0,0,0],Ed:[0,0,0,0,0,0,0,0],Bd:[0,0,0,0,0,0,0,0],Cd:[0,0,0,0,0,0,0,0],eb:0,pc:0}}y(J);
|
|
|
|
|
var Pb=[4127,448,4191,450,4383,452,2591,454,21983,32768,65534,13791,16384,65534,770,2719,454,2591,65534,257,0,2566,33028,34051,33282,1281,33537,0,2758,32771,770,1025,1793,0,3078,33794,34305,513,0,5574,43690,4480,4097,4162,4227,4292,4357,57665,1281,769,0,3138,34305,1281,0,24707,2691,2627,24769,34561,1793,0,3076,20739,24899,2691,34562,2753,1281,0,2624,33537,0,16385,24641,1537,1793,0,193,8279,21589,516,12549,1538,2629,513,0,38336,65281,32769,0,32258,2561,2689,32258,3008,514,3009,769,0,5574,510,2551,
|
|
|
|
|
2,0,9678,208,769,0,5582,226,135,0,2598,5606,236,2,0,95,242,128,5573,57344,2591,6,5599,256,4,5574,510,3045,5599,460,76,2591,78,5571,65510,5579,12,5570,512,4224,4104,3024,8197,33788,4224,4609,8193,769,0,2640,8197,33785,6145,2625,8193,769,0,8194,761,2574,5572,43690,5579,24,5568,2048,5570,512,2628,4360,2632,2632,8708,769,0,3103,65514,34562,0,305,35406,754,258,119,65160,3024,32403,5579,36,5568,3072,35446,1,740,5570,512,4224,4104,3024,8197,33788,5569,3,2574,3039,454,528,5582,24,4224,2632,2632,8200,769,
|
|
|
|
|
0,3024,3103,65514,34562,0,264,8197,33779,5003,2574,32337,260,0,258,5579,12,6080,448,6081,450,6084,452,116,2,6084,65400,17860,65024,21956,62976,38848,65401,3200,161,76,0,16944,10797];h=J.prototype;h.Pa=function(a,b,c,d){this.F=b;this.b=c;this.j=d;var e=this;this.f.sc=Qb(this.b,function(){e.f.Ya|=128;e.f.Ya&64&&(K(e.b,0,6,64),Rb(e.b,e.f.sc,1E3/60))});Nb(b,this,L);Ob(b,this.reset.bind(this),this.Sc.bind(this));G(this)};h.jd=function(){var a=this.f.Ya;this.f.Ya&=-129;return a};
|
|
|
|
|
h.Od=function(a){this.f.Ya=a;a&64&&Rb(this.b,this.f.sc,1E3/60);this.f.Ya=a&-129};h.kd=function(){var a=this.b;return a.G&62337|a.Ba<<5|a.Ca<<1};h.Pd=function(a){var b=4,c=this.b;c.G=a&=62337;c.Ba=a>>5&3;c.Ca=a>>1&15;c.kc=a&257?a&1?6:4:0;Sb(c);a=c.G;a&1|256&&(b=this.b.bb&16?1:2);this.g.tb=this.g.tb&-8|b};h.rd=function(a){return this.b.W[1][a>>1&7]};h.Wd=function(a,b){this.b.W[1][b>>1&7]=a&65295};h.pd=function(a){return this.b.W[1][(a>>1&7)+8]};h.Ud=function(a,b){this.b.W[1][(b>>1&7)+8]=a&65295};
|
|
|
|
|
h.qd=function(a){return this.b.wa[1][a>>1&7]};h.Vd=function(a,b){b=b>>1&7;this.b.wa[1][b]=a;this.b.W[1][b]&=65295};h.od=function(a){return this.b.wa[1][(a>>1&7)+8]};h.Td=function(a,b){b=(b>>1&7)+8;this.b.wa[1][b]=a;this.b.W[1][b]&=65295};h.hd=function(a){return this.b.W[0][a>>1&7]};h.Nd=function(a,b){this.b.W[0][b>>1&7]=a&65295};h.fd=function(a){return this.b.W[0][(a>>1&7)+8]};h.Ld=function(a,b){this.b.W[0][(b>>1&7)+8]=a&65295};h.gd=function(a){return this.b.wa[0][a>>1&7]};
|
|
|
|
|
h.Md=function(a,b){b=b>>1&7;this.b.wa[0][b]=a;this.b.W[0][b]&=65295};h.ed=function(a){return this.b.wa[0][(a>>1&7)+8]};h.Kd=function(a,b){b=(b>>1&7)+8;this.b.wa[0][b]=a;this.b.W[0][b]&=65295};h.vd=function(a){return this.b.W[3][a>>1&7]};h.$d=function(a,b){this.b.W[3][b>>1&7]=a&65295};h.td=function(a){return this.b.W[3][(a>>1&7)+8]};h.Yd=function(a,b){this.b.W[3][(b>>1&7)+8]=a&65295};h.ud=function(a){return this.b.wa[3][a>>1&7]};h.Zd=function(a,b){b=b>>1&7;this.b.wa[3][b]=a;this.b.W[3][b]&=65295};
|
|
|
|
|
h.sd=function(a){return this.b.wa[3][(a>>1&7)+8]};h.Xd=function(a,b){b=(b>>1&7)+8;this.b.wa[3][b]=a;this.b.W[3][b]&=65295};h.ld=function(){return Tb(this.b)};h.Qd=function(a){Ub(this.b,a&-1809|Tb(this.b)&1808);this.b.C|=128};
|
|
|
|
|
function Vb(a){var b=a.D,c,d,e,f=b.xa>>13&7;"undefined"===typeof b.sa[f]&&(b.sa[f]={cache:[],postProcess:a.yd,drive:f,blocksize:256,mapped:0,maxblock:b.ib[f]*b.da[f],url:"rk"+f+".dsk"});b.P&=-129;switch(b.P>>1&7){case 0:b.Mb=2496;b.oa=0;b.P=128;b.xa=0;break;case 1:if((b.xa>>4&511)>=b.ib[f]){b.oa|=32832;b.P|=49152;break}if((b.xa&15)>=b.da[f]){b.oa|=32800;b.P|=49152;break}c=(b.xa>>4&511)*b.da[f]+(b.xa&15);d=(b.P&48)<<12|b.Lb;e=65536-b.Nb&65535;Wb(a,b.sa[f],c,d,e);return;case 2:if((b.xa>>4&511)>=b.ib[f])b.oa|=
|
|
|
|
|
32832,b.P|=49152;else if((b.xa&15)>=b.da[f])b.oa|=32800,b.P|=49152;else{c=(b.xa>>4&511)*b.da[f]+(b.xa&15);d=(b.P&48)<<12|b.Lb;e=65536-b.Nb&65535;a.$b(b.sa[f],c,d,e);return}}b.Mb=f<<13|b.Mb&8176|b.xa%9&15;K(a.b,20,5,144,function(){b.P=b.P&65534|128;return!!(b.P&64)})}h.yd=function(a,b,c,d,e){var f=this.D;f.Lb=d&65535;f.P=f.P&-49|d>>12&48;f.Nb=65536-e&65535;switch(a){case 1:f.oa|=33024;f.P|=49152;break;case 2:f.oa|=33792,f.P|=49152}K(this.b,20,5,144,function(){f.P=f.P&65534|128;return!!(f.P&64)})};
|
|
|
|
|
function fc(a){var b=a.w,c,d,e,f=b.M>>8&3;b.M&=-2;"undefined"===typeof b.sa[f]&&(b.sa[f]={cache:[],postProcess:a.zd,drive:f,blocksize:128,mapped:1,maxblock:b.ib[f]*b.da[f],url:"rl"+f+".dsk"});switch(b.M>>1&7){case 2:b.Za&8&&(b.M&=63);b.Za=b.Qc[f]|b.gb&64;break;case 3:1==(b.fa&3)&&(b.gb=b.fa&4?b.gb+(b.fa&65408)&65408|b.fa<<2&64:b.gb-(b.fa&65408)&65408|b.fa<<2&64,b.fa=b.gb);break;case 4:b.Za=b.gb;break;case 5:if(b.fa>>6>=b.ib[f]){b.M|=37888;break}if((b.fa&63)>=b.da[f]){b.M|=37888;break}c=(b.fa>>6)*
|
|
|
|
|
b.da[f]+(b.fa&63);d=(b.Va&63)<<16|b.Fb;e=65536-b.Za&65535;Wb(a,b.sa[f],c,d,e);return;case 6:if(b.fa>>6>=b.ib[f])b.M|=37888;else if((b.fa&63)>=b.da[f])b.M|=37888;else{c=(b.fa>>6)*b.da[f]+(b.fa&63);d=(b.Va&63)<<16|b.Fb;e=65536-b.Za&65535;a.$b(b.sa[f],c,d,e);return}}K(a.b,20,5,112,function(){b.M|=129;return!!(b.M&64)})}
|
|
|
|
|
h.zd=function(a,b,c,d,e){var f=this.w;f.Fb=d&65535;f.M=f.M&-49|d>>12&48;f.Va=d>>16&63;f.fa=~~(c/f.da[b.Na])<<6|c%f.da[b.Na];f.gb=f.fa;f.Za=65536-e&65535;switch(a){case 1:f.M|=33792;break;case 2:f.M|=40960}K(this.b,20,5,112,function(){f.M|=129;return!!(f.M&64)})};function gc(a){a=a.B;a.T=2176;a.Ea=0;a.ua=[4544,4544,4544,4544,4544,4544,4544,4544];a.yb=[0,0,0,0,0,0,0,0];a.ob=a.zb=a.xb=a.eb=a.pc=0}
|
|
|
|
|
function hc(a,b){var c=a.B,d,e,f;c.T&=-16513;c.Ea&=-2049;c.ua[b]&=-1153;K(a.b,-1,0,172);"undefined"===typeof c.sa[b]&&(c.sa[b]={cache:[],postProcess:a.Ad,drive:b,blocksize:256,mapped:0,maxblock:c.ec[0]*c.hb[0]*c.da[0],url:"rp"+b+".dsk"});switch(c.T&63){case 5:c.bc[b]=c.Ra[b];c.T|=32896;c.ua[b]|=32896;c.ob|=1<<b;break;case 9:gc(a);break;case 19:c.ua[b]|=64;break;case 49:if(c.Ra[b]>=c.ec[0]||c.Fa[b]>>8>=c.hb[0]||(c.Fa[b]&255)>=c.da[0]){c.yb[b]|=1024;c.T|=49152;break}d=(c.Ra[b]*c.hb[0]+(c.Fa[b]>>8))*
|
|
|
|
|
c.da[0]+(c.Fa[b]&255);e=(c.eb&63)<<16|c.xb;f=65536-c.zb&65535;Wb(a,c.sa[b],d,e,f);return;case 57:if(c.Ra[b]>=c.ec[0]||c.Fa[b]>>8>=c.hb[0]||(c.Fa[b]&255)>=c.da[0])c.yb[b]|=1024,c.T|=49152;else{d=(c.Ra[b]*c.hb[0]+(c.Fa[b]>>8))*c.da[0]+(c.Fa[b]&255);e=(c.eb&63)<<16|c.xb;f=65536-c.zb&65535;a.$b(c.sa[b],d,e,f);return}}K(a.b,3,5,172,function(){c.T=c.T&65534|128;c.ua[b]|=128;return!!(c.T&64)})}
|
|
|
|
|
h.Ad=function(a,b,c,d,e){var f=this.B;f.zb=65536-e&65535;f.xb=d&65535;f.T=f.T&-769|d>>8&768;f.eb=d>>16&63;e=~~(c/f.da[0]);d=~~(e/f.hb[0]);f.Fa[b.Na]=e%f.hb[0]<<8|c%f.da[0];f.bc[b.Na]=f.Ra[b.Na]=d;f.ob|=1<<b.Na;c>=b.bd-1&&(f.ua[b.Na]|=1024);switch(a){case 1:f.Ea|=512;f.T|=49152;break;case 2:f.Ea|=2048,f.T|=49152}K(this.b,20,5,172,function(){f.ua[b.Na]|=128;f.T=f.T&65534|128;return!!(f.T&64)})};
|
|
|
|
|
function ic(a,b,c,d,e,f){var g=~~((f+c.Wa-1)/c.Wa),k=new XMLHttpRequest;2048>g&&d+2048<c.bd&&(g=2048);k.open("GET",c.url,!0);k.setRequestHeader("Range","bytes="+(d*c.Wa<<1)+"-"+(((d+g)*c.Wa<<1)-1));k.responseType="arraybuffer";k.onreadystatechange=function(){if(4==k.readyState){var g=b.bind(a),n,p,t,r;n=k.response;if(k.status&&206!=k.status||!n)c.Yb(1,c,d,e,f);else{n=new Uint8Array(n);p=d;for(r=0;r<n.length;){if("undefined"===typeof c.cache[p])for(c.cache[p]=[],t=0;t<c.Wa;t++)c.cache[p][t]=r<n.length?
|
|
|
|
|
n[r]&255|n[r+1]<<8&65280:0,r+=2;else r+=c.Wa<<1;p++}g(c,d,e,f)}}};k.send(null)}function M(a,b,c,d,e){c&1?e?d=0<=d?d<<8&65280|b&255:b:a.b.K(4,122):0<=d?e&&(d=b&65280|d&255):d=b;return d}h.$b=function(a,b,c,d){for(var e;0<d;){if("undefined"===typeof a.cache[b]){ic(this,this.$b,a,b,c,d);return}for(e=0;e<a.Wa&&0<d;e++){if(0>this.b.Cb(a.ad?jc(this.b,c):c,a.cache[b][e])){a.Yb(2,a,b,c,d);return}c+=2;--d}b++}a.Yb(0,a,b,c,d)};
|
|
|
|
|
function Wb(a,b,c,d,e){for(var f,g;0<e;){if("undefined"===typeof b.cache[c])for(b.cache[c]=[],f=0;f<b.Wa;f++)b.cache[c][f]=0;for(f=0;f<b.Wa&&0<e;f++){g=a.b.wb(b.ad?jc(a.b,d):d);if(0>g){b.Yb(2,b,c,d,e);return}b.cache[c][f]=g;d+=2;--e}c++}b.Yb(0,b,c,d,e)}h.reset=function(){this.g.tb=this.g.tb&-120|20;this.f.Ya=0;this.D.P=128;this.w.M=128;gc(this)};
|
|
|
|
|
h.Sc=function(a,b,c){var d,e,f=this.b;switch(a&-64){case 4194240:switch(a&-2){case 4194300:0>b?d=f.cb&65280:(a&1&&(b<<=8),f.cb=b|255,d=0);break;case 4194298:if(0>b)d=f.oc;else{a&1&&(b<<=8);if(d=b&65024){e=d>>9;do d+=34;while(e>>=1)}f.oc=d;f.C|=2}break;case 4194294:if(70!==f.lb)return f.K(4,222);0>b?d=f.I:d=f.I=0;break;case 4194292:if(70!==f.lb)return f.K(4,224);d=1;break;case 4194290:if(70!==f.lb)return f.K(4,226);d=0;break;case 4194288:if(70!==f.lb)return f.K(4,228);d=61183;break;case 4194296:0<=
|
|
|
|
|
b&&!(a&1)&&(b&=255);case 4194286:case 4194284:case 4194282:case 4194280:case 4194278:case 4194276:case 4194274:case 4194272:if(70!==f.lb)return f.K(4,232);e=a-4194272>>1;0>b?d=f.jc[e]:(d=M(this,f.jc[e],a,b,c),0<=d&&(f.jc[e]=d));break;case 4194254:return a&1?f.O>>14&1?(0<=b&&(f.u[6]=b),d=f.u[6]):(0<=b&&(f.Aa[3]=b),d=f.Aa[3]):f.O>>14&0?(0<=b&&(f.u[6]=b),d=f.u[6]):(0<=b&&(f.Aa[1]=b),d=f.Aa[1]),d;case 4194252:case 4194250:case 4194248:return e=a&7,f.O&2048?(0<=b&&(f.u[e]=b),d=f.u[e]):(0<=b&&(f.Qa[e]=
|
|
|
|
|
b),d=f.Qa[e]),d;case 4194246:return a&1?(0<=b&&(f.u[7]=b),d=f.u[7]):f.O>>14&0?(0<=b&&(f.u[6]=b),d=f.u[6]):(0<=b&&(f.Aa[0]=b),d=f.Aa[0]),d;case 4194244:case 4194242:case 4194240:return e=a&7,f.O&2048?(0<=b&&(f.Qa[e]=b),d=f.Qa[e]):(0<=b&&(f.u[e]=b),d=f.u[e]),d;default:return f.I|=16,f.K(4,124)}break;case 4194176:e=a>>1&31;d=M(this,f.za[3][e],a,b,c);0<=d&&(f.za[3][e]=d,f.za[3][e&15]&=65295);break;case 4194112:switch(a&-2){case 4194174:d=M(this,f.ac,a,b,c);0<=d&&(f.ac=d);break;case 4194172:d=f.ab;d&65280&&
|
|
|
|
|
(d=(d<<8|d>>8)&65535);break;case 4194168:0>b?d=this.g.Id&65535:(d=M(this,this.g.data,a,b,c),0<=d&&(this.g.data=d));break;default:return f.I|=16,f.K(4,126)}break;case 4194048:e=this.D;switch(a&-2){case 4194048:d=M(this,e.Mb,a,b,c);0<=d&&(e.Mb=d);break;case 4194050:d=M(this,e.oa,a,b,c);0<=d&&(e.oa=d);break;case 4194052:d=M(this,e.P,a,b,c);0<=b&&0<=d&&(e.P=d&-36993|e.P&36992,e.P&1&&Vb(this));break;case 4194054:d=M(this,e.Nb,a,b,c);0<=d&&(e.Nb=d);break;case 4194056:d=M(this,e.Lb,a,b,c);0<=d&&(e.Lb=d);
|
|
|
|
|
break;case 4194058:d=M(this,e.xa,a,b,c);0<=d&&(e.xa=d);break;case 4194060:break;case 4194062:d=M(this,e.Jc,a,b,c);0<=d&&(e.Jc=d);break;default:return f.I|=16,f.K(4,128)}break;case 4193728:var g=this.B;e=g.Ea&7;switch(a&-2){case 4193728:d=M(this,g.T,a,b,c);0<=b&&0<=d&&(g.eb=g.eb&60|d>>8&3,g.T=d&17279|g.T&34944|2048,d&1&&g.T&128?hc(this,e):192==(d&192)&&K(f,0,5,172));break;case 4193730:d=M(this,g.zb,a,b,c);0<=d&&(g.zb=d);break;case 4193732:d=M(this,g.xb,a,b,c);0<=d&&(g.xb=d&65534);break;case 4193734:d=
|
|
|
|
|
M(this,g.Fa[e],a,b,c);0<=d&&(g.Fa[e]=d&7967);break;case 4193736:d=M(this,g.Ea,a,b,c);0<=d&&(g.Ea=d&63|g.Ea&65472,d&128&&gc(this));break;case 4193738:d=g.ua[e];break;case 4193740:d=g.yb[e];break;case 4193742:d=M(this,g.ob,a,b,c);0<=d&&(g.ob=d&255);break;case 4193744:d=g.Fd[e];break;case 4193746:d=M(this,g.Kc,a,b,c);0<=d&&(g.Kc=d);break;case 4193748:d=M(this,g.Lc[e],a,b,c);0<=d&&(g.Lc[e]=d&1023);break;case 4193750:d=8210;break;case 4193752:d=g.Gd[e];break;case 4193754:d=M(this,g.Mc[e],a,b,c);0<=d&&
|
|
|
|
|
(g.Mc[e]=d);break;case 4193756:d=M(this,g.Ra[e],a,b,c);0<=d&&(g.Ra[e]=d&511);break;case 4193758:g.bc[e]=g.Ra[e];d=g.bc[e];break;case 4193760:d=g.Dd[e];break;case 4193762:d=g.Ed[e];break;case 4193764:d=g.Bd[e];break;case 4193766:d=g.Cd[e];break;case 4193768:d=M(this,g.eb,a,b,c);0<=d&&(g.eb=d&63,g.T=g.T&-769|(d&3)<<8);break;case 4193770:d=M(this,g.pc,a,b,c);0<=d&&(g.pc=d);break;default:return f.I|=16,f.K(4,132)}break;case 4192512:e=this.w;switch(a&-2){case 4192512:d=M(this,e.M,a,b,c);0<=b&&0<=d&&(e.Va=
|
|
|
|
|
e.Va&60|d>>4&3,e.M=e.M&-1023|d&1022,e.M&128||fc(this));break;case 4192514:d=M(this,e.Fb,a,b,c);0<=d&&(e.Fb=d&65534);break;case 4192516:d=M(this,e.fa,a,b,c);0<=d&&(e.fa=d);break;case 4192518:d=M(this,e.Za,a,b,c);0<=d&&(e.Za=d);break;case 4192520:d=M(this,e.Va,a,b,c);0<=d&&(e.Va=d&63,e.M=e.M&-49|(e.Va&3)<<4);break;default:return f.I|=16,f.K(4,134)}break;case 4191552:switch(a&-2){case 4191566:0>b?d=f.bb:(d=M(this,f.bb,a,b,c),0<=d&&(70!==f.lb&&(d&=-49),f.bb=d,f.Xb[0]=d&4?15:7,f.Xb[1]=d&2?15:7,f.Xb[3]=
|
|
|
|
|
d&1?15:7,f.kc&&(e=2,f.bb&16&&(e=1),this.g.tb=this.g.tb&-8|e)));break;default:return f.I|=16,f.K(4,136)}break;case 4191424:e=a>>1&31;d=M(this,f.za[0][e],a,b,c);0<=d&&(f.za[0][e]=d,f.za[0][e&15]&=65295);break;case 4191360:e=a>>1&31;d=M(this,f.za[1][e],a,b,c);0<=d&&(f.za[1][e]=d,f.za[1][e&15]&=65295);break;case 4190400:case 4190336:if(70!==f.lb)return f.K(4,234);e=a>>2&31;d=f.Pb[e];a&2&&(d>>=16);d&=65535;0<=b&&(d=M(this,d,a,b,c),0<=d&&(f.Pb[e]=a&2?d<<16|f.Pb[e]&65535:f.Pb[e]&4294901760|d&65534));break;
|
|
|
|
|
case 4188672:case 4188736:case 4188800:case 4188864:case 4188928:case 4188992:case 4189056:case 4189120:if(0>b)d=Pb[a>>1&255];else return f.I|=16,f.K(4,138);break;default:return f.I|=16,f.K(4,142)}c&&0<=d&&(a&1?d>>=8:d&=255);"undefined"===typeof d&&console.log("panic(76)");return d};
|
|
|
|
|
var N={},L=(N[62592]=[null,null,J.prototype.rd,J.prototype.Wd,"SISDR"],N[62608]=[null,null,J.prototype.pd,J.prototype.Ud,"SDSDR"],N[62624]=[null,null,J.prototype.qd,J.prototype.Vd,"SISAR"],N[62640]=[null,null,J.prototype.od,J.prototype.Td,"SDSAR"],N[62656]=[null,null,J.prototype.hd,J.prototype.Nd,"KISDR"],N[62672]=[null,null,J.prototype.fd,J.prototype.Ld,"KDSDR"],N[62688]=[null,null,J.prototype.gd,J.prototype.Md,"KISAR"],N[62704]=[null,null,J.prototype.ed,J.prototype.Kd,"KDSAR"],N[65382]=[null,null,
|
|
|
|
|
J.prototype.jd,J.prototype.Od,"LKS"],N[65402]=[null,null,J.prototype.kd,J.prototype.Pd,"MMR0"],N[65408]=[null,null,J.prototype.vd,J.prototype.$d,"UISDR"],N[65424]=[null,null,J.prototype.td,J.prototype.Yd,"UDSDR"],N[65440]=[null,null,J.prototype.ud,J.prototype.Zd,"UISAR"],N[65456]=[null,null,J.prototype.sd,J.prototype.Xd,"UDSAR"],N[65534]=[null,null,J.prototype.ld,J.prototype.Qd,"PSW"],N);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];
|
|
|
|
|
Ma(function(){for(var a=A(document,"pdp11","device"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new J(d);fb(d,c)}});var kc;if(xb){var lc=new ArrayBuffer(2);(new DataView(lc)).setUint16(0,256,!0);kc=256===(new Uint16Array(lc))[0]}else kc=!1;var mc=kc;
|
|
|
|
|
function H(a,b,c,d,e){this.id=nc+=2;this.b=null;this.A=a;this.Rb=b;this.size=c||0;this.type=d||oc;this.f=d==pc;this.controller=null;Cb(this);this.Xa=this.Vc=!1;if(c)if(e)this.controller=e,this.b=null,qc(this,e.Db);else if(xb)this.D=new ArrayBuffer(c),this.B=new DataView(this.D,0,c),this.w=new Uint8Array(this.D,0,c),this.H=new Uint16Array(this.D,0,c>>1),this.b=new Int32Array(this.D,0,c>>2),qc(this,mc?rc:sc);else{this.b=Array(c>>2);for(a=0;a<this.b.length;a++)this.b[a]=0;qc(this,tc)}else qc(this)}
|
|
|
|
|
var oc=0,pc=2,Ib=4,Kb=["NONE","RAM","ROM","VID","H/W"],nc=0;
|
|
|
|
|
H.prototype={constructor:H,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(xb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.B.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(xb)for(b=0;b<a.length;b++)this.B.setInt32(b<<2,a[b],!0);else this.b=a;return this.Xa=!0}return!1},jb:function(a,b){b?this.F++||uc(this,vc,!1):this.g++||wc(this,vc,!1)},J:function(){this.j&&F(this.j,128)&&(D(this.j,"attempt to read invalid block %"+
|
|
|
|
|
l(this.A),!0),this.j.ia());return 255},L:function(a,b){this.j&&F(this.j,128)&&(D(this.j,"attempt to write "+l(b,4,!0)+" to invalid block %"+l(this.A),!0),this.j.ia())},N:function(a,b){return this.Zb(a++,b++)|this.Zb(a,b)<<8},G:function(a,b,c){this.cc(a++,b&255,c++);this.cc(a,b>>8,c)},Z:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ka:function(a){var 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},ra:function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<<
|
|
|
|
|
a)|b<<a;this.Xa=!0},Ca:function(a,b){var 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.Xa=!0},S:function(a,b){if(this.j&&null!=this.A){var c=this.j;xc(c,this.A+a,1,c.S)&&c.ia(!0)}return this.lc(a,b)},ea:function(a,b){if(this.j&&null!=this.A){var c=this.j;xc(c,this.A+a,2,c.S)&&c.ia(!0)}return this.mc(a,b)},na:function(a,b,c){if(this.j&&null!=this.A){var d=this.j;xc(d,this.A+a,1,d.G)&&d.ia(!0)}this.f?this.L(a,
|
|
|
|
|
b,c):this.dc(a,b,c)},ya:function(a,b,c){if(this.j&&null!=this.A){var d=this.j;xc(d,this.A+a,2,d.G)&&d.ia(!0)}this.f?this.L(a,b,c):this.tc(a,b,c)},R:function(a){return this.w[a]},X:function(a,b){a=this.w[a];this.j&&F(this.j,128)&&D(this.j,"Memory.readByte("+I(this.j,b)+"): "+I(this.j,a),!0);return a},$:function(a){return this.B.getUint16(a,!0)},ha:function(a,b){a=this.H[a>>1];this.j&&F(this.j,128)&&D(this.j,"Memory.readWord("+I(this.j,b)+"): "+I(this.j,a),!0);return a},la:function(a,b){this.w[a]=b;
|
|
|
|
|
this.Xa=!0},qa:function(a,b,c){this.w[a]=b;this.Xa=!0;this.j&&F(this.j,128)&&D(this.j,"Memory.writeByte("+I(this.j,c)+","+I(this.j,b)+")",!0)},va:function(a,b){this.B.setUint16(a,b,!0);this.Xa=!0},Ba:function(a,b,c){this.H[a>>1]=b;this.Xa=!0;this.j&&F(this.j,128)&&D(this.j,"Memory.writeWord("+I(this.j,c)+","+I(this.j,b)+")",!0)}};function Cb(a,b,c){a.j=b;a.g=a.F=0;c&&((a.g=c.g)&&wc(a,vc,!1),(a.F=c.F)&&uc(a,vc,!1))}
|
|
|
|
|
function yc(a,b){b?--a.F||(a.cc=a.f?a.L:a.dc,a.Pc=a.f?a.G:a.tc):--a.g||(a.Zb=a.lc,a.Hc=a.mc)}function uc(a,b,c){c&&a.F||(a.cc=!a.f&&b[1]||a.L,a.Pc=!a.f&&b[3]||a.G);if(c||void 0===c)a.dc=b[1]||a.L,a.tc=b[3]||a.G}function wc(a,b,c){c&&a.g||(a.Zb=b[0]||a.J,a.Hc=b[2]||a.N);if(c||void 0===c)a.lc=b[0]||a.J,a.mc=b[2]||a.N}function qc(a,b){b||(b=zc);wc(a,b,void 0);uc(a,b,void 0)}var zc=[],tc=[H.prototype.Z,H.prototype.ra,H.prototype.ka,H.prototype.Ca],vc=[H.prototype.S,H.prototype.na,H.prototype.ea,H.prototype.ya];
|
|
|
|
|
if(xb)var sc=[H.prototype.R,H.prototype.la,H.prototype.$,H.prototype.va],rc=[H.prototype.X,H.prototype.qa,H.prototype.ha,H.prototype.Ba];function Ac(a,b){u.call(this,"CPU",a,Ac,1);var c=a.multiplier||1;this.Ta=a.cycles||b;this.$a=c;this.qb=Math.round(this.Ta/1E4)/100;this.nb=this.qb*this.$a;this.v.ga=!1;this.v.rc=!1;this.v.Eb=a.autoStart;this.v.wc=!1;this.v.rb=!1;this.Ib=this.na=0;this.Jb=a.csStart;this.ub=a.csInterval;this.vb=a.csStop;this.N=[];this.Ec=this.Hd.bind(this);G(this)}y(Ac);
|
|
|
|
|
var Bc=["power","reset"];h=Ac.prototype;h.Pa=function(a,b,c,d){this.D=a;this.F=b;this.j=d;for(b=0;b<Bc.length;b++)(c=this.L[Bc[b]])&&this.D.pa(null,Bc[b],c);this.va=null;a=Cc(a,"autoStart");null!=a&&(this.v.Eb="true"==a?!0:"false"==a?!1:!!a);G(this)};h.reset=function(){};h.save=function(){return null};h.restore=function(){return!1};
|
|
|
|
|
h.Ka=function(a,b){if(!b){if(a&&this.restore){Dc(this);if(!this.restore(a))return!1;Ec(this)}else this.reset();this.j?(a=this.j,a.i("Type ? for help with PDP11 Debugger commands"),a.Ga(),a.Ta&&(b=a.Ta,a.Ta=null,Fc(a,b))):this.i("No debugger detected")}O(this);return!0};h.Ja=function(a){return a?this.save():!0};h.Eb=function(){return this.v.Eb||!this.j&&void 0===this.L.run?(this.Ab(!0),!0):!1};h.zc=function(){return 0};
|
|
|
|
|
function Ec(a){void 0===a.Jb&&(a.Jb=0);void 0===a.ub&&(a.ub=-1);void 0===a.vb&&(a.vb=-1);a.v.rb=0<=a.Jb&&0<a.ub;a.v.rb&&(a.Ib=0,a.na=a.Jb-a.la)}function Gc(a,b){if(a.v.rb){var c=!1;a.Ib=a.Ib+a.zc()|0;a.na-=b;0>=a.na&&(a.na+=a.ub,c=!0);0<=a.vb&&a.vb<=Hc(a)&&(a.ub=a.vb=-1,Ec(a),a.ia(),c=!0);c&&a.i(Hc(a)+" cycles: checksum="+l(a.Ib))}}
|
|
|
|
|
function Ic(a,b,c,d){if(a.L[b]){void 0===c&&(kb(a,"Value for "+b+" is invalid"),a.ia());var e=a.j&&a.j.na||8;c=!a.v.ga||a.v.wc?8==e?ca(c,d):l(c,d):"--------".substr(0,d||4);a.L[b].textContent!=c&&(a.L[b].textContent=c)}}
|
|
|
|
|
h.pa=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.L[b]=c;a=!0;break;case "run":this.L[b]=c;c.onclick=function(){var a;if(a=d.D)if(a=d.D,a.v.ja)a=!0;else{var b=null,c,k=cb(a.id);for(c=0;c<k.length&&(b=k[c],b===a||b.v.ready);c++);if(c==k.length)for(c=0;c<k.length&&(b=k[c],b===a||b.v.ja);c++);c==k.length&&(b=a);q("The "+b.type+" component ("+b.id+") is not "+(b.v.ready?"powered yet":"ready yet"+(b.Ub?" (waiting for notification)":""))+".");a=!1}a&&(d.v.ga?d.ia():d.Ab())};
|
|
|
|
|
a=!0;break;case "speed":this.L[b]=c;a=!0;break;case "setSpeed":this.L[b]=c,c.onclick=function(){Jc(d,d.$a<<1,!0)},c.textContent=this.nb.toFixed(2)+"Mhz",a=!0}return a};function Kc(a,b,c){a.la+=b;c&&(a.S=a.b=0)}function Lc(a,b){var c=1;b&&1<a.$a&&a.ha&&(c=a.ha/a.qb);a.Wb=Math.round(1E3/30);a.fb=Math.floor(a.Ta/30*c);b||(a.qa=a.fb);a.sb=0}function Hc(a){return a.la+a.$+a.S-a.b}function Dc(a){a.ha=0;a.Cc=0;a.la=a.$=a.S=a.b=0;Ec(a);Jc(a,1)}
|
|
|
|
|
function Jc(a,b,c){var d=!1;if(void 0!==b){.8>a.ha/a.nb?b=1:d=!0;a.$a=b;b=a.qb*a.$a;if(a.nb!=b){a.nb=b;b=a.nb.toFixed(2)+"Mhz";var e=a.L.setSpeed;e&&(e.textContent=b);a.i("target speed: "+b)}c&&a.D&&a.D.Qb()}Kc(a,a.$);a.$=0;a.Z=sa();a.ka=0;Lc(a);return d}function Qb(a,b){var c=a.N.length;a.N.push([-1,b]);return c}function Rb(a,b,c){0<=b&&b<a.N.length&&0>a.N[b][0]&&(c*=a.Ta*a.$a/1E3,a.N[b][0]=c)}function ed(a,b){for(var c=a.N.length-1;0<=c;c--){var d=a.N[c];0>d[0]||b>d[0]&&(b=d[0])}return b}
|
|
|
|
|
function fd(a,b){for(var c=a.N.length-1;0<=c;c--){var d=a.N[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}
|
|
|
|
|
h.Hd=function(){if(this.v.ga){this.sb>=this.Ta&&Lc(this,!0);this.ya=0;this.Sa=sa();if(this.ka){var a=this.Sa-this.ka;a>this.Wb&&(this.Z+=a,this.Z>this.Sa&&(this.Z=this.Sa))}try{do{var b=ed(this,this.v.rb?1:this.fb);try{this.Bb(b)}catch(e){if("number"!=typeof e)throw e;}var c=this.S-this.b;fd(this,c);this.ya+=c;this.$+=c;Kc(this,0,!0);Gc(this,c);this.qa-=c;if(0>=this.qa){this.qa+=this.fb;15<=++this.Cc&&(this.D&&this.D.Ga(),this.Cc=0);break}}while(this.v.ga)}catch(e){this.ia();O(this);this.D&&this.D.stop(sa(),
|
|
|
|
|
Hc(this));kb(this,e.stack||e.message);return}if(this.v.ga){a=setTimeout;b=this.Ec;this.ka=sa();c=this.Wb;this.ya&&(c=Math.round(c*this.ya/this.fb));var c=c-(this.ka-this.Sa),d=this.ka-this.Z;d&&(this.ha=Math.round(this.$/(10*d))/100,864E5<=d&&(this.la=0,Jc(this)));if(0>c||this.ha<this.nb)-1E3>c&&(this.Z-=c),c=0;this.sb+=this.ya;this.ka+=c;a(b,c)}}};
|
|
|
|
|
h.Ab=function(a){if(jb(this))return!1;if(this.v.ga)return this.i(this.toString()+" busy"),!1;Jc(this);this.v.ga=!0;this.v.rc=!0;this.va&&this.va.start();var b=this.L.run;b&&(b.textContent="Halt");this.D&&(a&&this.D.Qb(!0),this.D.start(this.Z,Hc(this)));O(this,!0);setTimeout(this.Ec,0);return!0};h.Bb=function(){return 0};
|
|
|
|
|
h.ia=function(a){if(this.v.ga){this.S-=this.b;this.b=0;Kc(this,this.$);this.$=0;this.v.ga=!1;this.va&&this.va.stop();var b=this.L.run;b&&(b.textContent="Run");this.D&&this.D.stop(sa(),Hc(this));O(this)}this.v.complete=a};function O(a,b){a.D&&a.D.Ga(b)}
|
|
|
|
|
function gd(a){this.cd=+a.model||1170;this.dd=a.resetAddr||0;Ac.call(this,a,6666667);this.Tb=0;this.decode=hd.bind(this);this.U=65536;this.V=32768;this.ba=65535;this.Y=32768;this.O=15;this.u=[0,0,0,0,0,0,0,this.dd];this.Qa=[0,0,0,0,0,0];this.Aa=[0,0,0,0];this.Ca=this.B=0;this.Yc=[4,2,0,1];this.W=[[0,0,0,0,0,0,0,0,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]];this.wa=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.za=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.Pb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
|
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.jc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.g=this.f=this.pb=this.H=this.J=this.C=0;this.lb=70;this.ra=-1;id(this);this.v.complete=this.v.Uc=!1}y(gd,Ac);h=gd.prototype;h.reset=function(){this.v.ga&&this.ia();id(this);Dc(this);this.v.error=!1;this.parent.reset.call(this)};function id(a){a.cb=255;a.I=0;a.oc=0;a.G=0;a.ab=0;a.ac=0;a.bb=0;a.kc=0;a.Ba=0;a.Xb=262143;a.Vb=253952;a.w=[];a.C|=2;Sb(a)}
|
|
|
|
|
function Sb(a){a.kc?(a.ea=65536,a.R=a.Xc,a.X=a.Ic,a.Fc=a.ae):(a.ea=0,a.R=a.Wc,a.X=a.wb,a.Fc=a.Cb)}h.zc=function(){return 0};h.save=function(){var a=new P(this);a.set(0,[]);a.set(1,[this.la,this.$a]);a.set(2,Mb(this.F));return a.data()};
|
|
|
|
|
h.restore=function(a){var b=a[1];this.la=b[1];Jc(this,b[3]);a:{b=this.F;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.G){for(var f=0,g=Array(b.G),k=0;k<e.length-1;)for(var m=e[k++],n=e[k++];m--;)g[f++]=n;e=g}f=b.aa[d];if(!f||!f.restore(e)){q("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
|
|
|
|
|
h.pa=function(a,b,c){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":this.L[b]=c;this.Tb++;a=!0;break;default:a=this.parent.pa.call(this,a,b,c)}return a};
|
|
|
|
|
h.Ga=function(a){if(this.Tb&&(a||!this.v.ga||this.v.wc)){for(a=0;a<this.u.length;a++)Ic(this,"R"+a,this.u[a]);a=Tb(this);Ic(this,"PS",a);Ic(this,"NF",a&8?1:0,1);Ic(this,"ZF",a&4?1:0,1);Ic(this,"VF",a&2?1:0,1);Ic(this,"CF",a&1?1:0,1)}if(a=this.L.speed)a.textContent=this.v.ga&&this.ha?this.ha.toFixed(2)+"Mhz":"Stopped"};function jd(a){return a.U&65536?1:0}function kd(a){return a.V&32768?2:0}function ld(a){return a.ba&65535?0:4}h.Oa=function(){return this.Y&32768?8:0};
|
|
|
|
|
function md(a){var b=a.X(a.u[7]);a.u[7]=a.u[7]+2&65535;return b}function nd(a,b){a.u[7]=b&65535}function K(a,b,c,d,e){for(var f=a.w.length;0<f--;)if(a.w[f].Oc===d){0<f&&(a.w[f-1].Ma+=a.w[f].Ma);a.w.splice(f,1);break}if(0<=b){for(f=a.w.length;0<f--;){if(a.w[f].Ma>b){a.w[f].Ma-=b;break}b-=a.w[f].Ma}a.w.splice(f+1,0,{Ma:b,Gc:c<<5&224,Oc:d,ic:e})}a.C|=2}function Tb(a){return a.O=a.O&63728|a.Oa()|ld(a)|kd(a)|jd(a)}
|
|
|
|
|
function Ub(a,b){a.Y=b<<12;a.ba=~b&4;a.V=b<<14;a.U=b<<16;if((b^a.O)&2048)for(var c=a.Qa.length;0<=--c;){var d=a.u[c];a.u[c]=a.Qa[c];a.Qa[c]=d}a.B=b>>14&3;c=a.O>>14&3;a.B!=c&&(a.Aa[c]=a.u[6],a.u[6]=a.Aa[a.B]);a.C|=2;a.O=b}function Q(a,b){a.C&128||(a.Y=a.ba=b,a.V=0)}function od(a,b,c){a.C&128||(a.Y=a.ba=a.U=b,a.V=c||0)}function pd(a,b,c,d){a.C&128||(a.Y=a.ba=a.U=b,a.V=(c^b)&(d^b))}function qd(a,b){a.C&128||(a.Y=a.ba=a.U=b,a.V=a.Y^a.U>>1)}
|
|
|
|
|
function rd(a,b,c,d){a.C&128||(a.Y=a.ba=a.U=b,a.V=(c^d)&(d^b))}h.K=function(a){var b=!1;0>this.ra?this.ra=Tb(this):this.B||(a=4,b=!0);this.G&57344||(this.ab=63222,this.ac=a);this.B=0;var c=this.X(a|this.ea),d=this.X(a+2&65535|this.ea);Ub(this,d&-12289|this.ra>>2&12288);b&&(this.I|=4,this.u[6]=4);sd(this,this.ra);sd(this,this.u[7]);nd(this,c);this.C&=-113;this.ra=-1;throw a;};function td(a){var b=ud(a),c=ud(a)&-1793;a.O&49152&&(c=c&-225|a.O&63712);nd(a,b);Ub(a,c);a.C&=-17}
|
|
|
|
|
function jc(a,b){var c=b>>13&31;31>c?a.bb&32&&(b=a.Pb[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)")):b|=4186112;return b}
|
|
|
|
|
function vd(a,b,c){var d,e,f,g=0;d=b>>13;a.bb&a.Yc[a.B]||(d&=7);e=a.W[a.B][d];f=(a.wa[a.B][d]<<6)+(b&8191)&a.Xb;f<a.Vb?f&1&&!(c&1)&&(a.I|=64,a.K(4,10)):(a.bb&16||253952<=f&&(f|=4186112),4186112>f&&(3932160<=f&&(f=jc(a,f&262143)),f>=a.Vb&&4186112>f&&(a.I|=32,a.K(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.W[a.B][d]=e;if(4194170!==f||a.B)a.Ba=a.B,a.Ca=d;g&&(g&57344&&(0<=a.ra&&(g|=128),a.G&57344||(a.G=a.G|g|a.Ba<<5|a.Ca<<1),a.K(168,16)),a.G&61440||!(4191360>f||4194239<f)||(a.G|=4096,a.G&512&&(a.C|=32)));return f}function ud(a){var b=a.X(a.u[6]|a.ea);a.u[6]=a.u[6]+2&65535;return b}function sd(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.G&57344||(a.ab=a.ab<<8|246);!a.B&&c<=a.cb&&4<c&&(c<=a.cb-32?(a.I|=4,a.u[6]=4,a.K(4,18)):(a.I|=8,a.C|=4));a.Fc(c,b)}
|
|
|
|
|
function wd(a,b,c,d){var e,f,g=d&8?0:a.ea;switch(b){case 0:return a.K(4,20),0;case 1:return 6===c&&!a.B&&d&4&&(a.u[6]<=a.cb||65534<=a.u[6])&&(a.u[6]<=a.cb-32||65534<=a.u[6]?(a.I|=4,a.u[6]=4,a.K(4,22)):(a.I|=8,a.C|=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.X(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.X(e)|g;a.b-=
|
|
|
|
|
8;break;case 6:return e=md(a),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=md(a),e=e+a.u[c]&65535,e=a.X(e|a.ea)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;!g||a.G&57344||(a.ab=a.ab<<8|f<<3&248|c);6==c&&!a.B&&d&4&&0>=f&&(a.u[6]<=a.cb||65534<=a.u[6])&&(a.u[6]<=a.cb-32?(a.I|=4,a.u[6]=4,a.K(4,24)):(a.I|=8,a.C|=64));return e}h.Wc=function(a,b,c){return wd(this,a,b,c)};h.Xc=function(a,b,c){return vd(this,wd(this,a,b,c),c)};h.wb=function(a){a&1&&(this.I|=64,this.K(4,10));return this.F.Ia(a)};
|
|
|
|
|
h.Ic=function(a){return this.wb(vd(this,a,2))};h.Cb=function(a,b){a&1&&(this.I|=64,this.K(4,10));this.F.qc(a,b&65535)};h.ae=function(a,b){this.Cb(vd(this,a|65536,4),b)};function xd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=wd(a,b,d,2),c&65536||61440!==(a.O&61440)&&(d&=65535),a.B=a.O>>12&3,c=a.X(d|c&a.ea),a.B=a.O>>14&3):c=6!=d||(a.O>>2&12288)===(a.O&12288)?a.u[d]:a.Aa[a.O>>12&3];return c}
|
|
|
|
|
function yd(a,b,c,d){a.G&57344||(a.ab=22);var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=wd(a,b,e,4),c&65536||(e&=65535),a.B=a.O>>12&3,e=vd(a,e|c&65536,4),a.B=a.O>>14&3,a.Cb(e,d)):6!=e||(a.O>>2&12288)===(a.O&12288)?a.u[e]=d:a.Aa[a.O>>12&3]=d}function zd(a,b){b>>=6;var c=a.J=b&7;(b=a.H=(b&56)>>3)?(c=a.R(b,c,3),a=a.F.mb(c)):a=a.u[c]&255;return a}function Ad(a,b){var c;b>>=6;var d=a.J=b&7;(b=a.H=(b&56)>>3)?c=a.wb(a.R(b,d,2)):c=a.u[d];return c}function Bd(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return wd(a,b,c,8)}
|
|
|
|
|
function Cd(a,b){var c=a.f=b&7;(b=a.g=(b&56)>>3)?(c=a.R(b,c,3),a=a.F.mb(c)):a=a.u[c]&255;return a}function Dd(a,b){var c,d=a.f=b&7;(b=a.g=(b&56)>>3)?c=a.wb(a.R(b,d,2)):c=a.u[d];return c}function R(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.pb=a.R(b,e,7),c=d.call(a,c,a.F.mb(e)),e&1&&a.b--,a.F.Ob(e,c&255)):a.u[e]=a.u[e]&65280|d.call(a,c,a.u[e])}function S(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.R(b,e,6),a.Cb(e,d.call(a,c,a.wb(e)))):a.u[e]=d.call(a,c,a.u[e])}
|
|
|
|
|
function Ed(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(d=a.R(b,e,5),d&1&&a.b--,a.F.Ob(d,c&255)):a.u[e]=c?d&1?c<<24>>24&65535:a.u[e]&-256|c&255:a.u[e]&-256;return c}function Fd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?a.Cb(a.R(b,d,4),c):a.u[d]=c&65535;return c}function T(a,b,c){c&&(nd(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3}
|
|
|
|
|
h.Bb=function(a){this.v.complete=!0;var b=this.v.Uc=this.j&&Gd(this.j),c=a?this.v.rc?0:1:-1;this.v.rc=!1;this.S=this.b=a;do{if(b){if(Hd(this.j,this.u[7],c)){this.ia();break}c=1}if(this.C&&(this.C&112&&(this.C&32?this.K(168,28):this.C&64?this.K(4,30):this.C&16&&this.K(12,32),this.C&=-113),this.C&7))if(this.C&2){this.C&=-3;a=null;for(var d=this.oc&224,e=this.w.length;0<=--e;){if(0<this.w[e].Ma){this.w[e].Ma--;this.C|=2;break}if(this.w[e].ic){if(!this.w[e].ic()){this.w.splice(e,1);continue}this.w[e].ic=
|
|
|
|
|
null}this.w[e].Gc>d&&(d=this.w[e].Gc,a=this.w[e],this.w.splice(e,1))}d>(this.O&224)&&(this.C&4&&(this.u[7]=this.u[7]+2&65535,this.C&=-5),a?this.K(a.Oc,26):this.K(160,26))}else this.C&1&&this.C++;this.G&57344||(this.ab=0,this.ac=this.u[7]);this.C=this.C&7|this.O&16;this.decode(md(this))}while(0<this.b);return this.v.complete?this.S-this.b:void 0===this.v.complete?0:-1};Ma(function(){for(var a=A(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new gd(d);fb(d,c)}});
|
|
|
|
|
function Id(a,b){var c=b+a;pd(this,c,a,b);return c&65535}function Jd(a,b){var c=b+a;pd(this,c<<8,a<<8,b<<8);return c&255}function Kd(a,b){a=b<<1;qd(this,a);return a&65535}function Ld(a,b){a=b<<1;qd(this,a<<8);return a&255}function Md(a,b){a=b&32768|b>>1|b<<16;qd(this,a);return a&65535}function Nd(a,b){a=b&2048|b>>1|b<<8;qd(this,a<<8);return a&255}function Od(a,b){a=b&~a;Q(this,a);return a}function Pd(a,b){a=b&~a;Q(this,a<<8);return a}function Qd(a,b){a|=b;Q(this,a);return a}
|
|
|
|
|
function Rd(a,b){a|=b;Q(this,a<<8);return a}function Sd(a,b){a=~b|65536;od(this,a);return a&65535}function Td(a,b){a=~b|256;od(this,a<<8);return a&255}function Ud(a,b){a=b-a;this.C&128||(this.Y=this.ba=a,this.V=b&(b^a));return a&65535}function Vd(a,b){a=b-a;var c=a<<8;b<<=8;this.C&128||(this.Y=this.ba=c,this.V=b&(b^c));return a&255}function Wd(a,b){a=b+a;this.C&128||(this.Y=this.ba=a,this.V=a&(b^a));return a&65535}
|
|
|
|
|
function Xd(a,b){a=b+a;var c=a<<8;this.C&128||(this.Y=this.ba=c,this.V=c&(b<<8^c));return a&255}function Yd(a,b){a=-b;od(this,a,a&b&32768);return a&65535}function Zd(a,b){a=-b;od(this,a<<8,(a&b&128)<<8);return a&255}function $d(a,b){a=b<<1|this.U>>16&1;qd(this,a);return a&65535}function ae(a,b){a=b<<1|this.U>>16&1;qd(this,a<<8);return a&255}function be(a,b){a=(this.U&65536|b)>>1|b<<16;qd(this,a);return a&65535}function ce(a,b){a=((this.U&65536)>>8|b)>>1|b<<8;qd(this,a<<8);return a&255}
|
|
|
|
|
function de(a,b){var c=b-a;rd(this,c,a,b);return c&65535}function ee(a,b){var c=b-a;rd(this,c<<8,a<<8,b<<8);return c&255}function fe(a,b){this.C&128||(this.Y=this.ba=b&65280,this.V=this.U=0);return(b<<8|b>>8)&65535}function ge(a,b){a^=b;Q(this,a);return a&65535}
|
|
|
|
|
function he(a){var b=Dd(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.U=this.V=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.U=c<<17-b,c>>=b;else if(b)if(16<b)this.V=c,c=0;else{this.U=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.V=32768)}this.u[a]=c&65535;this.Y=this.ba=c;this.b-=(this.g?6:7)+b}
|
|
|
|
|
function ie(a){var b=Dd(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.U=this.V=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.U=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.U=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.V=32768)):d=c;this.u[a]=d>>16&65535;this.u[a|1]=d&65535;this.Y=d>>16;this.ba=d>>16|d;this.b-=(this.g?6:7)+b}function U(a){a&1&&(this.U=0);a&2&&(this.V=0);a&4&&(this.ba=1);a&8&&(this.Y=0);this.b-=5}
|
|
|
|
|
function je(a){var b=Dd(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.U=this.V=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.ba=d>>16|d,this.Y=d>>16):(this.V=32768,this.ba=d>>15|d,this.Y=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.ba=this.Y=0,this.V=32768,this.U=65536,this.b-=7}var ke=[0,7,7,10,7,11,9,13];function le(a){var b=this.b;nd(this,Bd(this,a));this.b=b-ke[this.g]}
|
|
|
|
|
var me=[0,14,14,17,14,18,16,20];function ne(a){var b=this.b,c=Bd(this,a);a=a>>6&7;sd(this,this.u[a]);this.u[a]=this.u[7];nd(this,c);this.b=b-me[this.g]}var oe=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17],pe=[7,13,13,17,14,18,17,21];function qe(a){var b=Dd(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.C&128||(this.Y=b>>16,this.ba=this.Y|b,this.V=0,this.U=-32768>b||32767<b?65536:0);this.b-=23}
|
|
|
|
|
function re(){this.b-=5}function se(a){a&1&&(this.U=65536);a&2&&(this.V=32768);a&4&&(this.ba=0);a&8&&(this.Y=32768);this.b-=5}function te(a){var b=(a&448)>>6;if(this.u[b]=this.u[b]-1&65535)nd(this,this.u[7]-((a&63)<<1)),this.b+=1;this.b-=6}function ue(a){S(this,a,0,fe);this.b-=this.g?9:3+(7==this.f?2:0)}function Oe(a){S(this,a,Ad(this,a),ge);this.b-=this.g?9:3+(7==this.f?2:0)}function V(){this.K(8,6)}function hd(a){Pe[a>>12].call(this,a)}
|
|
|
|
|
var Pe=[function(a){Qe[a>>8&15].call(this,a)},function(a){var b=Ad(this,a),c=this.b;Q(this,Fd(this,a,b));this.b=c-oe[(this.H?8:0)+this.g]+(7!=this.f||this.g?0:2)},function(a){var b=Ad(this,a);a=Dd(this,a);rd(this,b-a,a,b);this.b-=this.g?4+(this.J&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){Q(this,Ad(this,a)&Dd(this,a));this.b-=this.g?4+(this.J&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){S(this,a,Ad(this,a),Od);this.b-=this.g?9+(this.J&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?
|
|
|
|
|
2:0)},function(a){S(this,a,Ad(this,a),Qd);this.b-=this.g?9+(this.J&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){S(this,a,Ad(this,a),Id);this.b-=this.g?9+(this.J&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){Re[a>>8&15].call(this,a)},function(a){Se[a>>8&15].call(this,a)},function(a){var b=zd(this,a);Q(this,Ed(this,a,b,1)<<8);this.b-=this.g?9+(this.J&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){var b=zd(this,a)<<8;a=Cd(this,a)<<8;rd(this,b-a,a,b);this.b-=this.g?
|
|
|
|
|
4+(this.J&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){Q(this,(zd(this,a)&Cd(this,a))<<8);this.b-=this.g?4+(this.J&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){R(this,a,zd(this,a),Pd);this.b-=this.g?9+(this.J&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){R(this,a,zd(this,a),Rd);this.b-=this.g?9+(this.J&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){S(this,a,Ad(this,a),de);this.b-=this.g?9+(this.J&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},V],Qe=
|
|
|
|
|
[function(a){Te[a>>4&15].call(this,a)},function(a){T(this,a,!0)},function(a){T(this,a,!ld(this))},function(a){T(this,a,ld(this))},function(a){T(this,a,!this.Oa()==!kd(this))},function(a){T(this,a,!this.Oa()!=!kd(this))},function(a){T(this,a,!ld(this)&&!this.Oa()==!kd(this))},function(a){T(this,a,ld(this)||!this.Oa()!=!kd(this))},ne,ne,function(a){Ue[a>>6&3].call(this,a)},function(a){Ve[a>>6&3].call(this,a)},function(a){We[a>>6&3].call(this,a)},function(a){Xe[a>>6&3].call(this,a)},V,V],Ue=[function(a){od(this,
|
|
|
|
|
Fd(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Sd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,Wd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,Ud);this.b-=this.g?9:3+(7==this.f?2:0)}],Ve=[function(a){S(this,a,0,Yd);this.b-=this.g?11:6},function(a){S(this,a,jd(this)?1:0,Id);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,jd(this)?1:0,de);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Dd(this,a);od(this,a);this.b-=this.g?4:3+(7==this.f?
|
|
|
|
|
2:0)}],We=[function(a){S(this,a,0,be);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,$d);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Md);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Kd);this.b-=this.g?9:3+(7==this.f?2:0)}],Xe=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.Ic(a|65536);nd(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=xd(this,a,0);sd(this,a);Q(this,a);this.b-=11},function(a){var b=ud(this),c=this.b;yd(this,a,
|
|
|
|
|
0,b);Q(this,b);this.b=c-pe[this.g]},function(a){Q(this,Fd(this,a,this.Oa?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],Te=[function(a){Ye[a&15].call(this,a)},V,V,V,le,le,le,le,function(a){if(a&8)this.K(8,6);else{var b=ud(this);a&=7;nd(this,this.u[a]);this.u[a]=b;this.b-=9}},function(a){a&8?(this.O&49152||(this.O=this.O&-2017|(a&7)<<5,this.C|=1),this.b-=5):this.K(8,6)},function(a){Ze[a&15].call(this,a)},function(a){$e[a&15].call(this,a)},ue,ue,ue,ue],Ye=[function(){this.O&49152?(this.I|=128,this.K(4,
|
|
|
|
|
3)):this.ia();this.b-=7},function(){this.C|=4;this.u[7]=this.u[7]+-2&65535;this.b-=3},function(){td(this);this.C|=this.O&16;this.b-=13},function(){this.K(12,1);this.b-=5},function(){this.K(16,4);this.b-=25},function(){this.O&49152||(id(this),this.F.reset());this.b-=667},function(){td(this);this.b-=13},V,V,V,V,V,V,V,V,V],Ze=[re,function(){this.U=0;this.b-=5},function(){this.V=0;this.b-=5},U,function(){this.ba=1;this.b-=5},U,U,U,function(){this.Y=0;this.b-=5},U,U,U,U,U,U,U],$e=[re,function(){this.U=
|
|
|
|
|
65536;this.b-=5},function(){this.V=32768;this.b-=5},se,function(){this.ba=0;this.b-=5},se,se,se,function(){this.Y=32768;this.b-=5},se,se,se,se,se,se,se],Re=[qe,qe,je,je,he,he,ie,ie,Oe,Oe,V,V,V,V,te,te],Se=[function(a){T(this,a,!this.Oa())},function(a){T(this,a,this.Oa())},function(a){T(this,a,!jd(this)&&!ld(this))},function(a){T(this,a,jd(this)||ld(this))},function(a){T(this,a,!kd(this))},function(a){T(this,a,kd(this))},function(a){T(this,a,!jd(this))},function(a){T(this,a,jd(this))},function(){this.K(24,
|
|
|
|
|
2);this.b-=25},function(){this.K(28,5);this.b-=5},function(a){af[a>>6&3].call(this,a)},function(a){bf[a>>6&3].call(this,a)},function(a){cf[a>>6&3].call(this,a)},function(a){df[a>>6&3].call(this,a)},V,V],af=[function(a){od(this,Ed(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,Td);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,Xd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,Vd);this.b-=this.g?9:3+(7==this.f?2:0)}],bf=[function(a){R(this,a,0,Zd);this.b-=
|
|
|
|
|
this.g?11:6},function(a){R(this,a,jd(this)?1:0,Jd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,jd(this)?1:0,ee);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Cd(this,a);od(this,a<<8);this.b-=this.g?4:3+(7==this.f?2:0)}],cf=[function(a){R(this,a,0,ce);this.b-=this.g?9+(this.pb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,ae);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,Nd);this.b-=this.g?9+(this.pb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,Ld);this.b-=this.g?9:3+(7==
|
|
|
|
|
this.f?2:0)}],df=[V,function(a){a=xd(this,a,65536);sd(this,a);Q(this,a);this.b-=11},function(a){var b=ud(this),c=this.b;yd(this,a,65536,b);Q(this,b);this.b=c-pe[this.g]},V];function ef(a){u.call(this,"ROM",a,ef);this.f=null;this.B=a.addr;this.g=a.size;this.G=a.writable;this.D=a.alias;this.w=a.file;this.H=da(this.w);if(this.w){a=this.w;var b=fa(this.H);"json"!=b&&"hex"!=b&&(a=ha()+"/api/v1/dump?file="+this.w+"&format=bytes&decimal=true");var c=this;ua(a,null,!0,function(a,b,f){ff(c,a,b,f)})}}y(ef);
|
|
|
|
|
ef.prototype.Pa=function(a,b,c,d){this.F=b;this.b=c;this.j=d;gf(this)};ef.prototype.Ka=function(){if(this.La){if(this.j){var a=this.j,b=this.id,c=this.B,d=this.g,e=this.La,f=[],g;for(g in e){var k=e[g];"number"==typeof k&&(e[g]=k={o:k});var m=k.o,n=k.a;if(void 0!==m){var p=f,m=[m>>>0,g],t=ra(p,m,a.vc);0>t&&p.splice(-(t+1),0,m)}n&&(k.a=n.replace(/''/g,'"'))}a.H.push({ee:b,A:c,Zc:d,La:e,uc:f})}delete this.La}return!0};ef.prototype.Ja=function(){return!0};
|
|
|
|
|
function ff(a,b,c,d){if(d)a.ta("Unable to load system ROM (error "+d+": "+b+")");else{bb(a.fc,b,c);var e;if("["==c.charAt(0)||"{"==c.charAt(0))try{var f,g,k=eval("("+c+")");if(f=k.bytes)a.f=f;else if(f=k.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=k.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=k;a.La=k.symbols;if(!a.f.length){q("Empty ROM: "+
|
|
|
|
|
b);return}if(1==a.f.length){q(a.f[0]);return}}catch(m){a.ta("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]=aa(b[e],16);gf(a)}}
|
|
|
|
|
function gf(a){if(!ib(a))if(!a.w)G(a);else if(a.f&&a.F){a.g||(a.g=a.f.length);if(a.f.length!=a.g)kb(a,"ROM size ("+l(a.f.length,8,!0)+") does not match specified size ("+l(a.g,8,!0)+")");else{var b;b=a.B;if(Hb(a.F,b,a.g,a.G?1:pc)){var c;for(c=0;c<a.f.length;c++){a.j&&a.j.g++;var d=a.F,e=b+c;d.aa[(e&d.g)>>>d.ca].dc(e&d.f,a.f[c]&255,e);a.j&&a.j.g--}b=!0}else b=!1;if(b){b=[];"number"==typeof a.D?b.push(a.D):null!=a.D&&a.D.length&&(b=a.D);for(c=0;c<b.length;c++){for(var f=a,d=b[c],e=f.F,g=f.g,k=[],m=
|
|
|
|
|
f.B>>>e.ca;0<g&&m<e.aa.length;)k.push(e.aa[m++]),g-=e.Da;e=f.F;f=f.g;g=0;for(d>>>=e.ca;0<f&&d<e.aa.length;){m=k[g++];if(!m)break;e.aa[d++]=m;f-=e.Da}}delete a.f}}G(a)}}Ma(function(){for(var a=A(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new ef(d);fb(d,c)}});function hf(a){u.call(this,"RAM",a,hf);this.D=a.addr;this.g=a.size;this.f=!1}y(hf);h=hf.prototype;h.Pa=function(a,b,c,d){this.F=b;this.b=c;this.j=d;G(this)};h.Ka=function(a,b){b||this.reset();return!0};
|
|
|
|
|
h.Ja=function(a){return a?this.save():!0};h.reset=function(){!this.f&&this.g&&Hb(this.F,this.D,this.g,1)&&(this.f=!0);this.f||q("No RAM allocated")};h.save=function(){return null};h.restore=function(){return!0};Ma(function(){for(var a=A(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new hf(d);fb(d,c)}});function jf(a){u.call(this,"Keyboard",a,jf,65536);G(this)}y(jf);jf.prototype.pa=function(){return!1};jf.prototype.Pa=function(a,b,c,d){this.D=a;this.b=c;this.j=d;this.va=null};
|
|
|
|
|
Ma(function(){for(var a=A(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new jf(d);fb(d,c)}});function X(a){this.w=this.G=null;this.Z=a.tabSize;this.R=a.charBOL;this.H=0;u.call(this,"SerialPort",a,X,8388608);var b=a.binding;if("console"==b)this.G="";else{var c;a=kf;b&&(void 0===c&&(c="Panel"),(c=eb(c,this.id))&&(b=c.L[b])&&this.pa(null,a,b))}this.J=this.N=null;this.exports={connect:this.Dc,receiveData:this.nc}}y(X);var kf="buffer";h=X.prototype;
|
|
|
|
|
h.pa=function(a,b,c){var d=this;switch(b){case kf:return this.L[b]=this.w=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.nc(b);return!0},c.onkeypress=function(a){a=a||window.event;d.nc(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
|
|
|
|
|
h.Pa=function(a,b,c,d){this.D=a;this.F=b;this.b=c;this.j=d;var e=this;this.$=Qb(this.b,function(){e.f&128||!e.B.length||(e.X=e.B.shift(),e.f|=128,e.f&64&&K(e.b,40,4,48))});this.S=function(){e.g|=128;return!!(e.g&64)};Nb(b,this,lf);G(this)};
|
|
|
|
|
h.Dc=function(){if(!this.J){var a=Cc(this.D,"connection");if(a){var b=a.split("->");if(2==b.length){var c=pa(b[0]);if(c!=this.Sb)return;b=pa(b[1]);if(this.J=db(b)){var d=this.J.exports;if(d){var e=d.connect;e&&e.call(this.J);if(this.N=d.receiveData){this.status(this.fc+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};h.Ka=function(a,b){if(!b)if(this.Dc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
|
|
|
|
|
h.Ja=function(a){return a?this.save():!0};h.reset=function(){mf(this)};h.save=function(){var a=new P(this);a.set(0,[]);return a.data()};h.restore=function(){return mf(this)};function mf(a){a.X=0;a.f=0;a.g=128;a.B=[];return!0}h.nc=function(a){if("number"==typeof a)this.B.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.B.push(a.charCodeAt(b));else this.B=this.B.concat(a);Rb(this.b,this.$,50);return!0};h.nd=function(){return this.f&65535};h.Sd=function(a){this.f=this.f&-112|a&111};
|
|
|
|
|
h.md=function(){this.f&=-129;0<this.B.length&&Rb(this.b,this.$,50);return this.X};h.Rd=function(){};h.xd=function(){return this.g};h.ce=function(a){128==(this.g&192)&&a&64&&K(this.b,8,4,52,this.S);this.g=this.g&-70|a&69};h.wd=function(){return 0};
|
|
|
|
|
h.be=function(a){if(a&=255){D(this,"transmitByte("+l(a,2,!0)+")");this.N&&this.N.call(this.J,a);if(this.w)if(13==a)this.H=0;else if(8==a)this.w.value=this.w.value.slice(0,-1),0<this.H&&this.H--;else{var b;b=(b=qa[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.Z||8,c=a-this.H%a,this.Z&&(b=oa("",c)));this.R&&!this.H&&c&&(b=String.fromCharCode(this.R)+b);this.w.value+=b;this.w.scrollTop=this.w.scrollHeight;this.H+=c}else if(null!=this.G){if(10==a||1024<=this.G.length)this.i(this.G),
|
|
|
|
|
this.G="";10!=a&&(this.G+=String.fromCharCode(a))}this.g&=-129;K(this.b,100,4,52,this.S)}};var nf={},lf=(nf[65392]=[null,null,X.prototype.nd,X.prototype.Sd,"RCSR"],nf[65394]=[null,null,X.prototype.md,X.prototype.Rd,"RBUF"],nf[65396]=[null,null,X.prototype.xd,X.prototype.ce,"XCSR"],nf[65398]=[null,null,X.prototype.wd,X.prototype.be,"XBUF"],nf);Ma(function(){for(var a=A(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new X(d);fb(d,c)}});
|
|
|
|
|
function of(a){u.call(this,"Debugger",a,of);this.na=a.base||16;this.Ca=!1;this.X=this.Ba=this.J=0;this.$=!1;this.B=-1;this.w=[];this.ha={}}y(of);var pf={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};of.prototype.Ac=function(){return-1};of.prototype.Bc=function(){};
|
|
|
|
|
function qf(a,b,c,d){if(c)if(b){0>a.B&&a.w.length&&(a.B=0);if(0>a.B||b!=a.w[a.B])a.w.splice(0,0,b),a.B=0;a.B--}else a.$?b="end":b=a.w[a.B+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(pa(b.substring(c,f))),c=f+1}}return a}
|
|
|
|
|
function rf(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;
|
|
|
|
|
var wb="undefined"!==typeof ArrayBuffer,xb={cpu:1,trap:16,bus:64,mem:128,keyboard:65536,key:131072,disk:2097152,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};function yb(a){r.call(this,"Panel",a,yb)}y(yb);h=yb.prototype;h.ja=function(a,b,c,d){return this.F&&this.F.ja(a,b,c,d)||this.b&&this.b.ja(a,b,c,d)||this.j&&this.j.ja(a,b,c,d)?!0:this.parent.ja.call(this,a,b,c,d)};h.Ga=function(a,b,c,d){this.F=a;this.B=b;this.b=c;this.j=d};
|
|
|
|
|
h.Ca=function(a,b){b||zb();return!0};h.Ba=function(){return!0};h.za=function(){};function zb(){for(var a=!1,b=A(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=z(d),f=cb(e.id);f||(a=!0,f=new yb(e));eb(f,d);a&&G(f)}}La(zb);
|
|
|
|
|
function Ab(a,b,c){r.call(this,"Bus",a,Ab,64);this.b=b;this.j=c;this.C=a.busWidth||16;this.B=Math.pow(2,this.C);this.g=this.B-1|0;this.Z=(this.C>>1)+2;10>this.Z&&(this.Z=10);15<this.Z&&(this.Z=15);this.ya=1<<this.Z;this.G=this.ya>>2;this.f=this.ya-1;this.A=this.B/this.ya|0;this.Ka=[];this.F=[];a=new H(this.b);Bb(a,this.j);this.X=Array(this.A);for(b=0;b<this.A;b++)this.X[b]=a;this.gb=Array(4);this.gb[0]=Cb;this.gb[1]=Db;this.gb[2]=Eb;this.gb[3]=Fb;Gb(this,this.B-8192,8192,Hb,this);Gb(this,57344,8192,
|
|
|
|
|
Hb,this);G(this)}y(Ab);function Cb(a,b){var c=-1,d=this.controller,e=d.Ka[a];e?e[0]?c=e[0](b)&255:e[2]&&(c=b&1?e[2](b&-2)>>8:e[2](b)&255):b&1&&(e=d.Ka[a&-2])&&e[2]&&(c=e[2](b&-2)>>8);if(0<=c)return this.j&&F(this.j,64)&&D(this.j,e[4]+".readByte("+I(this.j,b)+"): "+I(this.j,c),!0,!0),c;c=Ib(d,b|4186112,-1,1);this.j&&F(this.j,64)&&D(this.j,"warning: unconverted read access to byte @"+I(this.j,b)+": "+I(this.j,c),!0,!0);return c}
|
|
|
|
|
function Db(a,b,c){var d=!1,e=this.controller,f=e.Ka[a];if(f)if(f[1])f[1](b,c),d=!0;else{if(f[3]){a=f[2]?f[2](c):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.Ka[a&-2])&&f[3]&&(c&=-2,a=f[2]?f[2](c):0,f[3](a&255|b<<8,c),d=!0);d?this.j&&F(this.j,64)&&D(this.j,f[4]+".writeByte("+I(this.j,c)+","+I(this.j,b)+")",!0,!0):(Ib(e,c|4186112,b,1),this.j&&F(this.j,64)&&D(this.j,"warning: unconverted write access to byte @"+I(this.j,c)+": "+I(this.j,b),!0,!0))}
|
|
|
|
|
function Eb(a,b){var c=-1,d=this.controller;(a=d.Ka[a])&&(a[2]?c=a[2](b):a[0]&&(c=a[0](b)|a[0](b+1)<<8));if(0<=c)return this.j&&F(this.j,64)&&D(this.j,a[4]+".readWord("+I(this.j,b)+"): "+I(this.j,c),!0,!0),c;c=Ib(d,b|4186112,-1,0);this.j&&F(this.j,64)&&D(this.j,"warning: unconverted read access to word @"+I(this.j,b)+": "+I(this.j,c),!0,!0);return c}
|
|
|
|
|
function Fb(a,b,c){var d=!1,e=this.controller;if(a=e.Ka[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.j&&F(this.j,64)&&D(this.j,a[4]+".writeWord("+I(this.j,c)+","+I(this.j,b)+")",!0,!0):(Ib(e,c|4186112,b,0),this.j&&F(this.j,64)&&D(this.j,"warning: unconverted write access to word @"+I(this.j,c)+": "+I(this.j,b),!0,!0))}h=Ab.prototype;h.reset=function(){for(var a=0;a<this.F.length;a++)this.F[a]()};
|
|
|
|
|
function Ib(a,b,c,d){a.j&&F(a.j,536870912)&&D(a.j,"warning: unrecognized I/O access("+I(a.j,b)+","+I(a.j,c)+","+d+")",!0,!0);a.b.O(4,b)}h.Ca=function(a,b){b||this.reset();return!0};
|
|
|
|
|
function Gb(a,b,c,d,e){for(var f=b,g=c,l=f>>>a.Z;0<g&&l<a.X.length;){var n=a.X[l],p=l*a.ya,q=a.ya-(f-p);q>g&&(q=g);if(n&&n.size){if(n.type==d&&n.controller==e){if(f+g<=n.w)return n.qb+=n.w-f,n.w=f,!0;if(f>=n.w+n.qb){q=n.size-(f-p);q>g&&(q=g);n.qb=f-n.w+q;f=p+a.ya;g-=q;l++;continue}}return Jb(1,f,g)}f=new H(a.b,f,q,a.ya,d,e);Bb(f,a.j,n);a.X[l++]=f;f=p+a.ya;g-=q}return 0>=g?(a.status(Math.floor(c/1024)+"Kb "+Kb[d]+" at "+k(b,8,!0)),!0):Jb(2,b,c)}
|
|
|
|
|
h.Ua=function(a){return this.X[(a&this.g)>>>this.Z].ub(a&this.f,a)};h.ma=function(a){return this.X[(a&this.g)>>>this.Z].dc(a&this.f,a)};function Lb(a,b){return a.X[(b&a.g)>>>a.Z].Db(b&a.f,b)}h.ob=function(a,b){this.X[(a&this.g)>>>this.Z].vb(a&this.f,b&255,a)};h.Xa=function(a,b){this.X[(a&this.g)>>>this.Z].oc(a&this.f,b&65535,a)};
|
|
|
|
|
function Mb(a){for(var b=0,c=[],d=0;d<a.A;d++){var e=a.X[d];if(e.La||e.sc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,l=0,n=[];g<e.length;){for(var p=e[g],q=g+1;q<e.length&&e[q]===p;)q++;n[l++]=q-g;n[l++]=p;g=q}n.length<e.length&&(e=n)}c[f]=e}}return c}
|
|
|
|
|
function Nb(a,b,c){for(var d in c){var e=c[d];if(!(e[5]&&e[5]>a.b.Xb))for(var f=e[0]?e[0].bind(b):null,g=e[1]?e[1].bind(b):null,l=e[2]?e[2].bind(b):null,n=e[3]?e[3].bind(b):null,p=a,q=+d,e=e[4],v=+d;v<=q;v+=2){var u=v&8191;void 0!==p.Ka[u]?m("I/O address already registered: "+k(v,8,!0)):p.Ka[u]=[f,g,l,n,e||"unknown",!1]}}}function Ob(a,b){a.F.push(b)}function Jb(a,b,c){m("Memory block error ("+a+": "+k(b)+","+k(c)+")");return!1}
|
|
|
|
|
function J(a){r.call(this,"Device",a,J);this.g={data:0,Gd:0,tb:20,Jd:0};this.f={Hd:0,Ib:-1}}y(J);h=J.prototype;h.Ga=function(a,b,c,d){this.B=b;this.b=c;this.j=d;var e=this;this.f.Ib=Pb(this.b,function(){e.f.Ma|=128;e.f.Ma&64&&(Qb(e.b,0,6,64),Rb(e.b,e.f.Ib,1E3/60))});Nb(b,this,K);Ob(b,this.reset.bind(this));G(this)};h.Gc=function(){var a=this.f.Ma;this.f.Ma&=-129;return a};h.kd=function(a){this.f.Ma=a;a&64&&Rb(this.b,this.f.Ib,1E3/60);this.f.Ma=a&-129};
|
|
|
|
|
h.Ic=function(){var a=this.b;return a.G&62337|a.wa<<5|a.xa<<1};h.md=function(a){var b=this.b;b.G=a&=62337;b.wa=a>>5&3;b.xa=a>>1&15;b.Bb=a&257?a&1?6:4:0;Sb(b);Tb(this)};h.Jc=function(){var a=this.b.Oa;a&65280&&(a=(a<<8|a>>8)&65535);return a};h.Kc=function(){return this.b.Fb};h.Lc=function(){return this.b.Wa};h.nd=function(a){var b=this.b;b.Wa=a;b.Wa&16?(b.jb=4194303,b.Ia=3915776):(b.jb=262143,b.Ia=253952);Tb(this)};function Tb(a){a.g.tb=a.g.tb&-8|(a.b.Bb?a.b.Wa&16?1:2:4)}
|
|
|
|
|
h.Tc=function(a){return this.b.S[1][a>>1&7]};h.vd=function(a,b){this.b.S[1][b>>1&7]=a&65295};h.Rc=function(a){return this.b.S[1][(a>>1&7)+8]};h.td=function(a,b){this.b.S[1][(b>>1&7)+8]=a&65295};h.Sc=function(a){return this.b.pa[1][a>>1&7]};h.ud=function(a,b){b=b>>1&7;this.b.pa[1][b]=a;this.b.S[1][b]&=65295};h.Qc=function(a){return this.b.pa[1][(a>>1&7)+8]};h.sd=function(a,b){b=(b>>1&7)+8;this.b.pa[1][b]=a;this.b.S[1][b]&=65295};h.Fc=function(a){return this.b.S[0][a>>1&7]};
|
|
|
|
|
h.jd=function(a,b){this.b.S[0][b>>1&7]=a&65295};h.Dc=function(a){return this.b.S[0][(a>>1&7)+8]};h.gd=function(a,b){this.b.S[0][(b>>1&7)+8]=a&65295};h.Ec=function(a){return this.b.pa[0][a>>1&7]};h.hd=function(a,b){b=b>>1&7;this.b.pa[0][b]=a;this.b.S[0][b]&=65295};h.Cc=function(a){return this.b.pa[0][(a>>1&7)+8]};h.fd=function(a,b){b=(b>>1&7)+8;this.b.pa[0][b]=a;this.b.S[0][b]&=65295};h.Zc=function(a){return this.b.S[3][a>>1&7]};h.Bd=function(a,b){this.b.S[3][b>>1&7]=a&65295};
|
|
|
|
|
h.Xc=function(a){return this.b.S[3][(a>>1&7)+8]};h.zd=function(a,b){this.b.S[3][(b>>1&7)+8]=a&65295};h.Yc=function(a){return this.b.pa[3][a>>1&7]};h.Ad=function(a,b){b=b>>1&7;this.b.pa[3][b]=a;this.b.S[3][b]&=65295};h.Wc=function(a){return this.b.pa[3][(a>>1&7)+8]};h.yd=function(a,b){b=(b>>1&7)+8;this.b.pa[3][b]=a;this.b.S[3][b]&=65295};h.ra=function(a){a&=7;return this.b.K&2048?this.b.Ha[a]:this.b.u[a]};h.ua=function(a,b){b&=7;this.b.K&2048?this.b.Ha[b]=a:this.b.u[b]=a};
|
|
|
|
|
h.Zb=function(){return this.b.K&49152?this.b.ta[0]:this.b.u[6]};h.jc=function(a){this.b.K&49152?this.b.ta[0]=a:this.b.u[6]=a};h.bc=function(){return this.b.u[7]};h.mc=function(a){this.b.u[7]=a};h.sa=function(a){a&=7;return this.b.K&2048?this.b.u[a]:this.b.Ha[a]};h.va=function(a,b){b&=7;this.b.K&2048?this.b.u[b]=a:this.b.Ha[b]=a};h.$b=function(){return 1==(this.b.K&49152)>>14?this.b.u[6]:this.b.ta[1]};h.kc=function(a){1==(this.b.K&49152)>>14?this.b.u[6]=a:this.b.ta[1]=a};
|
|
|
|
|
h.ac=function(){return 3==(this.b.K&49152)>>14?this.b.u[6]:this.b.ta[3]};h.lc=function(a){3==(this.b.K&49152)>>14?this.b.u[6]=a:this.b.ta[3]=a};h.Bc=function(a){return this.b.gc[a-65504>>1]};h.ed=function(a,b){this.b.gc[b-65504>>1]=a};h.cc=function(a){return 65520==a?61183:0};h.nc=function(){};h.Vc=function(){return 1};h.xd=function(){};h.Ac=function(){return this.b.$};h.dd=function(){this.b.$=0};h.Hc=function(){return this.b.fc};h.ld=function(a,b){b&1||(a&=255);this.b.fc=a};h.Mc=function(){return this.b.Gb};
|
|
|
|
|
h.od=function(a){var b=this.b;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.Gb=a;b.D|=2};h.Uc=function(){return this.b.Pa&65280};h.wd=function(a){this.b.Pa=a|255};h.Nc=function(){return Ub(this.b)};h.pd=function(a){Vb(this.b,a&-1809|Ub(this.b)&1808);this.b.D|=128};h.reset=function(){this.g.tb=this.g.tb&-120|20;this.f.Ma=0};
|
|
|
|
|
var L={},K=(L[62592]=[null,null,J.prototype.Tc,J.prototype.vd,"SISDR"],L[62608]=[null,null,J.prototype.Rc,J.prototype.td,"SDSDR"],L[62624]=[null,null,J.prototype.Sc,J.prototype.ud,"SISAR"],L[62640]=[null,null,J.prototype.Qc,J.prototype.sd,"SDSAR"],L[62656]=[null,null,J.prototype.Fc,J.prototype.jd,"KISDR"],L[62672]=[null,null,J.prototype.Dc,J.prototype.gd,"KDSDR"],L[62688]=[null,null,J.prototype.Ec,J.prototype.hd,"KISAR"],L[62704]=[null,null,J.prototype.Cc,J.prototype.fd,"KDSAR"],L[62798]=[null,null,
|
|
|
|
|
J.prototype.Lc,J.prototype.nd,"MMR3"],L[65382]=[null,null,J.prototype.Gc,J.prototype.kd,"LKS"],L[65402]=[null,null,J.prototype.Ic,J.prototype.md,"MMR0"],L[65404]=[null,null,J.prototype.Jc,null,"MMR1"],L[65406]=[null,null,J.prototype.Kc,null,"MMR2"],L[65408]=[null,null,J.prototype.Zc,J.prototype.Bd,"UISDR"],L[65424]=[null,null,J.prototype.Xc,J.prototype.zd,"UDSDR"],L[65440]=[null,null,J.prototype.Yc,J.prototype.Ad,"UISAR"],L[65456]=[null,null,J.prototype.Wc,J.prototype.yd,"UDSAR"],L[65472]=[J.prototype.ra,
|
|
|
|
|
J.prototype.ua,J.prototype.ra,J.prototype.ua,"R0SET0"],L[65473]=[J.prototype.ra,J.prototype.ua,J.prototype.ra,J.prototype.ua,"R1SET0"],L[65474]=[J.prototype.ra,J.prototype.ua,J.prototype.ra,J.prototype.ua,"R2SET0"],L[65475]=[J.prototype.ra,J.prototype.ua,J.prototype.ra,J.prototype.ua,"R3SET0"],L[65476]=[J.prototype.ra,J.prototype.ua,J.prototype.ra,J.prototype.ua,"R4SET0"],L[65477]=[J.prototype.ra,J.prototype.ua,J.prototype.ra,J.prototype.ua,"R5SET0"],L[65478]=[J.prototype.Zb,J.prototype.jc,J.prototype.Zb,
|
|
|
|
|
J.prototype.jc,"R6KERNEL"],L[65479]=[J.prototype.bc,J.prototype.mc,J.prototype.bc,J.prototype.mc,"R7KERNEL"],L[65480]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R0SET1"],L[65481]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R1SET1"],L[65482]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R2SET1"],L[65483]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R3SET1"],L[65484]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R4SET1"],
|
|
|
|
|
L[65485]=[J.prototype.sa,J.prototype.va,J.prototype.sa,J.prototype.va,"R5SET1"],L[65486]=[J.prototype.$b,J.prototype.kc,J.prototype.$b,J.prototype.kc,"R6SUPER"],L[65487]=[J.prototype.ac,J.prototype.lc,J.prototype.ac,J.prototype.lc,"R6USER"],L[65504]=[null,null,J.prototype.Bc,J.prototype.ed,"CTRL",1170],L[65520]=[null,null,J.prototype.cc,J.prototype.nc,"LSIZE",1170],L[65522]=[null,null,J.prototype.cc,J.prototype.nc,"HSIZE",1170],L[65524]=[null,null,J.prototype.Vc,J.prototype.xd,"SYSID",1170],L[65526]=
|
|
|
|
|
[null,null,J.prototype.Ac,J.prototype.dd,"CPUERR",1170],L[65528]=[null,null,J.prototype.Hc,J.prototype.ld,"MB",1170],L[65530]=[null,null,J.prototype.Mc,J.prototype.od,"PIR"],L[65532]=[null,null,J.prototype.Uc,J.prototype.wd,"SL"],L[65534]=[null,null,J.prototype.Nc,J.prototype.pd,"PSW"],L);K[62594]=K[62592];K[62596]=K[62592];K[62598]=K[62592];K[62600]=K[62592];K[62602]=K[62592];K[62604]=K[62592];K[62606]=K[62592];K[62610]=K[62608];K[62612]=K[62608];K[62614]=K[62608];K[62616]=K[62608];K[62618]=K[62608];
|
|
|
|
|
K[62620]=K[62608];K[62622]=K[62608];K[62626]=K[62624];K[62628]=K[62624];K[62630]=K[62624];K[62632]=K[62624];K[62634]=K[62624];K[62636]=K[62624];K[62638]=K[62624];K[62642]=K[62640];K[62644]=K[62640];K[62646]=K[62640];K[62648]=K[62640];K[62650]=K[62640];K[62652]=K[62640];K[62654]=K[62640];K[62658]=K[62656];K[62660]=K[62656];K[62662]=K[62656];K[62664]=K[62656];K[62666]=K[62656];K[62668]=K[62656];K[62670]=K[62656];K[62674]=K[62672];K[62676]=K[62672];K[62678]=K[62672];K[62680]=K[62672];K[62682]=K[62672];
|
|
|
|
|
K[62684]=K[62672];K[62686]=K[62672];K[62690]=K[62688];K[62692]=K[62688];K[62694]=K[62688];K[62696]=K[62688];K[62698]=K[62688];K[62700]=K[62688];K[62702]=K[62688];K[62706]=K[62704];K[62708]=K[62704];K[62710]=K[62704];K[62712]=K[62704];K[62714]=K[62704];K[62716]=K[62704];K[62718]=K[62704];K[65410]=K[65408];K[65412]=K[65408];K[65414]=K[65408];K[65416]=K[65408];K[65418]=K[65408];K[65420]=K[65408];K[65422]=K[65408];K[65426]=K[65424];K[65428]=K[65424];K[65430]=K[65424];K[65432]=K[65424];K[65434]=K[65424];
|
|
|
|
|
K[65436]=K[65424];K[65438]=K[65424];K[65442]=K[65440];K[65444]=K[65440];K[65446]=K[65440];K[65448]=K[65440];K[65450]=K[65440];K[65452]=K[65440];K[65454]=K[65440];K[65458]=K[65456];K[65460]=K[65456];K[65462]=K[65456];K[65464]=K[65456];K[65466]=K[65456];K[65468]=K[65456];K[65470]=K[65456];K[65506]=K[65504];K[65508]=K[65504];K[65510]=K[65504];K[65512]=K[65504];K[65514]=K[65504];K[65516]=K[65504];K[65518]=K[65504];
|
|
|
|
|
La(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 J(d),eb(d,c)}}});var Wb;if(wb){var fc=new ArrayBuffer(2);(new DataView(fc)).setUint16(0,256,!0);Wb=256===(new Uint16Array(fc))[0]}else Wb=!1;var gc=Wb;
|
|
|
|
|
function H(a,b,c,d,e,f){this.b=a;this.id=hc+=2;this.f=null;this.w=b;this.qb=c;this.size=d||0;this.type=e||ic;this.B=e==jc;this.controller=null;Bb(this);this.La=this.sc=!1;if(d)if(f)this.controller=f,this.f=null,kc(this,f.gb);else if(wb)this.C=new ArrayBuffer(d),this.G=new DataView(this.C,0,d),this.g=new Uint8Array(this.C,0,d),this.I=new Uint16Array(this.C,0,d>>1),this.f=new Int32Array(this.C,0,d>>2),kc(this,gc?lc:mc);else{this.f=Array(d>>2);for(a=0;a<this.f.length;a++)this.f[a]=0;kc(this,nc)}else kc(this)}
|
|
|
|
|
var ic=0,jc=2,Hb=4,Kb=["NONE","RAM","ROM","VID","H/W"],hc=0;
|
|
|
|
|
H.prototype={constructor:H,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(wb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.G.getInt32(b<<2,!0);else a=this.f;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(wb)for(b=0;b<a.length;b++)this.G.setInt32(b<<2,a[b],!0);else this.f=a;return this.La=!0}return!1},Sa:function(a,b){b?this.F++||oc(this,pc,!1):this.J++||qc(this,pc,!1)},L:function(){this.j&&F(this.j,128)&&(D(this.j,"attempt to read invalid block %"+
|
|
|
|
|
k(this.w),!0),this.j.ea());return 255},A:function(a,b){this.j&&F(this.j,128)&&(D(this.j,"attempt to write "+k(b,4,!0)+" to invalid block %"+k(this.w),!0),this.j.ea())},M:function(a,b){return this.ub(a++,b++)|this.ub(a,b)<<8},H:function(a,b,c){this.vb(a++,b&255,c++);this.vb(a,b>>8,c)},W:function(a){return this.f[a>>2]>>>((a&3)<<3)&255},ga:function(a,b){a&1&&this.b.O(4,b);b=a>>2;a=(a&3)<<3;var c=this.f[b]>>a;return 24>a?c&65535:c&255|(this.f[b+1]&255)<<8},oa:function(a,b){var c=a>>2;a=(a&3)<<3;this.f[c]=
|
|
|
|
|
this.f[c]&~(255<<a)|b<<a;this.La=!0},Ya:function(a,b,c){a&1&&this.b.O(4,c);c=a>>2;a=(a&3)<<3;24>a?this.f[c]=this.f[c]&~(65535<<a)|b<<a:(this.f[c]=this.f[c]&16777215|b<<24,c++,this.f[c]=this.f[c]&-256|b>>8);this.La=!0},T:function(a,b){if(this.j&&null!=this.w){var c=this.j;rc(c,this.w+a,1,c.N)&&c.ea(!0)}return this.Cb(a,b)},ca:function(a,b){if(this.j&&null!=this.w){var c=this.j;rc(c,this.w+a,2,c.N)&&c.ea(!0)}return this.Db(a,b)},ka:function(a,b,c){if(this.j&&null!=this.w){var d=this.j;rc(d,this.w+a,
|
|
|
|
|
1,d.G)&&d.ea(!0)}this.B?this.A(a,b,c):this.wb(a,b,c)},wa:function(a,b,c){if(this.j&&null!=this.w){var d=this.j;rc(d,this.w+a,2,d.G)&&d.ea(!0)}this.B?this.A(a,b,c):this.Jb(a,b,c)},N:function(a){return this.g[a]},V:function(a,b){a=this.g[a];this.j&&F(this.j,128)&&D(this.j,"Memory.readByte("+I(this.j,b)+"): "+I(this.j,a),!0);return a},aa:function(a,b){a&1&&this.b.O(4,b);return this.G.getUint16(a,!0)},da:function(a,b){a&1&&this.b.O(4,b);a=a&1?this.g[a]|this.g[a+1]<<8:this.I[a>>1];this.j&&F(this.j,128)&&
|
|
|
|
|
D(this.j,"Memory.readWord("+I(this.j,b)+"): "+I(this.j,a),!0);return a},ia:function(a,b){this.g[a]=b;this.La=!0},la:function(a,b,c){this.g[a]=b;this.La=!0;this.j&&F(this.j,128)&&D(this.j,"Memory.writeByte("+I(this.j,c)+","+I(this.j,b)+")",!0)},qa:function(a,b,c){a&1&&this.b.O(4,c);this.G.setUint16(a,b,!0);this.La=!0},xa:function(a,b,c){a&1&&this.b.O(4,c);a&1?(this.g[a]=b,this.g[a+1]=b>>8):this.I[a>>1]=b;this.La=!0;this.j&&F(this.j,128)&&D(this.j,"Memory.writeWord("+I(this.j,c)+","+I(this.j,b)+")",
|
|
|
|
|
!0)}};function Bb(a,b,c){a.j=b;a.J=a.F=0;c&&((a.J=c.J)&&qc(a,pc,!1),(a.F=c.F)&&oc(a,pc,!1))}function sc(a,b){b?--a.F||(a.vb=a.B?a.A:a.wb,a.oc=a.B?a.H:a.Jb):--a.J||(a.ub=a.Cb,a.dc=a.Db)}function oc(a,b,c){c&&a.F||(a.vb=!a.B&&b[1]||a.A,a.oc=!a.B&&b[3]||a.H);if(c||void 0===c)a.wb=b[1]||a.A,a.Jb=b[3]||a.H}function qc(a,b,c){c&&a.J||(a.ub=b[0]||a.L,a.dc=b[2]||a.M);if(c||void 0===c)a.Cb=b[0]||a.L,a.Db=b[2]||a.M}function kc(a,b){b||(b=tc);qc(a,b,void 0);oc(a,b,void 0)}
|
|
|
|
|
var tc=[],nc=[H.prototype.W,H.prototype.oa,H.prototype.ga,H.prototype.Ya],pc=[H.prototype.T,H.prototype.ka,H.prototype.ca,H.prototype.wa];if(wb)var mc=[H.prototype.N,H.prototype.ia,H.prototype.aa,H.prototype.qa],lc=[H.prototype.V,H.prototype.la,H.prototype.da,H.prototype.xa];
|
|
|
|
|
function uc(a,b){r.call(this,"CPU",a,uc,1);var c=a.multiplier||1;this.Qa=a.cycles||b;this.Na=c;this.ab=Math.round(this.Qa/1E4)/100;this.Va=this.ab*this.Na;this.v.ba=!1;this.v.Hb=!1;this.v.hb=a.autoStart;this.v.Mb=!1;this.v.$a=!1;this.lb=this.ia=0;this.mb=a.csStart;this.bb=a.csInterval;this.cb=a.csStop;this.L=[];this.Vb=this.cd.bind(this);G(this)}y(uc);var vc=["power","reset"];h=uc.prototype;
|
|
|
|
|
h.Ga=function(a,b,c,d){this.F=a;this.B=b;this.j=d;for(b=0;b<vc.length;b++)(c=this.J[vc[b]])&&this.F.ja(null,vc[b],c);this.oa=null;a=wc(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.Ca=function(a,b){if(!b){if(a&&this.restore){xc(this);if(!this.restore(a))return!1;yc(this)}else this.reset();this.j?(a=this.j,a.i("Type ? for help with PDP11 Debugger commands"),a.za(),a.Ja&&(b=a.Ja,a.Ja=null,zc(a,b))):this.i("No debugger detected")}M(this);return!0};h.Ba=function(a){return a?this.save():!0};h.hb=function(){return this.v.hb||!this.j&&void 0===this.J.run?(this.eb(!0),!0):!1};h.Ob=function(){return 0};
|
|
|
|
|
function yc(a){void 0===a.mb&&(a.mb=0);void 0===a.bb&&(a.bb=-1);void 0===a.cb&&(a.cb=-1);a.v.$a=0<=a.mb&&0<a.bb;a.v.$a&&(a.lb=0,a.ia=a.mb-a.ga)}function Ac(a,b){if(a.v.$a){var c=!1;a.lb=a.lb+a.Ob()|0;a.ia-=b;0>=a.ia&&(a.ia+=a.bb,c=!0);0<=a.cb&&a.cb<=Bc(a)&&(a.bb=a.cb=-1,yc(a),a.ea(),c=!0);c&&a.i(Bc(a)+" cycles: checksum="+k(a.lb))}}
|
|
|
|
|
function Cc(a,b,c,d){if(a.J[b]){void 0===c&&(vb(a,"Value for "+b+" is invalid"),a.ea());var e=a.j&&a.j.ia||8;c=!a.v.ba||a.v.Mb?8==e?ba(c,d):k(c,d):"--------".substr(0,d||4);a.J[b].textContent!=c&&(a.J[b].textContent=c)}}
|
|
|
|
|
h.ja=function(a,b,c){var d=this;a=!1;switch(b){case "power":case "reset":this.J[b]=c;a=!0;break;case "run":this.J[b]=c;c.onclick=function(){var a;if(a=d.F)if(a=d.F,a.v.fa)a=!0;else{var b=null,c,l=bb(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.fa);c++);c==l.length&&(b=a);m("The "+b.type+" component ("+b.id+") is not "+(b.v.ready?"powered yet":"ready yet"+(b.rb?" (waiting for notification)":""))+".");a=!1}a&&(d.v.ba?d.ea():d.eb())};
|
|
|
|
|
a=!0;break;case "speed":this.J[b]=c;a=!0;break;case "setSpeed":this.J[b]=c,c.onclick=function(){Dc(d,d.Na<<1,!0)},c.textContent=this.Va.toFixed(2)+"Mhz",a=!0}return a};function Ec(a,b,c){a.ga+=b;c&&(a.N=a.b=0)}function Fc(a,b){var c=1;b&&1<a.Na&&a.ca&&(c=a.ca/a.ab);a.Sb=Math.round(1E3/30);a.Ra=Math.floor(a.Qa/30*c);b||(a.ka=a.Ra);a.kb=0}function Bc(a){return a.ga+a.W+a.N-a.b}function xc(a){a.ca=0;a.Ub=0;a.ga=a.W=a.N=a.b=0;yc(a);Dc(a,1)}
|
|
|
|
|
function Dc(a,b,c){var d=!1;if(void 0!==b){.8>a.ca/a.Va?b=1:d=!0;a.Na=b;b=a.ab*a.Na;if(a.Va!=b){a.Va=b;b=a.Va.toFixed(2)+"Mhz";var e=a.J.setSpeed;e&&(e.textContent=b);a.i("target speed: "+b)}c&&a.F&&a.F.pb()}Ec(a,a.W);a.W=0;a.V=ra();a.da=0;Fc(a);return d}function Pb(a,b){var c=a.L.length;a.L.push([-1,b]);return c}function Rb(a,b,c){0<=b&&b<a.L.length&&0>a.L[b][0]&&(c*=a.Qa*a.Na/1E3,a.L[b][0]=c)}function Gc(a,b){for(var c=a.L.length-1;0<=c;c--){var d=a.L[c];0>d[0]||b>d[0]&&(b=d[0])}return b}
|
|
|
|
|
function Hc(a,b){for(var c=a.L.length-1;0<=c;c--){var d=a.L[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}
|
|
|
|
|
h.cd=function(){if(this.v.ba){this.kb>=this.Qa&&Fc(this,!0);this.qa=0;this.Ja=ra();if(this.da){var a=this.Ja-this.da;a>this.Sb&&(this.V+=a,this.V>this.Ja&&(this.V=this.Ja))}try{do{var b=Gc(this,this.v.$a?1:this.Ra);try{this.fb(b)}catch(e){if("number"!=typeof e)throw e;}var c=this.N-this.b;Hc(this,c);this.qa+=c;this.W+=c;Ec(this,0,!0);Ac(this,c);this.ka-=c;if(0>=this.ka){this.ka+=this.Ra;15<=++this.Ub&&(this.F&&this.F.za(),this.Ub=0);break}}while(this.v.ba)}catch(e){this.ea();M(this);this.F&&this.F.stop(ra(),
|
|
|
|
|
Bc(this));vb(this,e.stack||e.message);return}if(this.v.ba){a=setTimeout;b=this.Vb;this.da=ra();c=this.Sb;this.qa&&(c=Math.round(c*this.qa/this.Ra));var c=c-(this.da-this.Ja),d=this.da-this.V;d&&(this.ca=Math.round(this.W/(10*d))/100,864E5<=d&&(this.ga=0,Dc(this)));if(0>c||this.ca<this.Va)-1E3>c&&(this.V-=c),c=0;this.kb+=this.qa;this.da+=c;a(b,c)}}};
|
|
|
|
|
h.eb=function(a){if(ib(this))return!1;if(this.v.ba)return this.i(this.toString()+" busy"),!1;Dc(this);this.v.ba=!0;this.v.Hb=!0;this.oa&&this.oa.start();var b=this.J.run;b&&(b.textContent="Halt");this.F&&(a&&this.F.pb(!0),this.F.start(this.V,Bc(this)));M(this,!0);setTimeout(this.Vb,0);return!0};h.fb=function(){return 0};
|
|
|
|
|
h.ea=function(a){if(this.v.ba){this.N-=this.b;this.b=0;Ec(this,this.W);this.W=0;this.v.ba=!1;this.oa&&this.oa.stop();var b=this.J.run;b&&(b.textContent="Run");this.F&&this.F.stop(ra(),Bc(this));M(this)}this.v.complete=a};function M(a,b){a.F&&a.F.za(b)}
|
|
|
|
|
function Ic(a){this.Xb=+a.model||1170;this.yc=a.resetAddr||0;uc.call(this,a,6666667);this.sb=0;this.decode=bd.bind(this);this.P=65536;this.R=32768;this.Y=65535;this.U=32768;this.K=15;this.u=[0,0,0,0,0,0,0,this.yc];this.Ha=[0,0,0,0,0,0];this.ta=[0,0,0,0];this.xa=this.C=0;this.wc=[4,2,0,1];this.S=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];this.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]];this.zc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.gc=[0,0,0,0,0,0,0,0];this.g=this.f=this.Za=this.H=this.I=this.D=this.fc=0;this.la=-1;cd(this);this.v.complete=this.v.rc=!1}y(Ic,uc);h=Ic.prototype;h.reset=function(){this.v.ba&&this.ea();cd(this);xc(this);this.v.error=!1;this.parent.reset.call(this)};
|
|
|
|
|
function cd(a){a.Pa=255;a.$=0;a.Gb=0;a.G=0;a.Oa=0;a.Fb=0;a.Wa=0;a.Bb=0;a.wa=0;a.jb=262143;a.Ia=253952;a.A=[];a.D|=2;Sb(a)}function Sb(a){a.Bb?(a.aa=65536,a.M=a.uc,a.T=a.ec,a.Wb=a.Dd):(a.aa=0,a.M=a.tc,a.T=a.$c,a.Wb=a.Cd)}h.Ob=function(){return 0};h.save=function(){var a=new N(this);a.set(0,[]);a.set(1,[this.ga,this.Na]);a.set(2,Mb(this.B));return a.data()};
|
|
|
|
|
h.restore=function(a){var b=a[1];this.ga=b[1];Dc(this,b[3]);a:{b=this.B;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.G){for(var f=0,g=Array(b.G),l=0;l<e.length-1;)for(var n=e[l++],p=e[l++];n--;)g[f++]=p;e=g}f=b.X[d];if(!f||!f.restore(e)){m("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
|
|
|
|
|
h.ja=function(a,b,c){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":this.J[b]=c;this.sb++;a=!0;break;default:a=this.parent.ja.call(this,a,b,c)}return a};
|
|
|
|
|
h.za=function(a){if(this.sb&&(a||!this.v.ba||this.v.Mb)){for(a=0;a<this.u.length;a++)Cc(this,"R"+a,this.u[a]);a=Ub(this);Cc(this,"PS",a);Cc(this,"NF",a&8?1:0,1);Cc(this,"ZF",a&4?1:0,1);Cc(this,"VF",a&2?1:0,1);Cc(this,"CF",a&1?1:0,1)}if(a=this.J.speed)a.textContent=this.v.ba&&this.ca?this.ca.toFixed(2)+"Mhz":"Stopped"};function dd(a){return a.P&65536?1:0}function ed(a){return a.R&32768?2:0}function fd(a){return a.Y&65535?0:4}h.Fa=function(){return this.U&32768?8:0};
|
|
|
|
|
function gd(a){var b=a.T(a.u[7]);a.u[7]=a.u[7]+2&65535;return b}function hd(a,b){a.u[7]=b&65535}function Qb(a,b,c,d,e){for(var f=a.A.length;0<f--;)if(a.A[f].ic===d){0<f&&(a.A[f-1].Ea+=a.A[f].Ea);a.A.splice(f,1);break}if(0<=b){for(f=a.A.length;0<f--;){if(a.A[f].Ea>b){a.A[f].Ea-=b;break}b-=a.A[f].Ea}a.A.splice(f+1,0,{Ea:b,Yb:c<<5&224,ic:d,Ab:e})}a.D|=2}function Ub(a){return a.K=a.K&63728|a.Fa()|fd(a)|ed(a)|dd(a)}
|
|
|
|
|
function Vb(a,b){a.U=b<<12;a.Y=~b&4;a.R=b<<14;a.P=b<<16;if((b^a.K)&2048)for(var c=a.Ha.length;0<=--c;){var d=a.u[c];a.u[c]=a.Ha[c];a.Ha[c]=d}a.C=b>>14&3;c=a.K>>14&3;a.C!=c&&(a.ta[c]=a.u[6],a.u[6]=a.ta[a.C]);a.D|=2;a.K=b}function O(a,b){a.D&128||(a.U=a.Y=b,a.R=0)}function id(a,b,c){a.D&128||(a.U=a.Y=a.P=b,a.R=c||0)}function jd(a,b,c,d){a.D&128||(a.U=a.Y=a.P=b,a.R=(c^b)&(d^b))}function kd(a,b){a.D&128||(a.U=a.Y=a.P=b,a.R=a.U^a.P>>1)}function ld(a,b,c,d){a.D&128||(a.U=a.Y=a.P=b,a.R=(c^d)&(d^b))}
|
|
|
|
|
h.O=function(a){var b=!1;0>this.la?this.la=Ub(this):this.C||(a=4,b=!0);this.G&57344||(this.Oa=63222,this.Fb=a);this.C=0;var c=this.T(a|this.aa),d=this.T(a+2&65535|this.aa);Vb(this,d&-12289|this.la>>2&12288);b&&(this.$|=4,this.u[6]=4);md(this,this.la);md(this,this.u[7]);hd(this,c);this.D&=-113;this.la=-1;throw a;};function nd(a){var b=od(a),c=od(a)&-1793;a.K&49152&&(c=c&-225|a.K&63712);hd(a,b);Vb(a,c);a.D&=-17}
|
|
|
|
|
function pd(a,b,c){var d,e,f,g=0;d=b>>13;a.Wa&a.wc[a.C]||(d&=7);e=a.S[a.C][d];f=(a.pa[a.C][d]<<6)+(b&8191)&a.jb;if(f<a.Ia)f&1&&!(c&1)&&(a.$|=64,a.O(4,10));else if(a.Wa&16||253952<=f&&(f|=4186112),4186112>f){if(3932160<=f){f&=262143;var l=f>>13&31;31>l?a.Wa&32&&(f=a.zc[l]+(f&8190)&4194302,3932160<=f&&4186112>f&&console.log("panic(898)")):f|=4186112}f>=a.Ia&&4186112>f&&(a.$|=32,a.O(4,12))}switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:
|
|
|
|
|
128;break;default:g=32768}32512!==(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.S[a.C][d]=e;if(4194170!==f||a.C)a.wa=a.C,a.xa=d;g&&(g&57344&&(0<=a.la&&(g|=128),a.G&57344||(a.G=a.G|g|a.wa<<5|a.xa<<1),a.O(168,16)),a.G&61440||!(4191360>f||4194239<f)||(a.G|=4096,a.G&512&&(a.D|=32)));return f}function od(a){var b=a.T(a.u[6]|a.aa);a.u[6]=a.u[6]+2&65535;return b}
|
|
|
|
|
function md(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.G&57344||(a.Oa=a.Oa<<8|246);!a.C&&c<=a.Pa&&4<c&&(c<=a.Pa-32?(a.$|=4,a.u[6]=4,a.O(4,18)):(a.$|=8,a.D|=4));a.Wb(c,b)}
|
|
|
|
|
function qd(a,b,c,d){var e,f,g=d&8?0:a.aa;switch(b){case 0:return a.O(4,20),0;case 1:return 6===c&&!a.C&&d&4&&(a.u[6]<=a.Pa||65534<=a.u[6])&&(a.u[6]<=a.Pa-32||65534<=a.u[6]?(a.$|=4,a.u[6]=4,a.O(4,22)):(a.$|=8,a.D|=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.T(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.T(e)|g;a.b-=
|
|
|
|
|
8;break;case 6:return e=gd(a),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=gd(a),e=e+a.u[c]&65535,e=a.T(e|a.aa)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;!g||a.G&57344||(a.Oa=a.Oa<<8|f<<3&248|c);6==c&&!a.C&&d&4&&0>=f&&(a.u[6]<=a.Pa||65534<=a.u[6])&&(a.u[6]<=a.Pa-32?(a.$|=4,a.u[6]=4,a.O(4,24)):(a.$|=8,a.D|=64));return e}h.tc=function(a,b,c){return qd(this,a,b,c)};h.uc=function(a,b,c){return pd(this,qd(this,a,b,c),c)};h.$c=function(a){return this.B.ma(a)};h.ec=function(a){return this.B.ma(pd(this,a,2))};
|
|
|
|
|
h.Cd=function(a,b){this.B.Xa(a,b&65535)};h.Dd=function(a,b){this.B.Xa(pd(this,a,4),b)};function rd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=qd(a,b,d,2),c&65536||61440!==(a.K&61440)&&(d&=65535),a.C=a.K>>12&3,c=a.T(d|c&a.aa),a.C=a.K>>14&3):c=6!=d||(a.K>>2&12288)===(a.K&12288)?a.u[d]:a.ta[a.K>>12&3];return c}
|
|
|
|
|
function sd(a,b,c,d){a.G&57344||(a.Oa=22);var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=qd(a,b,e,4),c&65536||(e&=65535),a.C=a.K>>12&3,e=pd(a,e|c&65536,4),a.C=a.K>>14&3,a.B.Xa(e,d)):6!=e||(a.K>>2&12288)===(a.K&12288)?a.u[e]=d:a.ta[a.K>>12&3]=d}function td(a,b){b>>=6;var c=a.I=b&7;(b=a.H=(b&56)>>3)?(c=a.M(b,c,3),a=a.B.Ua(c)):a=a.u[c]&255;return a}function ud(a,b){b>>=6;var c=a.I=b&7;return(b=a.H=(b&56)>>3)?a.B.ma(a.M(b,c,2)):a.u[c]}function vd(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return qd(a,b,c,8)}
|
|
|
|
|
function wd(a,b){var c=a.f=b&7;(b=a.g=(b&56)>>3)?(c=a.M(b,c,3),a=a.B.Ua(c)):a=a.u[c]&255;return a}function xd(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?a.B.ma(a.M(b,c,2)):a.u[c]}function P(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.Za=a.M(b,e,7),c=d.call(a,c,a.B.Ua(e)),e&1&&a.b--,a.B.ob(e,c&255)):a.u[e]=a.u[e]&65280|d.call(a,c,a.u[e])}function Q(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.M(b,e,6),a.B.Xa(e,d.call(a,c,a.B.ma(e)))):a.u[e]=d.call(a,c,a.u[e])}
|
|
|
|
|
function yd(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(d=a.M(b,e,5),d&1&&a.b--,a.B.ob(d,c&255)):a.u[e]=c?d&1?c<<24>>24&65535:a.u[e]&-256|c&255:a.u[e]&-256;return c}function zd(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?a.B.Xa(a.M(b,d,4),c):a.u[d]=c&65535;return c}function R(a,b,c){c&&(hd(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3}
|
|
|
|
|
h.fb=function(a){this.v.complete=!0;var b=this.v.rc=this.j&&Ad(this.j),c=a?this.v.Hb?0:1:-1;this.v.Hb=!1;this.N=this.b=a;do{if(b){if(Bd(this.j,this.u[7],c)){this.ea();break}c=1}if(this.D&&(this.D&112&&(this.D&32?this.O(168,28):this.D&64?this.O(4,30):this.D&16&&this.O(12,32),this.D&=-113),this.D&7))if(this.D&2){this.D&=-3;a=null;for(var d=this.Gb&224,e=this.A.length;0<=--e;){if(0<this.A[e].Ea){this.A[e].Ea--;this.D|=2;break}if(this.A[e].Ab){if(!this.A[e].Ab()){this.A.splice(e,1);continue}this.A[e].Ab=
|
|
|
|
|
null}this.A[e].Yb>d&&(d=this.A[e].Yb,a=this.A[e],this.A.splice(e,1))}d>(this.K&224)&&(this.D&4&&(this.u[7]=this.u[7]+2&65535,this.D&=-5),a?this.O(a.ic,26):this.O(160,26))}else this.D&1&&this.D++;this.G&57344||(this.Oa=0,this.Fb=this.u[7]);this.D=this.D&7|this.K&16;this.decode(gd(this))}while(0<this.b);return this.v.complete?this.N-this.b:void 0===this.v.complete?0:-1};La(function(){for(var a=A(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Ic(d);eb(d,c)}});
|
|
|
|
|
function Cd(a,b){var c=b+a;jd(this,c,a,b);return c&65535}function Dd(a,b){var c=b+a;jd(this,c<<8,a<<8,b<<8);return c&255}function Ed(a,b){a=b<<1;kd(this,a);return a&65535}function Fd(a,b){a=b<<1;kd(this,a<<8);return a&255}function Gd(a,b){a=b&32768|b>>1|b<<16;kd(this,a);return a&65535}function Hd(a,b){a=b&2048|b>>1|b<<8;kd(this,a<<8);return a&255}function Id(a,b){a=b&~a;O(this,a);return a}function Jd(a,b){a=b&~a;O(this,a<<8);return a}function Kd(a,b){a|=b;O(this,a);return a}
|
|
|
|
|
function Ld(a,b){a|=b;O(this,a<<8);return a}function Md(a,b){a=~b|65536;id(this,a);return a&65535}function Nd(a,b){a=~b|256;id(this,a<<8);return a&255}function Od(a,b){a=b-a;this.D&128||(this.U=this.Y=a,this.R=b&(b^a));return a&65535}function Pd(a,b){a=b-a;var c=a<<8;b<<=8;this.D&128||(this.U=this.Y=c,this.R=b&(b^c));return a&255}function Qd(a,b){a=b+a;this.D&128||(this.U=this.Y=a,this.R=a&(b^a));return a&65535}
|
|
|
|
|
function Rd(a,b){a=b+a;var c=a<<8;this.D&128||(this.U=this.Y=c,this.R=c&(b<<8^c));return a&255}function Sd(a,b){a=-b;id(this,a,a&b&32768);return a&65535}function Td(a,b){a=-b;id(this,a<<8,(a&b&128)<<8);return a&255}function Ud(a,b){a=b<<1|this.P>>16&1;kd(this,a);return a&65535}function Vd(a,b){a=b<<1|this.P>>16&1;kd(this,a<<8);return a&255}function Wd(a,b){a=(this.P&65536|b)>>1|b<<16;kd(this,a);return a&65535}function Xd(a,b){a=((this.P&65536)>>8|b)>>1|b<<8;kd(this,a<<8);return a&255}
|
|
|
|
|
function Yd(a,b){var c=b-a;ld(this,c,a,b);return c&65535}function Zd(a,b){var c=b-a;ld(this,c<<8,a<<8,b<<8);return c&255}function $d(a,b){this.D&128||(this.U=this.Y=b&65280,this.R=this.P=0);return(b<<8|b>>8)&65535}function ae(a,b){a^=b;O(this,a);return a&65535}
|
|
|
|
|
function be(a){var b=xd(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.P=this.R=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.P=c<<17-b,c>>=b;else if(b)if(16<b)this.R=c,c=0;else{this.P=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.R=32768)}this.u[a]=c&65535;this.U=this.Y=c;this.b-=(this.g?6:7)+b}
|
|
|
|
|
function ce(a){var b=xd(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.P=this.R=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.P=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.P=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.R=32768)):d=c;this.u[a]=d>>16&65535;this.u[a|1]=d&65535;this.U=d>>16;this.Y=d>>16|d;this.b-=(this.g?6:7)+b}function S(a){a&1&&(this.P=0);a&2&&(this.R=0);a&4&&(this.Y=1);a&8&&(this.U=0);this.b-=5}
|
|
|
|
|
function de(a){var b=xd(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.P=this.R=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.u[a]=d&65535,this.u[a|1]=c-d*b&65535,this.Y=d>>16|d,this.U=d>>16):(this.R=32768,this.Y=d>>15|d,this.U=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.Y=this.U=0,this.R=32768,this.P=65536,this.b-=7}var ee=[0,7,7,10,7,11,9,13];function fe(a){var b=this.b;hd(this,vd(this,a));this.b=b-ee[this.g]}
|
|
|
|
|
var ge=[0,14,14,17,14,18,16,20];function he(a){var b=this.b,c=vd(this,a);a=a>>6&7;md(this,this.u[a]);this.u[a]=this.u[7];hd(this,c);this.b=b-ge[this.g]}var ie=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17],je=[7,13,13,17,14,18,17,21];function ke(a){var b=xd(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.D&128||(this.U=b>>16,this.Y=this.U|b,this.R=0,this.P=-32768>b||32767<b?65536:0);this.b-=23}
|
|
|
|
|
function le(){this.b-=5}function T(a){a&1&&(this.P=65536);a&2&&(this.R=32768);a&4&&(this.Y=0);a&8&&(this.U=32768);this.b-=5}function me(a){var b=(a&448)>>6;if(this.u[b]=this.u[b]-1&65535)hd(this,this.u[7]-((a&63)<<1)),this.b+=1;this.b-=6}function ne(a){Q(this,a,0,$d);this.b-=this.g?9:3+(7==this.f?2:0)}function oe(a){Q(this,a,ud(this,a),ae);this.b-=this.g?9:3+(7==this.f?2:0)}function V(){this.O(8,6)}function bd(a){pe[a>>12].call(this,a)}
|
|
|
|
|
var pe=[function(a){qe[a>>8&15].call(this,a)},function(a){var b=ud(this,a),c=this.b;O(this,zd(this,a,b));this.b=c-ie[(this.H?8:0)+this.g]+(7!=this.f||this.g?0:2)},function(a){var b=ud(this,a);a=xd(this,a);ld(this,b-a,a,b);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){O(this,ud(this,a)&xd(this,a));this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){Q(this,a,ud(this,a),Id);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?
|
|
|
|
|
2:0)},function(a){Q(this,a,ud(this,a),Kd);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){Q(this,a,ud(this,a),Cd);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){re[a>>8&15].call(this,a)},function(a){se[a>>8&15].call(this,a)},function(a){var b=td(this,a);O(this,yd(this,a,b,1)<<8);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){var b=td(this,a)<<8;a=wd(this,a)<<8;ld(this,b-a,a,b);this.b-=this.g?
|
|
|
|
|
4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){O(this,(td(this,a)&wd(this,a))<<8);this.b-=this.g?4+(this.I&&6<=this.f?1:0):(this.H?4:3)+(7==this.f?2:0)},function(a){P(this,a,td(this,a),Jd);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){P(this,a,td(this,a),Ld);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},function(a){Q(this,a,ud(this,a),Yd);this.b-=this.g?9+(this.I&&6<=this.f?1:0):(this.H?5:3)+(7==this.f?2:0)},V],qe=
|
|
|
|
|
[function(a){Me[a>>4&15].call(this,a)},function(a){R(this,a,!0)},function(a){R(this,a,!fd(this))},function(a){R(this,a,fd(this))},function(a){R(this,a,!this.Fa()==!ed(this))},function(a){R(this,a,!this.Fa()!=!ed(this))},function(a){R(this,a,!fd(this)&&!this.Fa()==!ed(this))},function(a){R(this,a,fd(this)||!this.Fa()!=!ed(this))},he,he,function(a){Ne[a>>6&3].call(this,a)},function(a){Oe[a>>6&3].call(this,a)},function(a){Pe[a>>6&3].call(this,a)},function(a){Qe[a>>6&3].call(this,a)},V,V],Ne=[function(a){id(this,
|
|
|
|
|
zd(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,Md);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,1,Qd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,1,Od);this.b-=this.g?9:3+(7==this.f?2:0)}],Oe=[function(a){Q(this,a,0,Sd);this.b-=this.g?11:6},function(a){Q(this,a,dd(this)?1:0,Cd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,dd(this)?1:0,Yd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=xd(this,a);id(this,a);this.b-=this.g?4:3+(7==this.f?
|
|
|
|
|
2:0)}],Pe=[function(a){Q(this,a,0,Wd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,Ud);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,Gd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){Q(this,a,0,Ed);this.b-=this.g?9:3+(7==this.f?2:0)}],Qe=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.ec(a|65536);hd(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=rd(this,a,0);md(this,a);O(this,a);this.b-=11},function(a){var b=od(this),c=this.b;sd(this,a,
|
|
|
|
|
0,b);O(this,b);this.b=c-je[this.g]},function(a){O(this,zd(this,a,this.Fa?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],Me=[function(a){Re[a&15].call(this,a)},V,V,V,fe,fe,fe,fe,function(a){if(a&8)this.O(8,6);else{var b=od(this);a&=7;hd(this,this.u[a]);this.u[a]=b;this.b-=9}},function(a){a&8?(this.K&49152||(this.K=this.K&-2017|(a&7)<<5,this.D|=1),this.b-=5):this.O(8,6)},function(a){Se[a&15].call(this,a)},function(a){Te[a&15].call(this,a)},ne,ne,ne,ne],Re=[function(){this.K&49152?(this.$|=128,this.O(4,
|
|
|
|
|
3)):this.ea();this.b-=7},function(){this.D|=4;this.u[7]=this.u[7]+-2&65535;this.b-=3},function(){nd(this);this.D|=this.K&16;this.b-=13},function(){this.O(12,1);this.b-=5},function(){this.O(16,4);this.b-=25},function(){this.K&49152||(cd(this),this.B.reset());this.b-=667},function(){nd(this);this.b-=13},V,V,V,V,V,V,V,V,V],Se=[le,function(){this.P=0;this.b-=5},function(){this.R=0;this.b-=5},S,function(){this.Y=1;this.b-=5},S,S,S,function(){this.U=0;this.b-=5},S,S,S,S,S,S,S],Te=[le,function(){this.P=
|
|
|
|
|
65536;this.b-=5},function(){this.R=32768;this.b-=5},T,function(){this.Y=0;this.b-=5},T,T,T,function(){this.U=32768;this.b-=5},T,T,T,T,T,T,T],re=[ke,ke,de,de,be,be,ce,ce,oe,oe,V,V,V,V,me,me],se=[function(a){R(this,a,!this.Fa())},function(a){R(this,a,this.Fa())},function(a){R(this,a,!dd(this)&&!fd(this))},function(a){R(this,a,dd(this)||fd(this))},function(a){R(this,a,!ed(this))},function(a){R(this,a,ed(this))},function(a){R(this,a,!dd(this))},function(a){R(this,a,dd(this))},function(){this.O(24,2);
|
|
|
|
|
this.b-=25},function(){this.O(28,5);this.b-=5},function(a){Ue[a>>6&3].call(this,a)},function(a){Ve[a>>6&3].call(this,a)},function(a){We[a>>6&3].call(this,a)},function(a){Xe[a>>6&3].call(this,a)},V,V],Ue=[function(a){id(this,yd(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){P(this,a,0,Nd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){P(this,a,1,Rd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){P(this,a,1,Pd);this.b-=this.g?9:3+(7==this.f?2:0)}],Ve=[function(a){P(this,a,0,Td);this.b-=
|
|
|
|
|
this.g?11:6},function(a){P(this,a,dd(this)?1:0,Dd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){P(this,a,dd(this)?1:0,Zd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=wd(this,a);id(this,a<<8);this.b-=this.g?4:3+(7==this.f?2:0)}],We=[function(a){P(this,a,0,Xd);this.b-=this.g?9+(this.Za&1):3+(7==this.f?2:0)},function(a){P(this,a,0,Vd);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){P(this,a,0,Hd);this.b-=this.g?9+(this.Za&1):3+(7==this.f?2:0)},function(a){P(this,a,0,Fd);this.b-=this.g?9:3+(7==
|
|
|
|
|
this.f?2:0)}],Xe=[V,function(a){a=rd(this,a,65536);md(this,a);O(this,a);this.b-=11},function(a){var b=od(this),c=this.b;sd(this,a,65536,b);O(this,b);this.b=c-je[this.g]},V];function Ye(a){r.call(this,"ROM",a,Ye);this.f=null;this.C=a.addr;this.g=a.size;this.G=a.writable;this.F=a.alias;this.A=a.file;this.H=da(this.A);if(this.A){a=this.A;var b=ea(this.H);"json"!=b&&"hex"!=b&&(a=ga()+"/api/v1/dump?file="+this.A+"&format=bytes&decimal=true");var c=this;ua(a,null,!0,function(a,b,f){Ze(c,a,b,f)})}}y(Ye);
|
|
|
|
|
Ye.prototype.Ga=function(a,b,c,d){this.B=b;this.b=c;this.j=d;$e(this)};Ye.prototype.Ca=function(){if(this.Da){if(this.j){var a=this.j,b=this.id,c=this.C,d=this.g,e=this.Da,f=[],g;for(g in e){var l=e[g];"number"==typeof l&&(e[g]=l={o:l});var n=l.o,p=l.a;if(void 0!==n){var q=f,n=[n>>>0,g],v=qa(q,n,a.Lb);0>v&&q.splice(-(v+1),0,n)}p&&(l.a=p.replace(/''/g,'"'))}a.H.push({Id:b,w:c,vc:d,Da:e,Kb:f})}delete this.Da}return!0};Ye.prototype.Ba=function(){return!0};
|
|
|
|
|
function Ze(a,b,c,d){if(d)a.na("Unable to load system ROM (error "+d+": "+b+")");else{ab(a.zb,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.Da=l.symbols;if(!a.f.length){m("Empty ROM: "+
|
|
|
|
|
b);return}if(1==a.f.length){m(a.f[0]);return}}catch(n){a.na("ROM data error: "+n.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]=aa(b[e],16);$e(a)}}
|
|
|
|
|
function $e(a){if(!hb(a))if(!a.A)G(a);else if(a.f&&a.B){a.g||(a.g=a.f.length);if(a.f.length!=a.g)vb(a,"ROM size ("+k(a.f.length,8,!0)+") does not match specified size ("+k(a.g,8,!0)+")");else{var b;b=a.C;if(Gb(a.B,b,a.g,a.G?1:jc)){var c;for(c=0;c<a.f.length;c++){a.j&&a.j.g++;var d=a.B,e=b+c;d.X[(e&d.g)>>>d.Z].wb(e&d.f,a.f[c]&255,e);a.j&&a.j.g--}b=!0}else b=!1;if(b){b=[];"number"==typeof a.F?b.push(a.F):null!=a.F&&a.F.length&&(b=a.F);for(c=0;c<b.length;c++){for(var f=a,d=b[c],e=f.B,g=f.g,l=[],n=f.C>>>
|
|
|
|
|
e.Z;0<g&&n<e.X.length;)l.push(e.X[n++]),g-=e.ya;e=f.B;f=f.g;g=0;for(d>>>=e.Z;0<f&&d<e.X.length;){n=l[g++];if(!n)break;e.X[d++]=n;f-=e.ya}}delete a.f}}G(a)}}La(function(){for(var a=A(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new Ye(d);eb(d,c)}});function af(a){r.call(this,"RAM",a,af);this.F=a.addr;this.g=a.size;this.f=!1}y(af);h=af.prototype;h.Ga=function(a,b,c,d){this.B=b;this.b=c;this.j=d;G(this)};h.Ca=function(a,b){b||this.reset();return!0};
|
|
|
|
|
h.Ba=function(a){return a?this.save():!0};h.reset=function(){!this.f&&this.g&&Gb(this.B,this.F,this.g,1)&&(this.f=!0);this.f||m("No RAM allocated")};h.save=function(){return null};h.restore=function(){return!0};La(function(){for(var a=A(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new af(d);eb(d,c)}});function bf(a){r.call(this,"Keyboard",a,bf,65536);G(this)}y(bf);bf.prototype.ja=function(){return!1};bf.prototype.Ga=function(a,b,c,d){this.F=a;this.b=c;this.j=d;this.oa=null};
|
|
|
|
|
La(function(){for(var a=A(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new bf(d);eb(d,c)}});function W(a){this.A=this.G=null;this.V=a.tabSize;this.M=a.charBOL;this.H=0;r.call(this,"SerialPort",a,W,8388608);var b=a.binding;if("console"==b)this.G="";else{var c;a=cf;b&&(void 0===c&&(c="Panel"),(c=db(c,this.id))&&(b=c.J[b])&&this.ja(null,a,b))}this.I=this.L=null;this.exports={connect:this.Tb,receiveData:this.Eb}}y(W);var cf="buffer";h=W.prototype;
|
|
|
|
|
h.ja=function(a,b,c){var d=this;switch(b){case cf:return this.J[b]=this.A=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.Eb(b);return!0},c.onkeypress=function(a){a=a||window.event;d.Eb(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
|
|
|
|
|
h.Ga=function(a,b,c,d){this.F=a;this.B=b;this.b=c;this.j=d;var e=this;this.W=Pb(this.b,function(){e.f&128||!e.C.length||(e.T=e.C.shift(),e.f|=128,e.f&64&&Qb(e.b,40,4,48))});this.N=function(){e.g|=128;return!!(e.g&64)};Nb(b,this,df);G(this)};
|
|
|
|
|
h.Tb=function(){if(!this.I){var a=wc(this.F,"connection");if(a){var b=a.split("->");if(2==b.length){var c=oa(b[0]);if(c!=this.Ya)return;b=oa(b[1]);if(this.I=cb(b)){var d=this.I.exports;if(d){var e=d.connect;e&&e.call(this.I);if(this.L=d.receiveData){this.status(this.zb+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};h.Ca=function(a,b){if(!b)if(this.Tb(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
|
|
|
|
|
h.Ba=function(a){return a?this.save():!0};h.reset=function(){ef(this)};h.save=function(){var a=new N(this);a.set(0,[]);return a.data()};h.restore=function(){return ef(this)};function ef(a){a.T=0;a.f=0;a.g=128;a.C=[];return!0}h.Eb=function(a){if("number"==typeof a)this.C.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.C.push(a.charCodeAt(b));else this.C=this.C.concat(a);Rb(this.b,this.W,50);return!0};h.Pc=function(){return this.f&65535};h.rd=function(a){this.f=this.f&-112|a&111};
|
|
|
|
|
h.Oc=function(){this.f&=-129;0<this.C.length&&Rb(this.b,this.W,50);return this.T};h.qd=function(){};h.bd=function(){return this.g};h.Fd=function(a){128==(this.g&192)&&a&64&&Qb(this.b,8,4,52,this.N);this.g=this.g&-70|a&69};h.ad=function(){return 0};
|
|
|
|
|
h.Ed=function(a){if(a&=255){D(this,"transmitByte("+k(a,2,!0)+")");this.L&&this.L.call(this.I,a);if(this.A)if(13==a)this.H=0;else if(8==a)this.A.value=this.A.value.slice(0,-1),0<this.H&&this.H--;else{var b;b=(b=pa[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.V||8,c=a-this.H%a,this.V&&(b=na("",c)));this.M&&!this.H&&c&&(b=String.fromCharCode(this.M)+b);this.A.value+=b;this.A.scrollTop=this.A.scrollHeight;this.H+=c}else if(null!=this.G){if(10==a||1024<=this.G.length)this.i(this.G),
|
|
|
|
|
this.G="";10!=a&&(this.G+=String.fromCharCode(a))}this.g&=-129;Qb(this.b,100,4,52,this.N)}};var ff={},df=(ff[65392]=[null,null,W.prototype.Pc,W.prototype.rd,"RCSR"],ff[65394]=[null,null,W.prototype.Oc,W.prototype.qd,"RBUF"],ff[65396]=[null,null,W.prototype.bd,W.prototype.Fd,"XCSR"],ff[65398]=[null,null,W.prototype.ad,W.prototype.Ed,"XBUF"],ff);La(function(){for(var a=A(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new W(d);eb(d,c)}});
|
|
|
|
|
function gf(a){r.call(this,"Debugger",a,gf);this.ia=a.base||16;this.xa=!1;this.T=this.wa=this.I=0;this.W=!1;this.C=-1;this.A=[];this.ca={}}y(gf);var hf={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};gf.prototype.Pb=function(){return-1};gf.prototype.Qb=function(){};
|
|
|
|
|
function jf(a,b,c,d){if(c)if(b){0>a.C&&a.A.length&&(a.C=0);if(0>a.C||b!=a.A[a.C])a.A.splice(0,0,b),a.C=0;a.C--}else a.W?b="end":b=a.A[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(oa(b.substring(c,f))),c=f+1}}return a}
|
|
|
|
|
function kf(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 sf(a,b,c){var d;if(b){b=tf(a,b);for(var e=0,f=!1,g=b,k=[],m=[],n=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<n.length;){var p=n[e++],t=p.length,p=pa(p);if(!p){f=!0;break}p=uf(a,p,null,!1===c);if(void 0===p){f=!0;c=!1;break}k.push(p);if(e==n.length)break;var p=n[e++],r=p.length;m.length&&pf[p]<pf[m[m.length-1]]&&rf(k,m,1);m.push(p);b=b.substr(t+r)}rf(k,m)&&1==k.length||(f=!0);f?c&&a.i("error parsing '"+g+"' at character "+(g.length-b.length)):(d=k.pop(),c&&vf(a,null,
|
|
|
|
|
d))}return d}function tf(a,b){for(var c,d=a.Ca?"(":"{",e=a.Ca?")":"}",f=new RegExp(a.Ca?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(f))&&!(0<=c[1].indexOf(d));){var g=sf(a,c[1]);b=b.replace(d+c[1]+e,null!=g?I(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.X-a.Ba}if(null==d)break;b=b.replace(c[0],d.toString())}return b}
|
|
|
|
|
function uf(a,b,c,d){var e;null!=b?(e=a.Ac(b),0<=e?e=a.Bc(e):(e=a.ha[b],null==e&&(e=aa(b,a.na))),null!=e||d||a.i("invalid "+(c?c:"value")+": "+b)):d||a.i("missing "+(c||"value"));return e}
|
|
|
|
|
function vf(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=0,g="";if(!f||4<f)f=4;for(var k=0;k<f;k++){g&&(g=","+g);var m=d&255,n=8,p="";n?32<n&&(n=32):n=32;if(null==m||isNaN(m))for(;0<n--;)p="?"+p;else for(;0<n--;)p=(m&1?"1":"0")+p,m>>=1;g=p+g;d>>=8}d=l(c,0,!0)+" "+c+". "+ca(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.i((null!=b?b+": ":"")+d);return e}function wf(a,b){if(b)return vf(a,b,a.ha[b]);var c=0;for(b in a.ha)vf(a,b,a.ha[b]),c++;return 0<c}
|
|
|
|
|
function I(a,b,c,d){switch(a.na){case 8:a=ca(b,3*c);break;case 10:a=b.toString();break;default:a=l(b,2*c)}d&&"0"==a.charAt(0)&&(a=a.replace(/^0+([0-9A-F]+)$/i,"$1"));return a}
|
|
|
|
|
function xf(a){of.call(this,a);this.Ca=!0;this.R=Y(0);this.fb=Y(0);this.Z=Y(0);this.H=[];this.f=this.S=this.G=[];yf(this);this.ra=0;zf(this);this.Sa={};Af(this,a.messages);this.Ta=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return Fc(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return Fc(b,a)})}y(xf,of);
|
|
|
|
|
var Bf={"?":"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"},Cf="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(" "),
|
|
|
|
|
Df={61440:{4096:[62,4032,63],8192:[47,4032,63],12288:[18,4032,63],16384:[14,4032,63],20480:[16,4032,63],24576:[3,4032,63],36864:[63,4032,63],40960:[48,4032,63],45056:[19,4032,63],49152:[15,4032,63],53248:[17,4032,63],57344:[94,4032,63]},65024:{2048:[57,448,63],28672:[100,63,448],29184:[101,63,448],29696:[102,63,448],30208:[103,63,448],30720:[104,448,63],32256:[105,448,8192]},65280:{256:[27,4096],512:[24,4096],768:[10,4096],1024:[11,4096],1280:[22,4096],1536:[12,4096],1792:[20,4096],32768:[25,4096],
|
|
|
|
|
function lf(a,b,c){var d;if(b){b=mf(a,b);for(var e=0,f=!1,g=b,l=[],n=[],p=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<p.length;){var q=p[e++],v=q.length,q=oa(q);if(!q){f=!0;break}q=nf(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++],u=q.length;n.length&&hf[q]<hf[n[n.length-1]]&&kf(l,n,1);n.push(q);b=b.substr(v+u)}kf(l,n)&&1==l.length||(f=!0);f?c&&a.i("error parsing '"+g+"' at character "+(g.length-b.length)):(d=l.pop(),c&&of(a,null,
|
|
|
|
|
d))}return d}function mf(a,b){for(var c,d=a.xa?"(":"{",e=a.xa?")":"}",f=new RegExp(a.xa?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(f))&&!(0<=c[1].indexOf(d));){var g=lf(a,c[1]);b=b.replace(d+c[1]+e,null!=g?I(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.T-a.wa}if(null==d)break;b=b.replace(c[0],d.toString())}return b}
|
|
|
|
|
function nf(a,b,c,d){var e;null!=b?(e=a.Pb(b),0<=e?e=a.Qb(e):(e=a.ca[b],null==e&&(e=aa(b,a.ia))),null!=e||d||a.i("invalid "+(c?c:"value")+": "+b)):d||a.i("missing "+(c||"value"));return e}
|
|
|
|
|
function of(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 n=d&255,p=8,q="";p?32<p&&(p=32):p=32;if(null==n||isNaN(n))for(;0<p--;)q="?"+q;else for(;0<p--;)q=(n&1?"1":"0")+q,n>>=1;g=q+g;d>>=8}d=k(c,0,!0)+" "+c+". "+ba(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.i((null!=b?b+": ":"")+d);return e}function pf(a,b){if(b)return of(a,b,a.ca[b]);var c=0;for(b in a.ca)of(a,b,a.ca[b]),c++;return 0<c}
|
|
|
|
|
function I(a,b,c,d){switch(a.ia){case 8:a=ba(b,3*c);break;case 10:a=b.toString();break;default:a=k(b,2*c)}d&&"0"==a.charAt(0)&&(a=a.replace(/^0+([0-9A-F]+)$/i,"$1"));return a}
|
|
|
|
|
function qf(a){gf.call(this,a);this.xa=!0;this.M=X(0);this.Qa=X(0);this.V=X(0);this.H=[];this.f=this.N=this.G=[];rf(this);this.la=0;sf(this);this.Ia={};tf(this,a.messages);this.Ja=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return zc(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return zc(b,a)})}y(qf,gf);
|
|
|
|
|
var uf={"?":"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"},vf="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(" "),
|
|
|
|
|
wf={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=xf.prototype;
|
|
|
|
|
h.Pa=function(a,b,c,d){this.F=b;this.b=c;this.D=a;(a=Cc(a,"messages"))&&Af(this,a);this.sb=Df;Ef(this,function(a){a:{var b=d.F.aa,c=a[0],e=a=0,m=b.length;if(c){a=Z(Ff(d,c));if(-1===a){d.i("invalid address: "+c);break a}e=a>>>d.F.ca;m=1}d.i("blockid physical blockaddr used size type");d.i("-------- --------- ---------- ------ ------ ----");for(var c=-1,n=0;m--;){var p=b[e];p.type==c?n++||d.i("..."):(c=p.type,n=Kb[c],p&&d.i(l(p.id,8)+" %"+l(e<<d.F.ca,8)+" %%"+l(p.A,8)+" "+l(p.Rb,
|
|
|
|
|
4,!0)+" "+l(p.size,4,!0)+" "+n),c!=oc&&(c=-1),n=0);a+=d.F.Da;e++}}});G(this)};
|
|
|
|
|
h.pa=function(a,b,c){var d=this;switch(b){case "debugInput":return this.qa=this.L[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",Fc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.B<d.w.length-1&&(b=d.w[++d.B])):40==a.keyCode&&(0<d.B?b=d.w[--d.B]:(b="",d.B=-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.L[b]=c,Ga(c,function(){if(d.qa){var a=d.qa.value;
|
|
|
|
|
d.qa.value="";Fc(d,a,!0);return!0}return!1}),!0;case "step":return this.L[b]=c,Ga(c,function(a){var b=!1;hb(d,!0)||(gb(d,!0),b=d.Bb(a?1:0),gb(d,!1));return b}),!0}return!1};h.Qb=function(){this.qa&&this.qa.focus()};function Z(a){a=a&&a.A;null==a&&(a=-1);return a}h.mb=function(a,b){var c=255,d=Z(a);-1!==d&&(this.g++,c=this.F,c=c.aa[(d&c.g)>>>c.ca].lc(d&c.f,d),this.g--,b&&Gf(a,b));return c};h.Ia=function(a,b){var c=65535,d=Z(a);-1!==d&&(this.g++,c=Lb(this.F,d),this.g--,b&&Gf(a,b));return c};
|
|
|
|
|
h.Ob=function(a,b,c){var d=Z(a);if(-1!==d){this.g++;var e=this.F;e.aa[(d&e.g)>>>e.ca].dc(d&e.f,b&255,d);this.g--;c&&Gf(a,c);O(this.b,!0)}};h.qc=function(a,b,c){var d=Z(a);if(-1!==d){this.g++;var e=this.F;e.aa[(d&e.g)>>>e.ca].tc(d&e.f,b&65535,d);this.g--;c&&Gf(a,c);O(this.b,!0)}};function Y(a){return{A:a,Ha:!1}}function Hf(a){return[a.A,a.Ha]}function If(a){return{A:a[0],Ha:a[1]}}
|
|
|
|
|
function Ff(a,b,c){var d;c=(c?a.R:a.fb).A;if(void 0!==b){d=b=tf(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;c<a.H.length;c++){var f=a.H[c].La[d];if(void 0!==f){d=f.o;void 0!==d&&(e=Y(d));break}}if(d=e)return d;c=sf(a,b,void 0)}null!=c&&(d=Y(c));return d}function Jf(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Rc=qf(a,b.Nc=c[2]))}function Gf(a,b){null!=a.A&&(a.A+=b||1)}
|
|
|
|
|
function Af(a,b){a.j=a;a.ma=a.Tc=536870912;a.va=null;a.ya=[];a.g=0;b=qf(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in yb){var d;a:if(d=void 0,Array.prototype.indexOf)d=b.indexOf(c,d);else{d=d||0;0>d&&(d+=b.length);0>d&&(d=0);for(var e=b.length;d<e;d++)if(d in b&&b[d]===c)break a;d=-1}0<=d&&(a.ma|=yb[c],a.i(c+" messages enabled"))}}function Ef(a,b){for(var c in yb)if(64==yb[c]){a.Sa[c]=b;break}}
|
|
|
|
|
h.Ac=function(a){var b=-1;a=a.toUpperCase();switch(a){case "SP":b=6;break;case "PC":b=7;break;default:"R"==a.charAt(0)&&(b=+a.charAt(1),0>b||7<b)&&(b=-1)}return b};function Kf(a){return 6>a?"R"+a:6==a?"SP":"PC"}h.Bc=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Qa[a-8]:20>a?b=this.b.Aa[a-16]:20==a&&(b=Tb(this.b)));return b};
|
|
|
|
|
h.message=function(a,b){this.g||(b&&(a+=" @"+I(this,Y(this.b.u[7]).A)),this.ma&1073741824?this.ya.push(a):this.va&&a==this.va||(this.va=a,this.ma&-2147483648&&(this.ia(),a+=" (cpu halted)"),this.i(a),this.b&&(a=this.b,a.S-=a.b,a.b=0,a.qa=0,O(a))))};
|
|
|
|
|
function zf(a){var b;if(Gd(a)){if(!a.N||!a.N.length){a.N=Array(1E3);for(b=0;b<a.N.length;b++)a.N[b]=Y();a.la=0;a.i("instruction history buffer allocated")}if(!a.ka||!a.ka.length)for(a.ka=Array(256),b=0;b<a.ka.length;b++)a.ka[b]=[b,0]}else a.N&&a.N.length&&a.i("instruction history buffer freed"),a.la=0,a.N=[],a.ka=[]}h.Ab=function(a){if(!Lf(this))return!1;this.b.Ab(a);return!0};
|
|
|
|
|
h.Bb=function(a,b,c){if(!Lf(this))return!1;this.J=0;a||Gd(this)&&Hd(this,this.b.u[7],0);try{a=ed(this.b,a);var d=this.b.Bb(a);0<d&&(fd(this.b,a),this.J+=d,Kc(this.b,d,!0),Gc(this.b,d),this.X++)}catch(e){"number"!=typeof e&&(this.J=0,kb(this.b,e.stack||e.message))}!1!==c&&O(this.b);this.Ga(b||!1);return 0<this.J};h.ia=function(a){this.b&&this.b.ia(a)};h.Ga=function(a){void 0===a&&(a=!0);this.R=Y(this.b.u[7]);a&&1!=this.ea?Mf(this):Nf(this)};
|
|
|
|
|
function Lf(a){var b;if(b=a.b&&ib(a.b))b=a.b,b.v.ja?b=!0:(b.i(b.toString()+" not powered"),b=!1);return b&&!a.b.v.ga?!jb(a.b):!1}h.Ka=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};h.Ja=function(a,b){b&&this.i(a?"suspending":"shutting down");return a?this.save():!0};h.reset=function(a){zf(this);this.X=this.Ba=0;this.va=null;this.J=0;this.R=Y(this.b.u[7]);this.v.ga=!1;Of(this);a||this.Ga()};
|
|
|
|
|
h.save=function(){var a=new P(this);a.set(0,Hf(this.R));a.set(1,Hf(this.Z));a.set(2,[this.w,this.$,this.ma]);a.set(3,this.H);return a.data()};h.restore=function(a){var b=0;void 0!==a[2]&&(this.R=If(a[b++]),this.Z=If(a[b++]),this.w=a[b][0],"string"==typeof this.w&&(this.w=[this.w]),this.$=a[b][1],this.ma|=a[b][2]);a[3]&&(this.H=a[3]);return!0};h.start=function(a,b){this.ea||this.i("running");this.v.ga=!0;this.Tb=a;this.Vb=b};
|
|
|
|
|
h.stop=function(a,b){if(this.v.ga){this.v.ga=!1;this.J=b-this.Vb;if(!this.ea){b="stopped";if(this.J){a-=this.Tb;var c=0<a?Math.round(1E3*this.J/a):0;b+=" (";Gd(this)&&(b+=this.X+" opcodes, ",this.Ba-=this.X,this.X=0);b+=this.J+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.i(b)}this.Ga(!0);this.Qb();Of(this,this.b.u[7])}};function Gd(a){return 1<a.f.length||!!a.ra}
|
|
|
|
|
function Hd(a,b,c){var d=a.b;if(0<c&&(a.ra&&!--a.ra||xc(a,b,1,a.f)))return!0;0<=c&&a.ka.length&&(a.X++,a.g++,b=Lb(a.F,b),a.g--,null!=b&&(b=a.N[a.la],b.A=d.u[7],b.Ha=!1,++a.la==a.N.length&&(a.la=0)));return!1}function yf(a){var b,c;a.f=["bp"];if(a.S)for(b=1;b<a.S.length;b++){c=a.S[b];var d=a.F;yc(d.aa[Z(c)>>>d.ca],!1)}a.S=["br"];if(a.G)for(b=1;b<a.G.length;b++)c=a.G[b],d=a.F,yc(d.aa[Z(c)>>>d.ca],!0);a.G=["bw"];a.pb=0}
|
|
|
|
|
h.jb=function(a,b,c){var d=!0;c||Pf(this,a,b,!1,!0);if(a!=this.f){var e=Z(b);if(-1===e)this.i("invalid address: "+I(this,b.A)),d=!1;else{var f=this.F;f.aa[e>>>f.ca].jb(e&f.f,a==this.G)}}d&&(a.push(b),c?b.Ha=!0:(Qf(this,a,a.length-1,"set"),zf(this)));return d};function Pf(a,b,c,d,e){var f=!1;c=Z(c);for(var g=1;g<b.length;g++){var k=b[g];if(c==Z(k)&&(!d||k.Ha)){f=!0;k.Ha||e||Qf(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.F,yc(d.aa[c>>>d.ca],b==a.G));k.Ha||zf(a);break}}return f}
|
|
|
|
|
function Rf(a,b){for(var c=1;c<b.length;c++)Qf(a,b,c);return b.length-1}function Qf(a,b,c,d){c=b[c];a.i(b[0]+" "+I(a,c.A)+(d?" "+d:c.Nc?' "'+c.Nc+'"':""))}function Of(a,b){if(void 0!==b)xc(a,b,1,a.f,!0),a.ea=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Ha){if(!Pf(a,a.f,c,!0))break;b=0}}}
|
|
|
|
|
function xc(a,b,c,d,e){var f=!1;if(!a.pb++)for(var g=1;!f&&g<d.length;g++){var k=d[g];if(!e||k.Ha)for(var m=Z(k),n=0;n<c;n++)if(b+n==m){var p,f=!0;k.Ha&&(Pf(a,d,k,!0),e=!0);if(p=k.Rc){for(var f=!1,t=0;t<p.length;t++)if(!Sf(a,p[t],!0)){if(p[t].indexOf("if")){f=!0;break}for(var r=t+1;r<p.length&&p[r].indexOf("else");r++)t++;if(r==p.length){f=!0;break}}a.b.v.ga||(f=!0)}if(f){e||Qf(a,d,g,"hit");break}}}a.pb--;return f}
|
|
|
|
|
function Tf(a,b,c,d){var e=Y(b.A),f=a.Ia(b,2),g,k;for(k in a.sb)if(g=a.sb[k][f&k])break;g||(g=[0]);for(var m=k="",n=Cf[g[0]],p=g.length-1,t=1;t<=p;t++){var r=g[t];if(void 0!==r){var w;w=a;var B=r,r=b,x="",C=B&61440;if(4096==C)r=r.A+((f&255)<<24>>23)&65535,x=I(w,r);else if(8192==C)r=r.A-((f&63)<<1)&65535,x=I(w,r);else if(12288==C)x=I(w,f&7,1);else if(24576==C)x=I(w,f&63,1);else if(C=f&B,B&4032&&(C>>=6,B>>=6),B&63)switch(B=C&7,C&56){case 0:x=Kf(B);break;case 8:x="@"+Kf(B);break;case 16:7>B?x="("+Kf(B)+
|
|
|
|
|
")+":(C=w.Ia(r,2),x="#"+I(w,C,0,!0));break;case 24:7>B?x="@("+Kf(B)+")+":(C=w.Ia(r,2),x="@#"+I(w,C,0,!0));break;case 32:x="-("+Kf(B)+")";break;case 40:x="@-("+Kf(B)+")";break;case 48:C=w.Ia(r,2);x=I(w,C,0,!0)+"("+Kf(B)+")";7==B&&(x=[x,I(w,C+r.A&65535)]);break;case 56:C=w.Ia(r,2),x="@"+I(w,C)+"("+Kf(B)+")",7==B&&(x=[x,I(w,C+r.A&65535)])}w=x;if(!w||!w.length){k="INVALID";break}"string"!=typeof w&&(m=w[1],w=w[0]);0<k.length&&(k+=",");k+=w||"???"}}f="";g=I(a,e.A)+":";if(-1!==e.A&&-1!==b.A){do if(f+=" "+
|
|
|
|
|
I(a,a.Ia(e,2)),null==e.A)break;while(e.A!=b.A)}g+=oa(f,24);g+=oa(n,5);k&&(g+=" "+k);if(c||m)g=oa(g,60)+";"+(c||""),g=a.b.v.rb?g+("cycles="+Hc(a.b).toString()+" cs="+l(a.b.Ib)):g+(null!=d?"="+d.toString():""),m&&(g+=" @"+m);return g}function Uf(a,b){switch(b){case "N":a=a.b.Oa();break;case "Z":a=ld(a.b);break;case "V":a=kd(a.b);break;case "C":a=jd(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
|
|
|
|
|
function Vf(a,b){var c="",d=a.b;8>b?(c=Kf(b),c+="="+I(a,d.u[b])):13>b?c="A"+(b-8)+"="+I(a,d.Qa[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+I(a,d.Aa[b-16]):20==b&&(c="PS="+I(a,Tb(d)));c&&(c+=" ");return c}function Wf(a){var b,c="";for(b=0;6>b;b++)c+=Vf(a,b);c=c+"\n"+(Vf(a,6)+Vf(a,7)+Vf(a,20));return c+=Uf(a,"T")+Uf(a,"N")+Uf(a,"Z")+Uf(a,"V")+Uf(a,"C")}h.vc=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
|
|
|
|
|
function Xf(a,b,c){var d=[],e=Z(b)>>>0;for(b=0;b<a.H.length;b++){var f=a.H[b],g=f.A>>>0,k=f.Zc;if(e>=g&&e<g+k){e=ra(f.uc,[e-g],a.vc);0<=e?Yf(a,b,e,d):c&&(e=~e,Yf(a,b,e-1,d),Yf(a,b,e,d));break}}return d}function Yf(a,b,c,d){var e={},f=a.H[b].uc,g=0,k=null;0<=c&&c<f.length&&(g=f[c][0],k=f[c][1]);k&&(e=a.H[b].La[k],k="."==k.charAt(0)?null:e.l||k);d.push(k);d.push(g);d.push(e.a);d.push(e.c)}
|
|
|
|
|
function Zf(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return wf(a)||a.i("no variables"),!0;if(!c[2])return wf(a,c[1]);if(!c[3])return delete a.ha[c[1]],!0;b=sf(a,c[3]);return void 0!==b?(a.ha[c[1]]=b,!0):!1}a.i("invalid assignment:"+b);return!1}
|
|
|
|
|
function $f(a,b,c){var d=null;if(b=Ff(a,b,!0)){var e=Xf(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.A-e[1])&&(g=" + "+l(f,4,!0)),f=e[0]+" ("+I(a,e[1])+")"+g,c&&a.i(f),d=f);4<e.length&&e[4]&&(g="",(f=e[5]-b.A)&&(g=" - "+l(f,4,!0)),f=e[4]+" ("+I(a,e[5])+")"+g,c&&a.i(f),d||(d=f))}else c&&a.i("no symbols")}return d}
|
|
|
|
|
function Mf(a,b){var c;if(b&&"?"==b[1])a.i("register commands:"),a.i("\tr\tdump registers"),a.i("\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.i("missing value for "+b[1]);return}f=sf(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":nd(d,f);a.R=Y(d.u[7]);break;case "N":d.Y=f?32768:0;break;
|
|
|
|
|
case "Z":d.ba=f?0:1;break;case "V":d.V=f?32768:0;break;case "C":d.U=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.i("unknown register: "+e);return}O(d);a.i("updated registers:")}a.i(Wf(a));c&&(a.R=Y(d.u[7]),Nf(a,I(a,a.R.A)))}}function ag(a,b){b=pa(b);var c=b.match(/^(['"])(.*?)\1$/);c?1<c[2].length?a.i(c[2]):vf(a,null,c[2].charCodeAt(0)):sf(a,b,!0)}
|
|
|
|
|
function bg(a,b,c){var d="t"!=b;c=uf(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Fa(c,function(){return gb(a,!0)&&a.Bb(e,d,!1)},function(){O(a.b);gb(a,!1)})}
|
|
|
|
|
function Nf(a,b,c,d){if(b=Ff(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=Ff(a,c,!0);if(!d||d.A<b.A)return;e=d.A-b.A;if(256<e){a.i("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=hb(a,!1)||a.ea?a.J:null;var g=null!=f?"cycles":null,k=Xf(a,b),m=b.A;if(k[0]&&d&&(!c&&d||0>k[0].indexOf("+"))){var n=k[0]+":";k[2]&&(n+=" "+k[2]);a.i(n)}k[3]&&(g=k[3],f=null);f=Tf(a,b,g,f);a.i(f);a.R=b;e-=b.A-m;c++}}}
|
|
|
|
|
function Sf(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.i(">> "+b):(a.$&&(a.i("ended assemble at "+I(a,a.Z.A)),a.R=a.Z,a.$=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.va=null;if(ib(a)&&0<b.length){a.$&&(b="a "+I(a,a.Z.A)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");if(g&&g.length)for(var k=g[0],m=k.charAt(0),n=1;n<k.length;n++){var p=k.charAt(n);if("?"==m||"r"==m||"a">p||"z"<p){g[0]=k.substr(n);g.unshift(k.substr(0,n));break}}g[0]=g[0].toLowerCase();switch(g[0].charAt(0)){case "a":var t=
|
|
|
|
|
Ff(a,g[1],!0);if(t)if(a.Z=t,void 0===g[2])a.i("begin assemble at "+I(a,t.A)),a.$=!0,O(a.b);else{var r;a.i("not supported yet");r=[];if(r.length){for(var w=0;w<r.length;w++)a.Ob(t,r[w],1);a.i(Tf(a,a.Z))}}break;case "b":a:{var B=g[0],x=g[1],C=b;if("?"==x)a.i("breakpoint commands:"),a.i("\tbp [a]\tset exec breakpoint at addr [a]"),a.i("\tbr [a]\tset read breakpoint at addr [a]"),a.i("\tbw [a]\tset write breakpoint at addr [a]"),a.i("\tbc [a]\tclear breakpoint at addr [a]"),a.i("\tbl\tlist all breakpoints"),
|
|
|
|
|
a.i("\tbn [n]\tbreak after [n] instruction(s)");else{var Aa=B.charAt(1);if("l"==Aa){var Mc;Mc=0+Rf(a,a.f);Mc+=Rf(a,a.S);(Mc+=Rf(a,a.G))||a.i("no breakpoints")}else if("n"==Aa)a.ra=uf(a,x),a.i("break after "+a.ra+" instruction(s)");else if(void 0===x)a.i("missing breakpoint address");else{var W=Y();if("*"!=x&&(W=Ff(a,x,!0),!W))break a;"c"==Aa?null==W.A?(yf(a),a.i("all breakpoints cleared")):Pf(a,a.f,W)||Pf(a,a.S,W)||Pf(a,a.G,W)||a.i("breakpoint missing: "+I(a,W.A)):null!=W.A&&(Jf(a,W,C),"p"==Aa?a.jb(a.f,
|
|
|
|
|
W):"r"==Aa?a.jb(a.S,W):"w"==Aa?a.jb(a.G,W):a.i("unknown breakpoint command: "+Aa))}}}break;case "c":a.kb&&(a.kb.value="");break;case "d":a:{var Pa,Qa=g[0],ka=g[1],Ba=g[2],ug=g[3];if("?"==ka){var Ra="";for(Pa in yb)a.Sa[Pa]&&(Ra&&(Ra+=","),Ra+=Pa);Ra+=",state,symbols";a.i("dump memory commands:");a.i("\tdb [a] [#] dump # bytes at address a");a.i("\tdw [a] [#] dump # words at address a");a.i("\tdd [a] [#] dump # dwords at address a");a.i("\tdh [#] [#] dump # instructions from history");
|
|
|
|
|
Ra.length&&a.i("dump extension commands:\n\t"+Ra)}else if("state"==ka){var ve=cg(a.D,!0);"console"==Ba?console.log(ve):(a.kb&&(a.kb.value=""),a.i(ve))}else if("symbols"==ka)for(var Nc=0;Nc<a.H.length;Nc++){var Oc=a.H[Nc],Sa;for(Sa in Oc.La)if("."!=Sa.charAt(0)){var we=Oc.La[Sa].o;if(void 0!==we){var xe=Oc.La[Sa].l;xe&&(Sa=xe);a.i(I(a,we)+" "+Sa)}}}else{if("d"==Qa){for(Pa in yb)if(g[1]==Pa){var ye=a.Sa[Pa];ye?(g.shift(),g.shift(),ye(g)):a.i("no dump registered for "+ka);break a}ka||(Qa=a.Wb||"db")}else a.Wb=
|
|
|
|
|
Qa;if("dh"==Qa){var ze=ka,Ae=Ba,Be="",Ce=0,ea=a.la,la=a.N;if(la.length){var ba=+ze||a.qb,lb=+Ae||10;isNaN(ba)?ba=lb:Be="more ";ba>la.length&&(a.i("note: only "+la.length+" available"),ba=la.length);ea-=ba;0>ea&&(null==la[la.length-1].A?(ba=ea+ba,ea=0):ea+=la.length);var Pc=[];"call"==Ae&&(lb=1E5,Pc=["CALL"]);for(void 0!==ze&&a.i(ba+" instructions earlier:");0<lb&&ea!=a.la;){var De=la[ea++];if(null==De.A)break;var mb=Y(De.A),vg=ba--,Ee=Tf(a,mb,"history",vg);(!Pc.length||0<=Ee.indexOf(Pc[0]))&&a.i(Ee);
|
|
|
|
|
mb.hc&&(ea+=mb.hc,lb-=mb.hc,ba-=mb.hc);ea>=la.length&&(ea=0);a.qb=ba;Ce++;lb--}}Ce||(a.i("no "+Be+"history available"),a.qb=void 0)}else{var Xb=Ff(a,ka);if(Xb){var Yb=0;Ba&&("l"==Ba.charAt(0)&&(Ba=Ba.substr(1)||ug),Yb=uf(a,Ba)>>>0,65536<Yb&&(Yb=65536));for(var nb="",ob="dd"==Qa?4:"dw"==Qa?2:1,Zb=ob*Yb||128,wg=Zb+15>>4||1;wg--&&0<Zb;){var $b=0,Qc=0,pb,Rc="",Fe="",ka=I(a,Xb.A);for(pb=4==ob?16:a.na;0<pb&&0<Zb;pb--){var ac=a.mb(Xb,1),$b=$b|ac<<(Qc++<<3);Qc==ob&&(Rc+=I(a,$b,ob),Rc+=1==ob?9==pb?"-":" ":
|
|
|
|
|
" ",$b=Qc=0);Fe+=32<=ac&&128>ac?String.fromCharCode(ac):".";Zb--}nb&&(nb+="\n");nb+=ka+" "+Rc+(0==pb?" "+Fe:"")}nb&&a.i(nb);a.fb=Xb}}}}break;case "e":if("else"==g[0])break;var Ta,Sc,Tc,Uc,Vc=g[0],Wc=g[1];"eb"==Vc?(Ta=1,Sc=255,Tc=a.mb,Uc=a.Ob):"e"==Vc||"ew"==Vc?(Ta=2,Sc=65535,Tc=a.Ia,Uc=a.qc):Wc=null;if(null==Wc)a.i("edit memory commands:"),a.i("\teb [a] [...] edit bytes at address a"),a.i("\tew [a] [...] edit words at address a");else{var bc=Ff(a,Wc);if(bc)for(var cc=2;cc<g.length;cc++){var qb=
|
|
|
|
|
sf(a,g[cc]);if(void 0===qb){a.i("unrecognized value: "+g[cc]);break}qb&~Sc&&a.i("warning: "+l(qb)+" exceeds "+Ta+"-byte value");var xg=Tc.call(a,bc);a.i("changing "+I(a,bc.A)+" from "+I(a,xg,Ta)+" to "+I(a,qb,Ta));Uc.call(a,bc,qb,Ta)}}break;case "g":a:{var Ge=g[1],yg=b;if(void 0!==Ge){var Xc=Ff(a,Ge,!0);if(!Xc)break a;Jf(a,Xc,yg);a.jb(a.f,Xc,!0)}a.Ab(!0)||c||a.i("cpu busy or unavailable, run command ignored")}break;case "h":a.v.ga?(c||a.i("halting"),a.ia()):hb(a,!0)||c||a.i("already halted");break;
|
|
|
|
|
case "i":if("if"==g[0]){var Yc;var rb=b.substr(2),rb=pa(rb);sf(a,rb)?(c||a.i("true: "+rb),Yc=!0):(c||a.i("false: "+rb),Yc=!1);Yc||(d=!1);break}f=!0;break;case "k":var zg=g[0];if("?"==g[1])a.i("stack trace commands:"),a.i("\tk\tshow frame addresses"),a.i("\tks\tshow symbol information");else{var Zc=0,$c=Y(),sb=Y(a.b.u[6]);for(a.i("stack trace for "+I(a,sb.A));10>Zc;){for(var Ca=null,Ag=256;65536>sb.A>>>0;){$c.A=a.Ia(sb,2);if(null==sb.A||!Ag--)break;if(!($c.A&1)){for(var Bg=a,dc=$c,He=null,tb=dc.A,
|
|
|
|
|
Ie=tb,ad=1;6>=ad&&tb;ad++){if(2<ad){dc.A=tb;var ec=Tf(Bg,dc);if(0<=ec.indexOf("JSR")){var Je=ec.indexOf(" ");if(tb+(ec.indexOf(" ",Je+1)-Je-1)/2==Ie){He=ec;break}}}tb-=2}dc.A=Ie;if(Ca=He)break}}if(!Ca||null==Ca)break;var Ke=null;if("ks"==zg){var Le=Ca.match(/[0-9A-F]+$/);Le&&(Ke=$f(a,Le[0]))}Ca=oa(Ca,50)+" ;"+(Ke||"stack="+I(a,sb.A));a.i(Ca);Zc++}Zc||a.i("no return addresses found")}break;case "l":if("ln"==g[0]){$f(a,g[1],!0);break}f=!0;break;case "m":a:{var ma,na=null,E=g[1];"?"==E&&(E=void 0);
|
|
|
|
|
if(void 0!==E){var va=0;if("all"==E)va=1878917119,E=null;else if("on"==E)na=!0,E=null;else if("off"==E)na=!1,E=null;else{"keys"==E&&(E="key");"kbd"==E&&(E="keyboard");for(ma in yb)if(E==ma){va=yb[ma];na=!!(a.ma&va);break}if(!va){a.i("unknown message category: "+E);break a}}if(va)if("on"==g[2])a.ma|=va,na=!0;else if("off"==g[2]&&(a.ma&=~va,na=!1,1073741824==va)){for(var bd=0;bd<a.ya.length;bd++)a.i(a.ya[bd]);a.ya=[]}}var Cg=0,ub="";for(ma in yb)if(!E||E==ma){var Dg=!!(a.ma&yb[ma]);if(null===na||na==
|
|
|
|
|
Dg)ub&&(ub+=","),++Cg%10||(ub+="\n\t"),"key"==ma&&(ma="keys"),ub+=ma}void 0===E&&a.i("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.i((null!==na?na?"messages on: ":"messages off: ":"message categories:\n\t")+(ub||"none"));zf(a)}break;case "p":if("print"==g[0]){ag(a,b.substr(5));break}var Eg="pr"==g[0]?1:0;if(a.ea)a.i("step in progress");else{var Me=Y(a.b.u[7]);a.mb(Me);a.ea?(a.jb(a.f,Me,!0),a.Ab()||(a.D&&a.D.Qb(),a.ea=0)):bg(a,Eg?"tr":"t")}break;case "r":if("reset"==b){a.D&&
|
|
|
|
|
a.D.reset();break}Mf(a,g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var vb=+g[2];if(8==vb||10==vb||16==vb)a.na=vb;else{a.i("invalid base: "+vb);break}}a.i("default base: "+a.na);break;case "cs":var wb;void 0!==g[3]&&(wb=+g[3]);switch(g[2]){case "int":a.b.ub=wb;break;case "start":a.b.Jb=wb;break;case "stop":a.b.vb=wb;break;default:a.i("unknown cs option");break a}void 0!==wb&&Ec(a.b);a.i("checksums "+(a.b.v.rb?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&(Jc(a.b,+g[2])||a.i("warning: using 1x multiplier, previous target not reached"));
|
|
|
|
|
a.i("target speed: "+(a.b.nb.toFixed(2)+"Mhz")+" ("+a.b.$a+"x)");break;default:if(g[1]){a.i("unknown option: "+g[1]);break}case "?":a.i("debugger options:"),a.i("\tbase #\t\tset default base to #"),a.i("\tcs int #\tset checksum cycle interval to #"),a.i("\tcs start #\tset checksum cycle start count to #"),a.i("\tcs stop #\tset checksum cycle stop count to #"),a.i("\tsp #\t\tset speed multiplier to #")}break;case "t":bg(a,g[0],g[1]);break;case "u":Nf(a,g[1],g[2],8);break;case "v":if("var"==g[0]){Zf(a,
|
|
|
|
|
b.substr(3))||(d=!1);break}if("ver"==g[0]){a.i("PDPjs version 1.30.1 ("+a.b.cd+",RELEASE"+(xb?",TYPEDARRAYS":",LONGARRAYS")+")");a.i(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){ag(a,b.substr(1));break}var cd="commands:",dd;for(dd in Bf)cd+="\n"+oa(dd,9)+Bf[dd];Gd(a)||(cd+="\nnote: history disabled if no exec breakpoints");a.i(cd);break;default:f=!0}f&&(a.i("unknown command: "+b),d=!1)}}catch(Ne){a.i("debugger error: "+(Ne.stack||Ne.message)),d=!1}return d}
|
|
|
|
|
function Fc(a,b,c){b=qf(a,b,c);for(var d in b)if(!Sf(a,b[+d]))return!1;return!0}Ma(function(){for(var a=A(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new xf(d);fb(d,c)}});
|
|
|
|
|
function dg(a,b,c){u.call(this,"Computer",a,dg,67108864);this.v.ja=!1;eg(this,b);this.R=Cc(this,"autoPower",a);this.D=0;this.ea=a.busWidth||a.buswidth;this.f=fg;this.J=null;this.G=this.Z=!1;this.url=Cc(this,"url")||"";(Math.random()+.1).toString(36);this.g=gg(this);if(this.b=eb("CPU",this.id)){this.j=eb("Debugger",this.id);this.F=new Bb({id:this.fc+".bus",busWidth:this.ea},this.b,this.j);var d,e=cb(this.id);if((this.w=eb("Panel",this.id))&&this.w.kb)for(b=0;b<e.length;b++)d=e[b],d.ta=this.w.ta,d.i=
|
|
|
|
|
this.w.i,d.kb=this.w.kb;this.i("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.i("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.Pa&&d.Pa(this,this.F,this.b,this.j);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.H=d:this.f=parseInt(d,10));var f;if(a=Cc(this,"state")||(f=!0,a.state))b=this.S=a,f||(this.G=!0,this.f=fg),this.f&&
|
|
|
|
|
(this.N=new P(this,"1.30.1"),hg(this.N)?b=null:delete this.N);!b&&this.f&&(b=ig(this))&&(this.G=!0);if(b){var g=this;ua(b,null,!0,function(a,b,c){c?(g.H=null,g.G=!1,g.ta("Unable to load machine state from server (error "+c+(b?": "+pa(b):"")+")")):(g.J=b,g.Z=!0);G(g)})}else G(this);this.L.power||(this.R=!0);!c&&this.R&&jg(this,this.Kb)}else q("Unable to find CPU component")}y(dg);var fg=0;
|
|
|
|
|
function eg(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){q(d.message+" ("+c+")")}}a.$=b}function Cc(a,b,c){var d=b.toLowerCase(),d=Wa[b]||Wa[d];void 0===d&&a.$&&(d=a.$[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function jg(a,b,c){for(var d=cb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!ib(f)){ib(f,function(){jg(a,b,c)});return}}b.call(a,c)}
|
|
|
|
|
function kg(a,b){var c=new P(a,"1.30.1","validate");if(hg(c)&&lg(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.ta("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}h=dg.prototype;
|
|
|
|
|
h.Kb=function(a){void 0===a&&(a=this.f||(this.J?1:fg));if(!this.D){this.D++;var b=!1,c=!1;this.X=!1;var d=this.N||new P(this,"1.30.1");if(-1==a)b=!0;else if(a>fg){if(hg(d,this.J)){this.B=new P(this,"1.30.1","failsafe");hg(this.B)&&(mg(this,d),a=2,ng(this.B));this.B.set("timestamp",ta());og(this.B);var e=this.f&&!this.G;if(1==a||wa("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=lg(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?hg(d,g):("error"==
|
|
|
|
|
f&&"no machine state"!=g?(this.ta("Error: "+g),"unable to verify user"==g&&(Da("user",""),this.g=null)):this.i(f+": "+g),ng(d),hg(d)?(c=lg(d),e=!0):c=!1))}e&&kg(this,c?d:null)}else 2==a&&d.clear()}else kg(this);delete this.J;delete this.N}e=cb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=pg(this,g,d,b,c));b=[d,a,c];-1!=a?jg(this,this.xc,b):this.xc(b)}};
|
|
|
|
|
function pg(a,b,c,d,e){if(!b.v.ja){b.v.ja=!0;if(b.Ka){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.Ka(f,d)&&f&&(q("Unable to restore state for "+b.type),a.S&&!a.Z?(c.clear(),a.f=fg,window&&window.location.reload()):a.X=!0,b.Ka(null),e=!1)}if(!d&&b.yc)for(a=b.yc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
|
|
|
|
h.xc=function(a){var b=a[0],c=0>a[1];a=a[2];this.ha=!0;this.v.ja=!0;var d=this.L.power;d&&(d.textContent="Shutdown");this.b&&(pg(this,this.b,b,c,a),this.b.Eb());this.X&&(mg(this,b),b.clear());!c&&this.B&&(this.B.clear(),delete this.B);this.D=0};
|
|
|
|
|
function mg(a,b){if(wa("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.g||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.1"};d.url=a.url;d.user=c;d.type="bug";d.data=b;ua("http://www.pcjs.org/api/v1/report",d,!0)}}
|
|
|
|
|
function cg(a,b,c){var d,e="none";if(a.D)return null;a.D--;var f=new P(a,"1.30.1"),g=new P(a,"1.30.1","validate"),k=ta();g.set("timestamp",k);f.set("timestamp",k);f.set("version","1.30.1");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.Ja&&(c&&a.b.ia(),d=a.b.Ja(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.v.ja=!1,!1===d&&(e=null)));for(var k=cb(a.id),m=0;m<k.length;m++){var n=k[m];n.v.ja&&(n.Ja&&(d=n.Ja(b,c),"object"===typeof d&&f.set(n.id,
|
|
|
|
|
d)),c&&(n.v.ja=!1,!1===d&&(e=null)))}e&&(c?(k=d=!1,b?(a.g&&qg(a,a.g,f.toString()),og(g)&&og(f)||(e=null,d=k=!0)):a.f&&(d=!0,k=3==a.f),d&&f.clear(k)):e=f.toString());c&&(a.v.ja=!1,b=a.L.power)&&(b.textContent="Power");a.D=0;return e}h.reset=function(){this.F&&this.F.reset&&(D(this,"Resetting "+this.F.type),this.F.reset());for(var a=cb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.F&&c.reset&&(D(this,"Resetting "+c.type),c.reset())}};
|
|
|
|
|
h.start=function(a,b){for(var c=cb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};h.stop=function(a,b){for(var c=cb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
|
|
|
|
|
h.pa=function(a,b,c){var d=this;switch(b){case "power":return this.L[b]=c,c.onclick=function(){d.D||(d.v.ja?cg(d,!1,!0):jg(d,d.Kb))},!0;case "reset":return this.L[b]=c,c.onclick=function(){if(d.v.ja&&!d.D)if(d.f&&!d.H){var a=wa("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");cg(d,a,!0);!a&&d.S?window&&window.location.reload():d.Kb(fg)}else d.reset(),d.b&&d.b.Eb()},!0;case "save":if(ga())c.parentNode.removeChild(c);else return this.L[b]=
|
|
|
|
|
c,c.onclick=function(){var a=gg(d,!0);if(a){var b=!!(d.f&&!d.H||d.S),c=cg(d,b);b?qg(d,a,c):d.ta("Resume disabled, machine state not saved")}},!0}return!1};
|
|
|
|
|
function gg(a,b){var c=a.g;c||((c=za("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=rg(a,c))||a.ta("The user ID is invalid.")):b&&a.ta("Browser local storage is not available"));return c}
|
|
|
|
|
function rg(a,b){a.g=null;b=ua(ha()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Da("user",b.data),a.g=b.data)}catch(d){q(d.message+" ("+c+")")}return a.g}function ig(a){var b=null;a.g&&(b=ha()+"/api/v1/user?req=load&user="+a.g+"&state="+sg(a,"1.30.1"));return b}
|
|
|
|
|
function qg(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=sg(a,"1.30.1");d.data=c;b=ua(ha()+"/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.ta("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.ta(c),Da("user",""),a.g=null)}}h.Qb=function(){};
|
|
|
|
|
h.Ga=function(a){this.b&&this.b.Ga(a);this.w&&this.w.Ga(a)};Ma(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 dg(g,d,!0);fb(g,f);g.R&&jg(g,g.Kb)}});Ha.show.push(function(){for(var a=A(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=eb("Computer",c.id))&&c.ha&&!c.v.ja&&c.Kb(-1)}});
|
|
|
|
|
Ha.exit.push(function(){for(var a=A(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=eb("Computer",c.id))&&c.v.ja&&cg(c,!(!c.f||c.H),!0)}});function P(a,b,c){this.id=a.id;this.key=sg(a,b,c);this.j=a.j;ng(this,a.$c)}function sg(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}
|
|
|
|
|
P.prototype={constructor:P,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){ng(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 ng(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function og(a){var b=!0;if(ya()){var c=JSON.stringify(a[a.id]);Da(a.key,c)||(q("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function lg(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){q(c.message||c),b=!1}return b}function hg(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:ya()&&(b=za(a.key))?(a[a.id]=b,a.b=!0):!1}var tg=0;
|
|
|
|
|
function Fg(a,b,c,d,e,f){e("Loading "+a+"...");ua(a,null,!0,function(g,k,m){m?(k||(k="unable to load "+a+" ("+m+")"),f(k,null)):Gg(k,a,b,c,d,e,f)})}
|
|
|
|
|
function Gg(a,b,c,d,e,f,g){function k(a,f){if(f)g(f,null);else{c&&(bb(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(p){f=null,a=p.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?Hg(a,f,k):k(a,null):g("no data"+(b?" for file: "+b:""),null)}
|
|
|
|
|
function Hg(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");ua(e,null,!0,function(f,g,k){if(k||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+k+")");else{if(f=d[3])if(k=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var m=k[0],n,p=/( [a-z]+=)(['"])(.*?)\2/g;n=p.exec(f);)m=0>m.indexOf(n[1])?m.replace(">",n[0]+">"):m.replace(new RegExp(n[1]+"(['\"])(.*?)\\1"),n[0]);k[0]!=m&&(g=g.replace(k[0],m))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
|
|
|
|
|
"");a=a.replace(d[0],g);Hg(a,b,c)}})}else c(a,null)}
|
|
|
|
|
function Ig(a,b,c,d){function e(a){if(void 0===k){var b=g&&A(g,"machine-warning");k=b&&b[0]||g}k&&(k.innerHTML=ja(a))}function f(a){e("Error: "+a);m&&(--tg||Oa(!0));m=!1}var g,k,m=!0;tg++;ab[a]={};try{if(g=document.getElementById(a)){var n;if("object"==typeof resources&&(n=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css";t.styleSheet?t.styleSheet.cssText=n:t.appendChild(document.createTextNode(n));p.appendChild(t)}c||
|
|
|
|
|
(c="/versions/pdp11/1.30.1/components.xsl");n=function(d,k){k?Fg(c,null,null,!1,e,function(d,m){m?(bb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(m=k.transformNode(m))?(g.outerHTML=m,--tg||Oa(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(m),(m=d.transformToFragment(k,document))?g.parentNode?(g.parentNode.replaceChild(m,g),--tg||Oa(!0)):f("invalid machine element: "+
|
|
|
|
|
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Fg(b,a,d,!0,e,n):Gg(b,null,a,d,!1,e,n)}else f("missing machine element: "+a)}catch(r){f(r.message)}return m}window.embedPDP11=function(a,b,c,d){Oa(!1);return Ig(a,b,c,d)};window.enableEvents=Oa;window.sendEvent=Ua;})();
|
|
|
|
|
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=qf.prototype;
|
|
|
|
|
h.Ga=function(a,b,c,d){this.B=b;this.b=c;this.F=a;(a=wc(a,"messages"))&&tf(this,a);this.ab=wf;xf(this,function(a){a:{var b=d.B.X,c=a[0],e=a=0,n=b.length;if(c){a=Y(yf(d,c));if(-1===a){d.i("invalid address: "+c);break a}e=a>>>d.B.Z;n=1}d.i("blockid physical blockaddr used size type");d.i("-------- --------- ---------- ------ ------ ----");for(var c=-1,p=0;n--;){var q=b[e];q.type==c?p++||d.i("..."):(c=q.type,p=Kb[c],q&&d.i(k(q.id,8)+" %"+k(e<<d.B.Z,8)+" %%"+k(q.w,8)+" "+k(q.qb,4,
|
|
|
|
|
!0)+" "+k(q.size,4,!0)+" "+p),c!=ic&&(c=-1),p=0);a+=d.B.ya;e++}}});G(this)};
|
|
|
|
|
h.ja=function(a,b,c){var d=this;switch(b){case "debugInput":return this.ka=this.J[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",zc(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.C<d.A.length-1&&(b=d.A[++d.C])):40==a.keyCode&&(0<d.C?b=d.A[--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,Fa(c,function(){if(d.ka){var a=d.ka.value;
|
|
|
|
|
d.ka.value="";zc(d,a,!0);return!0}return!1}),!0;case "step":return this.J[b]=c,Fa(c,function(a){var b=!1;gb(d,!0)||(fb(d,!0),b=d.fb(a?1:0),fb(d,!1));return b}),!0}return!1};h.pb=function(){this.ka&&this.ka.focus()};function Y(a){a=a&&a.w;null==a&&(a=-1);return a}h.Ua=function(a,b){var c=255,d=Y(a);-1!==d&&(this.g++,c=this.B,c=c.X[(d&c.g)>>>c.Z].Cb(d&c.f,d),this.g--,b&&zf(a,b));return c};h.ma=function(a,b){var c=65535,d=Y(a);-1!==d&&(this.g++,c=Lb(this.B,d),this.g--,b&&zf(a,b));return c};
|
|
|
|
|
h.ob=function(a,b,c){var d=Y(a);if(-1!==d){this.g++;var e=this.B;e.X[(d&e.g)>>>e.Z].wb(d&e.f,b&255,d);this.g--;c&&zf(a,c);M(this.b,!0)}};h.Xa=function(a,b,c){var d=Y(a);if(-1!==d){this.g++;var e=this.B;e.X[(d&e.g)>>>e.Z].Jb(d&e.f,b&65535,d);this.g--;c&&zf(a,c);M(this.b,!0)}};function X(a){return{w:a,Aa:!1}}function Af(a){return[a.w,a.Aa]}function Bf(a){return{w:a[0],Aa:a[1]}}
|
|
|
|
|
function yf(a,b,c){var d;c=(c?a.M:a.Qa).w;if(void 0!==b){d=b=mf(a,b);var e;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),c=0;c<a.H.length;c++){var f=a.H[c].Da[d];if(void 0!==f){d=f.o;void 0!==d&&(e=X(d));break}}if(d=e)return d;c=lf(a,b,void 0)}null!=c&&(d=X(c));return d}function Cf(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.pc=jf(a,b.hc=c[2]))}function zf(a,b){null!=a.w&&(a.w+=b||1)}
|
|
|
|
|
function tf(a,b){a.j=a;a.ha=a.qc=536870912;a.oa=null;a.qa=[];a.g=0;b=jf(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in xb){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.ha|=xb[c],a.i(c+" messages enabled"))}}function xf(a,b){for(var c in xb)if(64==xb[c]){a.Ia[c]=b;break}}
|
|
|
|
|
h.Pb=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 Df(a){return 6>a?"R"+a:6==a?"SP":"PC"}h.Qb=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Ha[a-8]:20>a?b=this.b.ta[a-16]:20==a&&(b=Ub(this.b)));return b};
|
|
|
|
|
h.message=function(a,b){this.g||(b&&(a+=" @"+I(this,X(this.b.u[7]).w)),this.ha&1073741824?this.qa.push(a):this.oa&&a==this.oa||(this.oa=a,this.ha&-2147483648&&(this.ea(),a+=" (cpu halted)"),this.i(a),this.b&&(a=this.b,a.N-=a.b,a.b=0,a.ka=0,M(a))))};
|
|
|
|
|
function sf(a){var b;if(Ad(a)){if(!a.L||!a.L.length){a.L=Array(1E3);for(b=0;b<a.L.length;b++)a.L[b]=X();a.ga=0;a.i("instruction history buffer allocated")}if(!a.da||!a.da.length)for(a.da=Array(256),b=0;b<a.da.length;b++)a.da[b]=[b,0]}else a.L&&a.L.length&&a.i("instruction history buffer freed"),a.ga=0,a.L=[],a.da=[]}h.eb=function(a){if(!Ef(this))return!1;this.b.eb(a);return!0};
|
|
|
|
|
h.fb=function(a,b,c){if(!Ef(this))return!1;this.I=0;a||Ad(this)&&Bd(this,this.b.u[7],0);try{a=Gc(this.b,a);var d=this.b.fb(a);0<d&&(Hc(this.b,a),this.I+=d,Ec(this.b,d,!0),Ac(this.b,d),this.T++)}catch(e){"number"!=typeof e&&(this.I=0,vb(this.b,e.stack||e.message))}!1!==c&&M(this.b);this.za(b||!1);return 0<this.I};h.ea=function(a){this.b&&this.b.ea(a)};h.za=function(a){void 0===a&&(a=!0);this.M=X(this.b.u[7]);a&&1!=this.aa?Ff(this):Gf(this)};
|
|
|
|
|
function Ef(a){var b;if(b=a.b&&hb(a.b))b=a.b,b.v.fa?b=!0:(b.i(b.toString()+" not powered"),b=!1);return b&&!a.b.v.ba?!ib(a.b):!1}h.Ca=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};h.Ba=function(a,b){b&&this.i(a?"suspending":"shutting down");return a?this.save():!0};h.reset=function(a){sf(this);this.T=this.wa=0;this.oa=null;this.I=0;this.M=X(this.b.u[7]);this.v.ba=!1;Hf(this);a||this.za()};
|
|
|
|
|
h.save=function(){var a=new N(this);a.set(0,Af(this.M));a.set(1,Af(this.V));a.set(2,[this.A,this.W,this.ha]);a.set(3,this.H);return a.data()};h.restore=function(a){var b=0;void 0!==a[2]&&(this.M=Bf(a[b++]),this.V=Bf(a[b++]),this.A=a[b][0],"string"==typeof this.A&&(this.A=[this.A]),this.W=a[b][1],this.ha|=a[b][2]);a[3]&&(this.H=a[3]);return!0};h.start=function(a,b){this.aa||this.i("running");this.v.ba=!0;this.jb=a;this.kb=b};
|
|
|
|
|
h.stop=function(a,b){if(this.v.ba){this.v.ba=!1;this.I=b-this.kb;if(!this.aa){b="stopped";if(this.I){a-=this.jb;var c=0<a?Math.round(1E3*this.I/a):0;b+=" (";Ad(this)&&(b+=this.T+" opcodes, ",this.wa-=this.T,this.T=0);b+=this.I+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.i(b)}this.za(!0);this.pb();Hf(this,this.b.u[7])}};function Ad(a){return 1<a.f.length||!!a.la}
|
|
|
|
|
function Bd(a,b,c){var d=a.b;if(0<c&&(a.la&&!--a.la||rc(a,b,1,a.f)))return!0;0<=c&&a.da.length&&(a.T++,a.g++,b=Lb(a.B,b),a.g--,null!=b&&(b=a.L[a.ga],b.w=d.u[7],b.Aa=!1,++a.ga==a.L.length&&(a.ga=0)));return!1}function rf(a){var b,c;a.f=["bp"];if(a.N)for(b=1;b<a.N.length;b++){c=a.N[b];var d=a.B;sc(d.X[Y(c)>>>d.Z],!1)}a.N=["br"];if(a.G)for(b=1;b<a.G.length;b++)c=a.G[b],d=a.B,sc(d.X[Y(c)>>>d.Z],!0);a.G=["bw"];a.Ra=0}
|
|
|
|
|
h.Sa=function(a,b,c){var d=!0;c||If(this,a,b,!1,!0);if(a!=this.f){var e=Y(b);if(-1===e)this.i("invalid address: "+I(this,b.w)),d=!1;else{var f=this.B;f.X[e>>>f.Z].Sa(e&f.f,a==this.G)}}d&&(a.push(b),c?b.Aa=!0:(Jf(this,a,a.length-1,"set"),sf(this)));return d};function If(a,b,c,d,e){var f=!1;c=Y(c);for(var g=1;g<b.length;g++){var l=b[g];if(c==Y(l)&&(!d||l.Aa)){f=!0;l.Aa||e||Jf(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.B,sc(d.X[c>>>d.Z],b==a.G));l.Aa||sf(a);break}}return f}
|
|
|
|
|
function Kf(a,b){for(var c=1;c<b.length;c++)Jf(a,b,c);return b.length-1}function Jf(a,b,c,d){c=b[c];a.i(b[0]+" "+I(a,c.w)+(d?" "+d:c.hc?' "'+c.hc+'"':""))}function Hf(a,b){if(void 0!==b)rc(a,b,1,a.f,!0),a.aa=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Aa){if(!If(a,a.f,c,!0))break;b=0}}}
|
|
|
|
|
function rc(a,b,c,d,e){var f=!1;if(!a.Ra++)for(var g=1;!f&&g<d.length;g++){var l=d[g];if(!e||l.Aa)for(var n=Y(l),p=0;p<c;p++)if(b+p==n){var q,f=!0;l.Aa&&(If(a,d,l,!0),e=!0);if(q=l.pc){for(var f=!1,v=0;v<q.length;v++)if(!Lf(a,q[v],!0)){if(q[v].indexOf("if")){f=!0;break}for(var u=v+1;u<q.length&&q[u].indexOf("else");u++)v++;if(u==q.length){f=!0;break}}a.b.v.ba||(f=!0)}if(f){e||Jf(a,d,g,"hit");break}}}a.Ra--;return f}
|
|
|
|
|
function Mf(a,b,c,d){var e=X(b.w),f=a.ma(b,2),g,l;for(l in a.ab)if(g=a.ab[l][f&l])break;g||(g=[0]);for(var n=l="",p=vf[g[0]],q=g.length-1,v=1;v<=q;v++){var u=g[v];if(void 0!==u){var w;w=a;var B=u,u=b,x="",C=B&61440;if(4096==C)u=u.w+((f&255)<<24>>23)&65535,x=I(w,u);else if(8192==C)u=u.w-((f&63)<<1)&65535,x=I(w,u);else if(12288==C)x=I(w,f&7,1);else if(24576==C)x=I(w,f&63,1);else if(C=f&B,B&4032&&(C>>=6,B>>=6),B&63)switch(B=C&7,C&56){case 0:x=Df(B);break;case 8:x="@"+Df(B);break;case 16:7>B?x="("+Df(B)+
|
|
|
|
|
")+":(C=w.ma(u,2),x="#"+I(w,C,0,!0));break;case 24:7>B?x="@("+Df(B)+")+":(C=w.ma(u,2),x="@#"+I(w,C,0,!0));break;case 32:x="-("+Df(B)+")";break;case 40:x="@-("+Df(B)+")";break;case 48:C=w.ma(u,2);x=I(w,C,0,!0)+"("+Df(B)+")";7==B&&(x=[x,I(w,C+u.w&65535)]);break;case 56:C=w.ma(u,2),x="@"+I(w,C)+"("+Df(B)+")",7==B&&(x=[x,I(w,C+u.w&65535)])}w=x;if(!w||!w.length){l="INVALID";break}"string"!=typeof w&&(n=w[1],w=w[0]);0<l.length&&(l+=",");l+=w||"???"}}f="";g=I(a,e.w)+":";if(-1!==e.w&&-1!==b.w){do if(f+=" "+
|
|
|
|
|
I(a,a.ma(e,2)),null==e.w)break;while(e.w!=b.w)}g+=na(f,24);g+=na(p,5);l&&(g+=" "+l);if(c||n)g=na(g,60)+";"+(c||""),g=a.b.v.$a?g+("cycles="+Bc(a.b).toString()+" cs="+k(a.b.lb)):g+(null!=d?"="+d.toString():""),n&&(g+=" @"+n);return g}function Nf(a,b){switch(b){case "N":a=a.b.Fa();break;case "Z":a=fd(a.b);break;case "V":a=ed(a.b);break;case "C":a=dd(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
|
|
|
|
|
function Of(a,b){var c="",d=a.b;8>b?(c=Df(b),c+="="+I(a,d.u[b])):13>b?c="A"+(b-8)+"="+I(a,d.Ha[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+I(a,d.ta[b-16]):20==b&&(c="PS="+I(a,Ub(d)));c&&(c+=" ");return c}function Pf(a){var b,c="";for(b=0;6>b;b++)c+=Of(a,b);c=c+"\n"+(Of(a,6)+Of(a,7)+Of(a,20));return c+=Nf(a,"T")+Nf(a,"N")+Nf(a,"Z")+Nf(a,"V")+Nf(a,"C")}h.Lb=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
|
|
|
|
|
function Qf(a,b,c){var d=[],e=Y(b)>>>0;for(b=0;b<a.H.length;b++){var f=a.H[b],g=f.w>>>0,l=f.vc;if(e>=g&&e<g+l){e=qa(f.Kb,[e-g],a.Lb);0<=e?Rf(a,b,e,d):c&&(e=~e,Rf(a,b,e-1,d),Rf(a,b,e,d));break}}return d}function Rf(a,b,c,d){var e={},f=a.H[b].Kb,g=0,l=null;0<=c&&c<f.length&&(g=f[c][0],l=f[c][1]);l&&(e=a.H[b].Da[l],l="."==l.charAt(0)?null:e.l||l);d.push(l);d.push(g);d.push(e.a);d.push(e.c)}
|
|
|
|
|
function Sf(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return pf(a)||a.i("no variables"),!0;if(!c[2])return pf(a,c[1]);if(!c[3])return delete a.ca[c[1]],!0;b=lf(a,c[3]);return void 0!==b?(a.ca[c[1]]=b,!0):!1}a.i("invalid assignment:"+b);return!1}
|
|
|
|
|
function Tf(a,b,c){var d=null;if(b=yf(a,b,!0)){var e=Qf(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]+" ("+I(a,e[1])+")"+g,c&&a.i(f),d=f);4<e.length&&e[4]&&(g="",(f=e[5]-b.w)&&(g=" - "+k(f,4,!0)),f=e[4]+" ("+I(a,e[5])+")"+g,c&&a.i(f),d||(d=f))}else c&&a.i("no symbols")}return d}
|
|
|
|
|
function Ff(a,b){var c;if(b&&"?"==b[1])a.i("register commands:"),a.i("\tr\tdump registers"),a.i("\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.i("missing value for "+b[1]);return}f=lf(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":hd(d,f);a.M=X(d.u[7]);break;case "N":d.U=f?32768:0;break;
|
|
|
|
|
case "Z":d.Y=f?0:1;break;case "V":d.R=f?32768:0;break;case "C":d.P=f?65536:0;break;default:if("R"==b.charAt(0)&&(b=+b.charAt(1),0<=b&&6>b)){d.u[b]=f&65535;break}a.i("unknown register: "+e);return}M(d);a.i("updated registers:")}a.i(Pf(a));c&&(a.M=X(d.u[7]),Gf(a,I(a,a.M.w)))}}function Uf(a,b){b=oa(b);var c=b.match(/^(['"])(.*?)\1$/);c?1<c[2].length?a.i(c[2]):of(a,null,c[2].charCodeAt(0)):lf(a,b,!0)}
|
|
|
|
|
function Vf(a,b,c){var d="t"!=b;c=nf(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Ea(c,function(){return fb(a,!0)&&a.fb(e,d,!1)},function(){M(a.b);fb(a,!1)})}
|
|
|
|
|
function Gf(a,b,c,d){if(b=yf(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c){d=yf(a,c,!0);if(!d||d.w<b.w)return;e=d.w-b.w;if(256<e){a.i("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=gb(a,!1)||a.aa?a.I:null;var g=null!=f?"cycles":null,l=Qf(a,b),n=b.w;if(l[0]&&d&&(!c&&d||0>l[0].indexOf("+"))){var p=l[0]+":";l[2]&&(p+=" "+l[2]);a.i(p)}l[3]&&(g=l[3],f=null);f=Mf(a,b,g,f);a.i(f);a.M=b;e-=b.w-n;c++}}}
|
|
|
|
|
function Lf(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.i(">> "+b):(a.W&&(a.i("ended assemble at "+I(a,a.V.w)),a.M=a.V,a.W=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.oa=null;if(hb(a)&&0<b.length){a.W&&(b="a "+I(a,a.V.w)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");if(g&&g.length)for(var l=g[0],n=l.charAt(0),p=1;p<l.length;p++){var q=l.charAt(p);if("?"==n||"r"==n||"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=
|
|
|
|
|
yf(a,g[1],!0);if(v)if(a.V=v,void 0===g[2])a.i("begin assemble at "+I(a,v.w)),a.W=!0,M(a.b);else{var u;a.i("not supported yet");u=[];if(u.length){for(var w=0;w<u.length;w++)a.ob(v,u[w],1);a.i(Mf(a,a.V))}}break;case "b":a:{var B=g[0],x=g[1],C=b;if("?"==x)a.i("breakpoint commands:"),a.i("\tbp [a]\tset exec breakpoint at addr [a]"),a.i("\tbr [a]\tset read breakpoint at addr [a]"),a.i("\tbw [a]\tset write breakpoint at addr [a]"),a.i("\tbc [a]\tclear breakpoint at addr [a]"),a.i("\tbl\tlist all breakpoints"),
|
|
|
|
|
a.i("\tbn [n]\tbreak after [n] instruction(s)");else{var ya=B.charAt(1);if("l"==ya){var Jc;Jc=0+Kf(a,a.f);Jc+=Kf(a,a.N);(Jc+=Kf(a,a.G))||a.i("no breakpoints")}else if("n"==ya)a.la=nf(a,x),a.i("break after "+a.la+" instruction(s)");else if(void 0===x)a.i("missing breakpoint address");else{var U=X();if("*"!=x&&(U=yf(a,x,!0),!U))break a;"c"==ya?null==U.w?(rf(a),a.i("all breakpoints cleared")):If(a,a.f,U)||If(a,a.N,U)||If(a,a.G,U)||a.i("breakpoint missing: "+I(a,U.w)):null!=U.w&&(Cf(a,U,C),"p"==ya?a.Sa(a.f,
|
|
|
|
|
U):"r"==ya?a.Sa(a.N,U):"w"==ya?a.Sa(a.G,U):a.i("unknown breakpoint command: "+ya))}}}break;case "c":a.Ta&&(a.Ta.value="");break;case "d":a:{var Na,Oa=g[0],ia=g[1],za=g[2],ng=g[3];if("?"==ia){var Pa="";for(Na in xb)a.Ia[Na]&&(Pa&&(Pa+=","),Pa+=Na);Pa+=",state,symbols";a.i("dump memory commands:");a.i("\tdb [a] [#] dump # bytes at address a");a.i("\tdw [a] [#] dump # words at address a");a.i("\tdd [a] [#] dump # dwords at address a");a.i("\tdh [#] [#] dump # instructions from history");
|
|
|
|
|
Pa.length&&a.i("dump extension commands:\n\t"+Pa)}else if("state"==ia){var te=Wf(a.F,!0);"console"==za?console.log(te):(a.Ta&&(a.Ta.value=""),a.i(te))}else if("symbols"==ia)for(var Kc=0;Kc<a.H.length;Kc++){var Lc=a.H[Kc],Qa;for(Qa in Lc.Da)if("."!=Qa.charAt(0)){var ue=Lc.Da[Qa].o;if(void 0!==ue){var ve=Lc.Da[Qa].l;ve&&(Qa=ve);a.i(I(a,ue)+" "+Qa)}}}else{if("d"==Oa){for(Na in xb)if(g[1]==Na){var we=a.Ia[Na];we?(g.shift(),g.shift(),we(g)):a.i("no dump registered for "+ia);break a}ia||(Oa=a.sb||"db")}else a.sb=
|
|
|
|
|
Oa;if("dh"==Oa){var xe=ia,ye=za,ze="",Ae=0,ca=a.ga,ja=a.L;if(ja.length){var Z=+xe||a.Za,jb=+ye||10;isNaN(Z)?Z=jb:ze="more ";Z>ja.length&&(a.i("note: only "+ja.length+" available"),Z=ja.length);ca-=Z;0>ca&&(null==ja[ja.length-1].w?(Z=ca+Z,ca=0):ca+=ja.length);var Mc=[];"call"==ye&&(jb=1E5,Mc=["CALL"]);for(void 0!==xe&&a.i(Z+" instructions earlier:");0<jb&&ca!=a.ga;){var Be=ja[ca++];if(null==Be.w)break;var kb=X(Be.w),og=Z--,Ce=Mf(a,kb,"history",og);(!Mc.length||0<=Ce.indexOf(Mc[0]))&&a.i(Ce);kb.yb&&
|
|
|
|
|
(ca+=kb.yb,jb-=kb.yb,Z-=kb.yb);ca>=ja.length&&(ca=0);a.Za=Z;Ae++;jb--}}Ae||(a.i("no "+ze+"history available"),a.Za=void 0)}else{var Xb=yf(a,ia);if(Xb){var Yb=0;za&&("l"==za.charAt(0)&&(za=za.substr(1)||ng),Yb=nf(a,za)>>>0,65536<Yb&&(Yb=65536));for(var lb="",mb="dd"==Oa?4:"dw"==Oa?2:1,Zb=mb*Yb||128,pg=Zb+15>>4||1;pg--&&0<Zb;){var $b=0,Nc=0,nb,Oc="",De="",ia=I(a,Xb.w);for(nb=4==mb?16:a.ia;0<nb&&0<Zb;nb--){var ac=a.Ua(Xb,1),$b=$b|ac<<(Nc++<<3);Nc==mb&&(Oc+=I(a,$b,mb),Oc+=1==mb?9==nb?"-":" ":" ",$b=
|
|
|
|
|
Nc=0);De+=32<=ac&&128>ac?String.fromCharCode(ac):".";Zb--}lb&&(lb+="\n");lb+=ia+" "+Oc+(0==nb?" "+De:"")}lb&&a.i(lb);a.Qa=Xb}}}}break;case "e":if("else"==g[0])break;var Ra,Pc,Qc,Rc,Sc=g[0],Tc=g[1];"eb"==Sc?(Ra=1,Pc=255,Qc=a.Ua,Rc=a.ob):"e"==Sc||"ew"==Sc?(Ra=2,Pc=65535,Qc=a.ma,Rc=a.Xa):Tc=null;if(null==Tc)a.i("edit memory commands:"),a.i("\teb [a] [...] edit bytes at address a"),a.i("\tew [a] [...] edit words at address a");else{var bc=yf(a,Tc);if(bc)for(var cc=2;cc<g.length;cc++){var ob=lf(a,g[cc]);
|
|
|
|
|
if(void 0===ob){a.i("unrecognized value: "+g[cc]);break}ob&~Pc&&a.i("warning: "+k(ob)+" exceeds "+Ra+"-byte value");var qg=Qc.call(a,bc);a.i("changing "+I(a,bc.w)+" from "+I(a,qg,Ra)+" to "+I(a,ob,Ra));Rc.call(a,bc,ob,Ra)}}break;case "g":a:{var Ee=g[1],rg=b;if(void 0!==Ee){var Uc=yf(a,Ee,!0);if(!Uc)break a;Cf(a,Uc,rg);a.Sa(a.f,Uc,!0)}a.eb(!0)||c||a.i("cpu busy or unavailable, run command ignored")}break;case "h":a.v.ba?(c||a.i("halting"),a.ea()):gb(a,!0)||c||a.i("already halted");break;case "i":if("if"==
|
|
|
|
|
g[0]){var Vc;var pb=b.substr(2),pb=oa(pb);lf(a,pb)?(c||a.i("true: "+pb),Vc=!0):(c||a.i("false: "+pb),Vc=!1);Vc||(d=!1);break}f=!0;break;case "k":var sg=g[0];if("?"==g[1])a.i("stack trace commands:"),a.i("\tk\tshow frame addresses"),a.i("\tks\tshow symbol information");else{var Wc=0,Xc=X(),qb=X(a.b.u[6]);for(a.i("stack trace for "+I(a,qb.w));10>Wc;){for(var Aa=null,tg=256;65536>qb.w>>>0;){Xc.w=a.ma(qb,2);if(null==qb.w||!tg--)break;if(!(Xc.w&1)){for(var ug=a,dc=Xc,Fe=null,rb=dc.w,Ge=rb,Yc=1;6>=Yc&&
|
|
|
|
|
rb;Yc++){if(2<Yc){dc.w=rb;var ec=Mf(ug,dc);if(0<=ec.indexOf("JSR")){var He=ec.indexOf(" ");if(rb+(ec.indexOf(" ",He+1)-He-1)/2==Ge){Fe=ec;break}}}rb-=2}dc.w=Ge;if(Aa=Fe)break}}if(!Aa||null==Aa)break;var Ie=null;if("ks"==sg){var Je=Aa.match(/[0-9A-F]+$/);Je&&(Ie=Tf(a,Je[0]))}Aa=na(Aa,50)+" ;"+(Ie||"stack="+I(a,qb.w));a.i(Aa);Wc++}Wc||a.i("no return addresses found")}break;case "l":if("ln"==g[0]){Tf(a,g[1],!0);break}f=!0;break;case "m":a:{var ka,la=null,E=g[1];"?"==E&&(E=void 0);if(void 0!==E){var ta=
|
|
|
|
|
0;if("all"==E)ta=1878917119,E=null;else if("on"==E)la=!0,E=null;else if("off"==E)la=!1,E=null;else{"keys"==E&&(E="key");"kbd"==E&&(E="keyboard");for(ka in xb)if(E==ka){ta=xb[ka];la=!!(a.ha&ta);break}if(!ta){a.i("unknown message category: "+E);break a}}if(ta)if("on"==g[2])a.ha|=ta,la=!0;else if("off"==g[2]&&(a.ha&=~ta,la=!1,1073741824==ta)){for(var Zc=0;Zc<a.qa.length;Zc++)a.i(a.qa[Zc]);a.qa=[]}}var vg=0,sb="";for(ka in xb)if(!E||E==ka){var wg=!!(a.ha&xb[ka]);if(null===la||la==wg)sb&&(sb+=","),++vg%
|
|
|
|
|
10||(sb+="\n\t"),"key"==ka&&(ka="keys"),sb+=ka}void 0===E&&a.i("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.i((null!==la?la?"messages on: ":"messages off: ":"message categories:\n\t")+(sb||"none"));sf(a)}break;case "p":if("print"==g[0]){Uf(a,b.substr(5));break}var xg="pr"==g[0]?1:0;if(a.aa)a.i("step in progress");else{var Ke=X(a.b.u[7]);a.Ua(Ke);a.aa?(a.Sa(a.f,Ke,!0),a.eb()||(a.F&&a.F.pb(),a.aa=0)):Vf(a,xg?"tr":"t")}break;case "r":if("reset"==b){a.F&&a.F.reset();break}Ff(a,
|
|
|
|
|
g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var tb=+g[2];if(8==tb||10==tb||16==tb)a.ia=tb;else{a.i("invalid base: "+tb);break}}a.i("default base: "+a.ia);break;case "cs":var ub;void 0!==g[3]&&(ub=+g[3]);switch(g[2]){case "int":a.b.bb=ub;break;case "start":a.b.mb=ub;break;case "stop":a.b.cb=ub;break;default:a.i("unknown cs option");break a}void 0!==ub&&yc(a.b);a.i("checksums "+(a.b.v.$a?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&(Dc(a.b,+g[2])||a.i("warning: using 1x multiplier, previous target not reached"));
|
|
|
|
|
a.i("target speed: "+(a.b.Va.toFixed(2)+"Mhz")+" ("+a.b.Na+"x)");break;default:if(g[1]){a.i("unknown option: "+g[1]);break}case "?":a.i("debugger options:"),a.i("\tbase #\t\tset default base to #"),a.i("\tcs int #\tset checksum cycle interval to #"),a.i("\tcs start #\tset checksum cycle start count to #"),a.i("\tcs stop #\tset checksum cycle stop count to #"),a.i("\tsp #\t\tset speed multiplier to #")}break;case "t":Vf(a,g[0],g[1]);break;case "u":Gf(a,g[1],g[2],8);break;case "v":if("var"==g[0]){Sf(a,
|
|
|
|
|
b.substr(3))||(d=!1);break}if("ver"==g[0]){a.i("PDPjs version 1.30.1 ("+a.b.Xb+",RELEASE"+(wb?",TYPEDARRAYS":",LONGARRAYS")+")");a.i(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){Uf(a,b.substr(1));break}var $c="commands:",ad;for(ad in uf)$c+="\n"+na(ad,9)+uf[ad];Ad(a)||($c+="\nnote: history disabled if no exec breakpoints");a.i($c);break;default:f=!0}f&&(a.i("unknown command: "+b),d=!1)}}catch(Le){a.i("debugger error: "+(Le.stack||Le.message)),d=!1}return d}
|
|
|
|
|
function zc(a,b,c){b=jf(a,b,c);for(var d in b)if(!Lf(a,b[+d]))return!1;return!0}La(function(){for(var a=A(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=z(c),d=new qf(d);eb(d,c)}});
|
|
|
|
|
function Xf(a,b,c){r.call(this,"Computer",a,Xf,67108864);this.v.fa=!1;Yf(this,b);this.M=wc(this,"autoPower",a);this.F=0;this.aa=a.busWidth||a.buswidth;this.f=Zf;this.I=null;this.G=this.V=!1;this.ca=wc(this,"url")||"";(Math.random()+.1).toString(36);this.g=$f(this);if(this.b=db("CPU",this.id)){this.j=db("Debugger",this.id);this.B=new Ab({id:this.zb+".bus",busWidth:this.aa},this.b,this.j);var d,e=bb(this.id);if((this.A=db("Panel",this.id))&&this.A.Ta)for(b=0;b<e.length;b++)d=e[b],d.na=this.A.na,d.i=
|
|
|
|
|
this.A.i,d.Ta=this.A.Ta;this.i("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.i("Portions adapted from the PDP-11/70 Emulator v1.3 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.Ga&&d.Ga(this,this.B,this.b,this.j);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.H=d:this.f=parseInt(d,10));var f;if(a=wc(this,"state")||(f=!0,a.state))b=this.N=a,f||(this.G=!0,this.f=Zf),this.f&&
|
|
|
|
|
(this.L=new N(this,"1.30.1"),ag(this.L)?b=null:delete this.L);!b&&this.f&&(b=bg(this))&&(this.G=!0);if(b){var g=this;ua(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?": "+oa(b):"")+")")):(g.I=b,g.V=!0);G(g)})}else G(this);this.J.power||(this.M=!0);!c&&this.M&&cg(this,this.nb)}else m("Unable to find CPU component")}y(Xf);var Zf=0;
|
|
|
|
|
function Yf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){m(d.message+" ("+c+")")}}a.W=b}function wc(a,b,c){var d=b.toLowerCase(),d=Va[b]||Va[d];void 0===d&&a.W&&(d=a.W[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function cg(a,b,c){for(var d=bb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!hb(f)){hb(f,function(){cg(a,b,c)});return}}b.call(a,c)}
|
|
|
|
|
function dg(a,b){var c=new N(a,"1.30.1","validate");if(ag(c)&&eg(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=Xf.prototype;
|
|
|
|
|
h.nb=function(a){void 0===a&&(a=this.f||(this.I?1:Zf));if(!this.F){this.F++;var b=!1,c=!1;this.T=!1;var d=this.L||new N(this,"1.30.1");if(-1==a)b=!0;else if(a>Zf){if(ag(d,this.I)){this.C=new N(this,"1.30.1","failsafe");ag(this.C)&&(fg(this,d),a=2,gg(this.C));this.C.set("timestamp",sa());hg(this.C);var e=this.f&&!this.G;if(1==a||va("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=eg(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?ag(d,g):("error"==
|
|
|
|
|
f&&"no machine state"!=g?(this.na("Error: "+g),"unable to verify user"==g&&(Ca("user",""),this.g=null)):this.i(f+": "+g),gg(d),ag(d)?(c=eg(d),e=!0):c=!1))}e&&dg(this,c?d:null)}else 2==a&&d.clear()}else dg(this);delete this.I;delete this.L}e=bb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=ig(this,g,d,b,c));b=[d,a,c];-1!=a?cg(this,this.Nb,b):this.Nb(b)}};
|
|
|
|
|
function ig(a,b,c,d,e){if(!b.v.fa){b.v.fa=!0;if(b.Ca){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.Ca(f,d)&&f&&(m("Unable to restore state for "+b.type),a.N&&!a.V?(c.clear(),a.f=Zf,window&&window.location.reload()):a.T=!0,b.Ca(null),e=!1)}if(!d&&b.Rb)for(a=b.Rb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
|
|
|
|
h.Nb=function(a){var b=a[0],c=0>a[1];a=a[2];this.da=!0;this.v.fa=!0;var d=this.J.power;d&&(d.textContent="Shutdown");this.b&&(ig(this,this.b,b,c,a),this.b.hb());this.T&&(fg(this,b),b.clear());!c&&this.C&&(this.C.clear(),delete this.C);this.F=0};
|
|
|
|
|
function fg(a,b){if(va("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.g||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.1"};d.url=a.ca;d.user=c;d.type="bug";d.data=b;ua("http://www.pcjs.org/api/v1/report",d,!0)}}
|
|
|
|
|
function Wf(a,b,c){var d,e="none";if(a.F)return null;a.F--;var f=new N(a,"1.30.1"),g=new N(a,"1.30.1","validate"),l=sa();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.Ba&&(c&&a.b.ea(),d=a.b.Ba(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.v.fa=!1,!1===d&&(e=null)));for(var l=bb(a.id),n=0;n<l.length;n++){var p=l[n];p.v.fa&&(p.Ba&&(d=p.Ba(b,c),"object"===typeof d&&f.set(p.id,
|
|
|
|
|
d)),c&&(p.v.fa=!1,!1===d&&(e=null)))}e&&(c?(l=d=!1,b?(a.g&&jg(a,a.g,f.toString()),hg(g)&&hg(f)||(e=null,d=l=!0)):a.f&&(d=!0,l=3==a.f),d&&f.clear(l)):e=f.toString());c&&(a.v.fa=!1,b=a.J.power)&&(b.textContent="Power");a.F=0;return e}h.reset=function(){this.B&&this.B.reset&&(D(this,"Resetting "+this.B.type),this.B.reset());for(var a=bb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.B&&c.reset&&(D(this,"Resetting "+c.type),c.reset())}};
|
|
|
|
|
h.start=function(a,b){for(var c=bb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};h.stop=function(a,b){for(var c=bb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
|
|
|
|
|
h.ja=function(a,b,c){var d=this;switch(b){case "power":return this.J[b]=c,c.onclick=function(){d.F||(d.v.fa?Wf(d,!1,!0):cg(d,d.nb))},!0;case "reset":return this.J[b]=c,c.onclick=function(){if(d.v.fa&&!d.F)if(d.f&&!d.H){var a=va("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Wf(d,a,!0);!a&&d.N?window&&window.location.reload():d.nb(Zf)}else d.reset(),d.b&&d.b.hb()},!0;case "save":if(fa())c.parentNode.removeChild(c);else return this.J[b]=
|
|
|
|
|
c,c.onclick=function(){var a=$f(d,!0);if(a){var b=!!(d.f&&!d.H||d.N),c=Wf(d,b);b?jg(d,a,c):d.na("Resume disabled, machine state not saved")}},!0}return!1};
|
|
|
|
|
function $f(a,b){var c=a.g;c||((c=Ba("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=kg(a,c))||a.na("The user ID is invalid.")):b&&a.na("Browser local storage is not available"));return c}
|
|
|
|
|
function kg(a,b){a.g=null;b=ua(ga()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Ca("user",b.data),a.g=b.data)}catch(d){m(d.message+" ("+c+")")}return a.g}function bg(a){var b=null;a.g&&(b=ga()+"/api/v1/user?req=load&user="+a.g+"&state="+lg(a,"1.30.1"));return b}
|
|
|
|
|
function jg(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=lg(a,"1.30.1");d.data=c;b=ua(ga()+"/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),Ca("user",""),a.g=null)}}h.pb=function(){};
|
|
|
|
|
h.za=function(a){this.b&&this.b.za(a);this.A&&this.A.za(a)};La(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 Xf(g,d,!0);eb(g,f);g.M&&cg(g,g.nb)}});Ga.show.push(function(){for(var a=A(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=db("Computer",c.id))&&c.da&&!c.v.fa&&c.nb(-1)}});
|
|
|
|
|
Ga.exit.push(function(){for(var a=A(document,"pdp11","computer"),b=0;b<a.length;b++){var c=z(a[b]);(c=db("Computer",c.id))&&c.v.fa&&Wf(c,!(!c.f||c.H),!0)}});function N(a,b,c){this.id=a.id;this.key=lg(a,b,c);this.j=a.j;gg(this,a.xc)}function lg(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){gg(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 gg(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function hg(a){var b=!0;if(xa()){var c=JSON.stringify(a[a.id]);Ca(a.key,c)||(m("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function eg(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){m(c.message||c),b=!1}return b}function ag(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:xa()&&(b=Ba(a.key))?(a[a.id]=b,a.b=!0):!1}var mg=0;
|
|
|
|
|
function yg(a,b,c,d,e,f){e("Loading "+a+"...");ua(a,null,!0,function(g,l,n){n?(l||(l="unable to load "+a+" ("+n+")"),f(l,null)):zg(l,a,b,c,d,e,f)})}
|
|
|
|
|
function zg(a,b,c,d,e,f,g){function l(a,f){if(f)g(f,null);else{c&&(ab(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?Ag(a,f,l):l(a,null):g("no data"+(b?" for file: "+b:""),null)}
|
|
|
|
|
function Ag(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");ua(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 n=l[0],p,q=/( [a-z]+=)(['"])(.*?)\2/g;p=q.exec(f);)n=0>n.indexOf(p[1])?n.replace(">",p[0]+">"):n.replace(new RegExp(p[1]+"(['\"])(.*?)\\1"),p[0]);l[0]!=n&&(g=g.replace(l[0],n))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
|
|
|
|
|
"");a=a.replace(d[0],g);Ag(a,b,c)}})}else c(a,null)}
|
|
|
|
|
function Bg(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=ma(a))}function f(a){e("Error: "+a);n&&(--mg||Sa(!0));n=!1}var g,l,n=!0;mg++;$a[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/pdp11/1.30.1/components.xsl");p=function(d,l){l?yg(c,null,null,!1,e,function(d,n){n?(ab(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(n=l.transformNode(n))?(g.outerHTML=n,--mg||Sa(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(n),(n=d.transformToFragment(l,document))?g.parentNode?(g.parentNode.replaceChild(n,g),--mg||Sa(!0)):f("invalid machine element: "+
|
|
|
|
|
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?yg(b,a,d,!0,e,p):zg(b,null,a,d,!1,e,p)}else f("missing machine element: "+a)}catch(u){f(u.message)}return n}window.embedPDP11=function(a,b,c,d){Sa(!1);return Bg(a,b,c,d)};window.enableEvents=Sa;window.sendEvent=Ta;})();
|
|
|
|
|
|