273 lines
99 KiB
JavaScript
273 lines
99 KiB
JavaScript
(function(){/*
|
|
http://pcjs.org/modules/shared/lib/diskapi.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/dumpapi.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/reportapi.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/userapi.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/keys.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/strlib.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/usrlib.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/weblib.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/messages.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/debugger.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/debugger.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/embed.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/defines.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/component.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/defines.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/panel.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/bus.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/device.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/memory.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/cpu.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/cpustate.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/cpuops.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/rom.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/ram.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/keyboard.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/serialport.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/pc11.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/disk.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/rk11.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/rl11.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/pdp11/lib/computer.js (C) Jeff Parsons 2012-2016
|
|
http://pcjs.org/modules/shared/lib/state.js (C) Jeff Parsons 2012-2016
|
|
*/
|
|
for(var h,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ba="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this,ca=["Math","log2"],da=0;da<ca.length-1;da++){var ea=ca[da];ea in ba||(ba[ea]={});ba=ba[ea]}var fa=ca[ca.length-1],ga=ba[fa],ha=ga?ga:function(a){return Math.log(a)/Math.LN2};
|
|
ha!=ga&&null!=ha&&aa(ba,fa,{configurable:!0,writable:!0,value:ha});
|
|
var ia={163840:[40,1,8,,254],184320:[40,1,9,,252],327680:[40,2,8,,255],368640:[40,2,9,,253],737280:[80,2,9,,249],1228800:[80,2,15,,249],1474560:[80,2,18,,240],2949120:[80,2,36,,240],21368320:[615,4,17],2494464:[203,2,12,512],5242880:[256,2,40,256],10485760:[512,2,40,256]},n={Ve:0,qc:1,Xe:2,Ye:3,Ze:4,$e:5,af:6,bf:7,Xb:8,cf:9,rc:10,df:11,ef:12,sc:13,ff:14,gf:15,hf:16,jf:17,kf:18,lf:19,mf:20,nf:21,pf:22,qf:23,rf:24,sf:25,tf:26," ":32,"!":33,'"':34,"#":35,$:36,"%":37,"&":38,"'":39,"(":40,")":41,"*":42,
|
|
"+":43,",":44,"-":45,".":46,"/":47,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,":":58,";":59,"<":60,"=":61,">":62,"?":63,"@":64,Vb:65,Ue:66,We:67,uf:68,E:69,vf:70,wf:71,xf:72,yf:73,zf:74,Af:75,Bf:76,Cf:77,Df:78,Ef:79,Ff:80,Q:81,Gf:82,Hf:83,If:84,Jf:85,Kf:86,Lf:87,Mf:88,Nf:89,Ac:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,Of:97,Pf:98,Qf:99,d:100,e:101,Sf:102,Tf:103,Uf:104,Vf:105,Yf:106,k:107,Zf:108,$f:109,n:110,ag:111,p:112,q:113,r:114,bg:115,t:116,cg:117,dg:118,eg:119,x:120,y:121,z:122,"{":123,
|
|
"|":124,"}":125,"~":126,tc:127};
|
|
function q(a){var b=10,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 ja(a,b){var c="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)c="?"+c;else for(;0<b--;)c=String.fromCharCode((a&7)+48)+c,a>>=3;return""+c}function r(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 u(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function ka(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function la(a,b){return-1!==a.indexOf(b,a.length-b.length)}var ma={"&":"&","<":"<",">":">",'"':""","'":"'"};function na(a){return a.replace(/[&<>"']/g,function(a){return ma[a]})}
|
|
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",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"},qa=Date.now||function(){return+new Date};
|
|
function ra(){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 w(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 l="",m;for(m in b)b.hasOwnProperty(m)&&(l&&(l+="&"),l+=m+"="+encodeURIComponent(b[m]));l=l.replace(/%20/g,"+");k.open("POST",a,!!c);k.setRequestHeader("Content-type","application/x-www-form-urlencoded");k.send(l)}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 sa(a,b){var c,d={M:null,da:null,pa:null,oa:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g;if("<"==b.substr(0,1))throw Error(b);g=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.pa=g.load;d.oa=g.exec;if(e=g.bytes)d.M=e;else if(e=g.words)for(d.M=Array(2*e.length),f=c=0;c<e.length;c++)d.M[f++]=e[c]&255,d.M[f++]=e[c]>>8&255;else if(e=g.data)for(d.M=Array(4*e.length),f=c=0;c<e.length;c++)d.M[f++]=e[c]&
|
|
255,d.M[f++]=e[c]>>8&255,d.M[f++]=e[c]>>16&255,d.M[f++]=e[c]>>24&255;else d.M=g;d.da=g.symbols;d.M.length?1==d.M.length&&(x(d.M[0]),d=null):(x("Empty resource: "+a),d=null)}catch(k){x("Resource data error ("+a+"): "+k.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;c<b.length;c++){f=parseInt(b[c],16);if(isNaN(f)){x("Resource data error ("+a+"): invalid hex byte ("+b[c]+")");break}e.push(f&255)}c==b.length&&(d.M=e)}return d}
|
|
function ta(){return"http://"+(window?window.location.host:"www.pcjs.org")}function x(a){window&&window.alert(a)}function ua(a){var b=!1;window&&(b=window.confirm(a));return b}var va=null;function wa(){if(null==va){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}va=a}return va}
|
|
function za(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function Aa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Ba(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 Ca(a,b){var c=null;a="data:application/octet-stream;base64,"+a;b&&(c=document.createElement("a"),"string"!=typeof c.download&&(c=null));c?(c.href=a,c.download=b,document.body.appendChild(c),c.click(),document.body.removeChild(c),b="Check your Downloads folder for "+b+"."):(window.open(a),b="Check your browser for a new window/tab containing the requested data"+(b?" ("+b+")":"")+".");return b}var Da={init:[],show:[],exit:[]},Ea=!1,Fa=!1,Ga=!0;
|
|
function Ha(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ia(a){Da.init.push(a)}function Ja(a){if(Ga)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){x(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Ka(a){!Ga&&a?(Ga=!0,Ea&&La("init"),Fa&&La("show")):Ga=a}function La(a){Da[a]&&Ja(Da[a])}Ha("onload",function(){Ea=!0;Ja(Da.init)});Ha("onpageshow",function(){Fa=!0;Ja(Da.show)});
|
|
Ha(Ba("Opera")||Ba("iOS")?"onunload":"onbeforeunload",function(){Ja(Da.exit)});function z(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.cc=b.comment;this.Oc=b;b=this.id.indexOf(".");0>b?this.Aa=this.id:(this.Ba=this.id.substr(0,b),this.Aa=this.id.substr(b+1));this[a]=c;this.o={ready:!1,Ia:!1,Ib:!1,R:!1,error:!1};this.yb=null;this.o.error=!1;this.j={};this.G=null;this.Mc=d||0;A.push(this)}var Ma=void 0,Na={};
|
|
if(window){Ma||(Ma=window.location.search.substr(1));for(var Oa,Pa=/\+/g,Qa=/([^&=]+)=?([^&]*)/g;Oa=Qa.exec(Ma);)Na[decodeURIComponent(Oa[1].replace(Pa," "))]=decodeURIComponent(Oa[2].replace(Pa," "))}function Ra(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 B(a,b){b||(b=z);a.prototype=Ra(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Sa=window.PCjs.Machines||(window.PCjs.Machines={}),A=window.PCjs.Components||(window.PCjs.Components=[])}else Sa={},A=[];function Ta(a,b,c){Sa[a]&&b&&(Sa[a][b]=c)}function C(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<A.length;b++){var d=A[b];a&&d.id.indexOf(a)||c.push(d)}return c}
|
|
function Ua(a){if(void 0!==a){var b;for(b=0;b<A.length;b++)if(A[b].id===a)return A[b]}return null}function Va(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<A.length;d++)if(c)c==A[d]&&(c=null);else if(!(a!=A[d].type||b&&A[d].id.indexOf(b)))return A[d]}return null}function D(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){x(c.message+" ("+a+")")}return b}
|
|
function E(a,b){b=F(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(" "),l=0;l<k.length;l++)switch(g=k[l],g){case "pdp11-binding":(g=D(f))&&g.binding&&a.ba(g.type,g.binding,f,g.value),l=k.length}}}}
|
|
function F(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}
|
|
z.prototype={constructor:z,parent:null,toString:function(){return this.name?this.name:this.id||this.type},ba: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.kb=this.j[b]=c,c.value="",this.W=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.B=function(a){this.W(a,this.Aa)}),!0;default:return!1}},log:function(){},W:function(){},status:function(a){this.W(this.Aa+": "+a)},B:function(a,b,c){c=c||this.type;b||x((c?c+": ":"")+a)},ka:function(){return this.o.R=!0},ja:function(a,b){b&&(this.o.R=!1);return!0}};function Wa(a,b){a.o.Ib?(a.o.Ia=!1,a.o.Ib=!1):a.o.error?a.W(a.toString()+" error"):a.o.Ia=b}function G(a,b){a.o.error||(a.o.ready=!1!==b,a.o.ready&&(b=a.yb,a.yb=null,b&&b()))}
|
|
function Xa(a,b){b&&(a.o.ready?b():a.yb=b);return a.o.ready}function Ya(a,b){a.o.error=!0;a.B(b)}Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
|
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});var Za="undefined"!==typeof ArrayBuffer,$a={48:"DL11R",52:"DL11X",56:"PC11R",60:"PC11X",64:"KW11",112:"RL11",144:"RK11"};
|
|
function ab(a){z.call(this,"Panel",a,ab,512);this.la=this.i=this.c=this.m=this.s=this.u=0;this.A=this.C=this.v=!1;this.F=bb;this.f={};this.b={START:[1,1,!0,!1,this.Vc],STEP:[1,1,!1,!1,this.Wc],ENABLE:[1,1,!1,!1,this.Rc],CONT:[1,1,!0,!1,this.Pc],DEP:[0,0,!0,!1,this.Qc],EXAM:[1,1,!0,!1,this.Sc],LOAD:[1,1,!0,!1,this.Uc],TEST:[0,0,!0,!1,this.Tc]};for(a=0;22>a;a++)this.b["S"+a]=[0,0,!1,!1,this.Xc,a]}B(ab);var bb=7;function cb(a,b){return a.b[b]&&a.b[b][1]}h=ab.prototype;h.reset=function(){this.stop()};
|
|
h.ba=function(a,b,c,d){if(this.l&&this.l.ba(a,b,c,d)||this.a&&this.a.ba(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.j[b]=c,this.u++,!0;default:return"led"==a||"rled"==a?(this.j[b]=c,this.f[b]=d?1:0,this.u++,!0):"switch"==a?(void 0===this.b[b]&&(this.b[b]=[d?1:0,d?1:0]),this.j[b]=c,a=c.parentElement||c,a=a.parentElement||a,a.onmousedown=function(a,b){return function(){db(a,
|
|
b)}}(this,b),a.onmouseup=a.onmouseout=function(a,b){return function(){eb(a,b)}}(this,b),a.ontouchstart=function(a,b){return function(c){db(a,b);c.preventDefault()}}(this,b),a.ontouchend=function(a,b){return function(){eb(a,b)}}(this,b),!0):this.parent.ba.call(this,a,b,c,d)}};h.ia=function(a,b,c,d){this.l=a;this.h=b;this.a=c;this.G=d;fb(b,this,gb);hb(b,this.reset.bind(this));ib(this);jb(this)};h.ka=function(a,b){b||(kb(),this.reset());return!0};h.ja=function(){return!0};
|
|
function lb(a,b,c){if(a=a.j[b])a.style.backgroundColor=c?"#ff0000":"#000000"}function ib(a,b){for(var c in a.f)lb(a,c,null!=b?b:a.f[c])}function mb(a,b,c){if(a=a.j[b])a.style.marginTop=c?"0px":"20px",a.style.backgroundColor=c?"#00ff00":"#228B22"}function jb(a){for(var b in a.b)mb(a,b,a.b[b][1])}function nb(a,b,c,d){a.j[b]&&(void 0===c&&(Ya(a,"Value for "+b+" is invalid"),H(a.a)),c=8==(a.G&&a.G.b||8)?ja(c,d):r(c,d),a.j[b].textContent!=c&&(a.j[b].textContent=c))}
|
|
function db(a,b){var c=a.b[b];mb(a,b,c[1]=1-c[1]);c[3]=!0;c[4]&&c[4].call(a,c[1],c[5]);"STEP"!=b&&(a.A="DEP"==b,a.C="EXAM"==b)}function eb(a,b){var c=a.b[b];c[2]&&c[3]&&(mb(a,b,c[1]=c[0]),c[4]&&c[4].call(a,c[1],c[5]));c[3]=!1}h.Vc=function(a){a||this.a.o.O||(a=this.a,a.h.reset(),ob(a),cb(this,"ENABLE")&&pb(this.a))};h.Wc=function(){};h.Rc=function(a){a||H(this.a)};
|
|
h.Pc=function(a){if(!a&&!this.a.o.O)if(cb(this,"ENABLE"))pb(this.a);else{a=this.G;var b;if(b=a)a.o.Ia&&(a.o.Ib=!0),b=!a.o.Ia;if(b)Wa(a,!0),a.Ab(0,null),Wa(a,!1);else try{var c=this.a.Ab(1);0<c&&(qb(this.a,c),rb(this.a,c,!0),sb(this.a,c))}catch(d){"number"!=typeof d&&Ya(this.a,d.stack||d.message)}this.stop();this.l&&this.l.za()}};h.Qc=function(a){if(a&&!this.a.o.O)if(this.A&&tb(this),a=ub(this,this.c),this.F==bb)vb(this.h,this.la,a);else{var b=this.a,c=this.la;b.Ra++;b.pc(wb(b,c,4),a);b.Ra--}};
|
|
h.Sc=function(a){if(!a&&!this.a.o.O){this.C&&tb(this);if(this.F==bb)a=xb(this.h,this.la);else{a=this.a;var b=this.la;a.Ra++;b=a.lc(wb(a,b,2));a.Ra--;a=b}ub(this,a)}};h.Uc=function(a){a||this.a.o.O||yb(this,this.c)};h.Tc=function(a){if(a)this.v=!0,ib(this,!0);else if(this.v=!1,ib(this),void 0!==this.j.S0){for(a=this.c=0;22>a;a++)this.b["S"+a][1]=0&1<<a?1:0;jb(this)}};h.Xc=function(a,b){this.c=a?this.c|1<<b:this.c&~(1<<b)};
|
|
function tb(a){var b=1145>a.a.Wa?8:16,c=65472<=a.la&&a.la<65472+b,b=c?1:2,c=c?15:a.h.Ea;cb(a,"STEP")||(b=-b);yb(a,a.la&~c|a.la+b&c)}function yb(a,b){a.la=b&a.h.Ea;b=a.la;for(var c=0;22>c;c++)zb(a,"A"+c,b&1<<c)}function ub(a,b){a.i=b&65535;b=a.i;for(var c=0;16>c;c++)zb(a,"D"+c,b&1<<c);return a.i}function zb(a,b,c){a.f[b]=c;a.v||lb(a,b,c)}h.stop=function(){yb(this,this.a.g[7])};h.setData=function(a,b){b?this.m=a:this.i=a};h.Yc=function(a,b){return(b?this.m:this.c)&65535};h.Zd=function(a){this.m=a};
|
|
var Ab={},gb=(Ab[65400]=[null,null,ab.prototype.Yc,ab.prototype.Zd,"CNSW"],Ab);function kb(){for(var a=!1,b=F(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=D(d),f=Ua(e.id);f||(a=!0,f=new ab(e));E(f,d);a&&G(f)}}Ia(kb);
|
|
function Bb(a,b,c){z.call(this,"Bus",a,Bb,16);this.a=b;this.G=c;this.L=a.busWidth||16;this.v=1<<this.L;this.Ea=this.v-1;this.c=Cb;this.b=Math.log2(this.c);this.J=this.c>>2;this.l=this.c-1;this.u=this.v/this.c|0;this.Da=[];this.m=0;this.s=!1;this.A=[];this.Bc=[Db,Eb,Fb,Gb];a=new I(this);Hb(a,this.G);this.h=Array(this.u);this.f=Array(this.u);for(b=0;b<this.u;b++)this.h[b]=this.f[b]=a;a=this.v-Cb;Ib(this,a,Cb,Jb,this);this.I=this.F=(a&this.Ea)>>>this.b;this.C=0;this.i=this.Ea;G(this)}B(Bb);
|
|
var Cb=8192,Kb=Cb-1;function Db(a,b){var c=-1,d=this.controller,e=d.Da[a],f=b&65535;e?e[0]?c=e[0](f):e[2]&&(c=f&1?e[2](f&-2)>>8:e[2](f)&255):f&1&&(e=d.Da[a&-2])&&(e[2]?c=e[2](f&-2)>>8:e[0]&&(c=e[0](f)));if(0<=c)return c;J(d,b,16);return 255}
|
|
function Eb(a,b,c){var d=!1,e=this.controller,f=e.Da[a],g=c&65535;if(f)if(f[1])f[1](b,g),d=!0;else{if(f[3]){a=f[2]?f[2](g,!0):0;if(g&1)f[3](a&255|b<<8,g&-2);else f[3](a&-256|b,g);d=!0}}else g&1&&(f=e.Da[a&-2])&&(f[3]?(g&=-2,a=f[2]?f[2](g,!0):0,f[3](a&255|b<<8,g),d=!0):f[1]&&(f[1](b,g),d=!0));d||J(e,c,16)}function Fb(a,b){var c=-1,d=this.controller;a=d.Da[a];var e=b&65535;a&&(a[2]?c=a[2](e):a[0]&&(c=a[0](e)|a[0](e+1)<<8));if(0<=c)return c;J(d,b,16);return 65535}
|
|
function Gb(a,b,c){var d=!1,e=this.controller;a=e.Da[a];var f=c&65535;a&&(a[3]?(a[3](b,f),d=!0):a[1]&&(a[1](b&255,f),a[1](b>>8,f+1),d=!0));d||J(e,c,16)}function Lb(a,b){if(b!=a.C){for(var c=0;c<a.u;c++)a.f[c]=a.h[c];a.C=0;a.i=a.Ea;b&&(a.C=b,b=1<<b,a.i=b-1,b-=Cb,a.I=(b&a.i)>>>a.b,a.f[a.I]=a.h[a.F])}}Bb.prototype.reset=function(){for(var a=0;a<this.A.length;a++)this.A[a]();Lb(this,16)};Bb.prototype.ka=function(a,b){b||this.reset();return!0};
|
|
function Ib(a,b,c,d,e){for(var f=b,g=c,k=f>>>a.b;0<g&&k<a.h.length;){var l=a.h[k],m=k*a.c,p=a.c-(f-m);p>g&&(p=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.Ha)return l.nb+=l.Ha-f,l.Ha=f,!0;if(f>=l.Ha+l.nb){p=l.size-(f-m);p>g&&(p=g);l.nb=f-l.Ha+p;f=m+a.c;g-=p;k++;continue}}return Mb(1,f,g)}f=new I(a,f,p,a.c,d,e);Hb(f,a.G,l);a.h[k++]=f;f=m+a.c;g-=p}return 0>=g?(a.status((c>>10)+"Kb "+Nb[d]+" at "+ja(b)),!0):Mb(2,b,c)}function Ob(a,b){return a.f[(b&a.i)>>>a.b].Nb(b&a.l,b)}
|
|
function Pb(a,b){return a.f[(b&a.i)>>>a.b].aa(b&a.l,b)}function Qb(a,b,c){a.f[(b&a.i)>>>a.b].Cb(b&a.l,c,b)}function xb(a,b){a.s=!1;a.m++;b=a.h[(b&a.Ea)>>>a.b].kc(b&a.l,b);a.m--;return b}function Rb(a,b,c){a.s=!1;a.m++;a.h[(b&a.Ea)>>>a.b].Ub(b&a.l,c&255,b);a.m--}function vb(a,b,c){a.s=!1;a.m++;a.h[(b&a.Ea)>>>a.b].oc(b&a.l,c&65535,b);a.m--}
|
|
function Sb(a){for(var b=0,c=[],d=0;d<a.u;d++){var e=a.h[d];if(e.wa||e.Hc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,k=0,l=[];g<e.length;){for(var m=e[g],p=g+1;p<e.length&&e[p]===m;)p++;l[k++]=p-g;l[k++]=m;g=p}l.length<e.length&&(e=l)}c[f]=e}}return c}function Tb(a){for(var b=Ub,c=0,d=0;d<a.h.length;d++){var e=a.h[d];e.type==b&&(c=e.Ha+e.nb)}return c}
|
|
function Vb(a,b,c,d,e,f,g,k,l){for(;b<=c;b+=2){var m=b&Kb;if(void 0!==a.Da[m])return x("I/O address already registered: "+r(b,8,!0)),!1;a.Da[m]=[d,e,f,g,l||"unknown",k||16,!1]}return!0}
|
|
function fb(a,b,c,d){for(var e in c){var f=+e+(d||0),g=c[e];if(!(g[6]&&g[6]>a.a.Wa)){var k=g[0]?g[0].bind(b):null,l=g[1]?g[1].bind(b):null,m=g[2]?g[2].bind(b):null,p=g[3]?g[3].bind(b):null;65472<=f&&65487>=f&&(!k&&m&&(k=function(a){return function(b){return a(b)&255}.bind(b)}(m)),!l&&p&&(l=function(a){return function(b,c){return a(b,c)}.bind(b)}(p)));for(var t=g[4],v=g[5]||1,y=0;y<v;y++,f+=2)if(t&&1<v&&(t=g[4]+y),!Vb(a,f,f,k,l,m,p,g[7]||b.Mc,t||b.Aa))return!1}}return!0}
|
|
function hb(a,b){a.A.push(b)}function J(a,b,c){a.s=!0;a.m||(c&&(a.a.X|=c),K(a.a,4,0,b))}function Wb(a){var b=a.s;a.s=!1;return b}function Mb(a,b,c){x("Memory block error ("+a+": "+r(b)+","+r(c)+")");return!1}function L(a){z.call(this,"Device",a,L,256);this.b={Rf:0,Sb:-1}}B(L);h=L.prototype;
|
|
h.ia=function(a,b,c,d){this.h=b;this.l=a;this.a=c;this.G=d;var e=this;this.b.Sb=Xb(c,function(){e.b.Va|=128;e.b.Va&64&&M(e.a,e.b.Ua);e.l&&e.l.za(1);Yb(e.a,e.b.Sb,1E3/60)});this.b.Ua=$b(c,64,6,524288);fb(b,this,ac);hb(b,this.reset.bind(this));G(this)};h.reset=function(){this.b.Va=128;Yb(this.a,this.b.Sb,1E3/60,!0)};h.ed=function(){return this.b.Va};h.fe=function(a){this.b.Va=a&192;this.b.Va&64||bc(this.a,this.b.Ua)};h.gd=function(){var a=this.a,b=a.Y;b&57344||(b=b&-3199|a.eb<<5|a.fb<<1);return b};
|
|
h.he=function(a){cc(this.a,a&-129|this.a.Y&128)};h.hd=function(){var a=this.a;a.Y&57344||(a.ub=a.A>>16&65535);a=a.ub;a&65280&&(a=(a<<8|a>>8)&65535);return a};h.jd=function(){var a=this.a;a.Y&57344||(a.vb=a.A&65535);return a.vb};h.kd=function(){return this.a.ya};h.ie=function(a){var b=this.a;1170>b.Wa&&(a&=-49);b.ya!=a&&(b.ya=a,b.Pa=a&16?4194303:262143,dc(b))};h.Sd=function(a){a=a>>1&63;var b=this.a.ab[a>>1];return a&1?b>>16:b&65535};
|
|
h.Qe=function(a,b){b=b>>1&63;var c=b>>1;this.a.ab[c]=b&1?this.a.ab[c]&65535|(a&63)<<16:this.a.ab[c]&-65536|a&65534};h.Ld=function(a){return this.a.H[1][a>>1&7]};h.Je=function(a,b){this.a.H[1][b>>1&7]=a&65295};h.Jd=function(a){return this.a.H[1][(a>>1&7)+8]};h.He=function(a,b){this.a.H[1][(b>>1&7)+8]=a&65295};h.Kd=function(a){return this.a.Z[1][a>>1&7]};h.Ie=function(a,b){b=b>>1&7;this.a.Z[1][b]=a;this.a.H[1][b]&=65295};h.Id=function(a){return this.a.Z[1][(a>>1&7)+8]};
|
|
h.Ge=function(a,b){b=(b>>1&7)+8;this.a.Z[1][b]=a;this.a.H[1][b]&=65295};h.dd=function(a){return this.a.H[0][a>>1&7]};h.ee=function(a,b){this.a.H[0][b>>1&7]=a&65295};h.bd=function(a){return this.a.H[0][(a>>1&7)+8]};h.ce=function(a,b){this.a.H[0][(b>>1&7)+8]=a&65295};h.cd=function(a){return this.a.Z[0][a>>1&7]};h.de=function(a,b){b=b>>1&7;this.a.Z[0][b]=a;this.a.H[0][b]&=65295};h.ad=function(a){return this.a.Z[0][(a>>1&7)+8]};h.be=function(a,b){b=(b>>1&7)+8;this.a.Z[0][b]=a;this.a.H[0][b]&=65295};
|
|
h.Rd=function(a){return this.a.H[3][a>>1&7]};h.Pe=function(a,b){this.a.H[3][b>>1&7]=a&65295};h.Pd=function(a){return this.a.H[3][(a>>1&7)+8]};h.Ne=function(a,b){this.a.H[3][(b>>1&7)+8]=a&65295};h.Qd=function(a){return this.a.Z[3][a>>1&7]};h.Oe=function(a,b){b=b>>1&7;this.a.Z[3][b]=a;this.a.H[3][b]&=65295};h.Od=function(a){return this.a.Z[3][(a>>1&7)+8]};h.Me=function(a,b){b=(b>>1&7)+8;this.a.Z[3][b]=a;this.a.H[3][b]&=65295};h.Ya=function(a){a&=7;return this.a.D&2048?this.a.Fa[a]:this.a.g[a]};
|
|
h.bb=function(a,b){b&=7;this.a.D&2048?this.a.Fa[b]=a:this.a.g[b]=a};h.pd=function(){return this.a.D&49152?this.a.qa[0]:this.a.g[6]};h.ne=function(a){this.a.D&49152?this.a.qa[0]=a:this.a.g[6]=a};h.sd=function(){return this.a.g[7]};h.qe=function(a){this.a.g[7]=a};h.Za=function(a){a&=7;return this.a.D&2048?this.a.g[a]:this.a.Fa[a]};h.cb=function(a,b){b&=7;this.a.D&2048?this.a.g[b]=a:this.a.Fa[b]=a};h.qd=function(){return 1==(this.a.D&49152)>>14?this.a.g[6]:this.a.qa[1]};
|
|
h.oe=function(a){1==(this.a.D&49152)>>14?this.a.g[6]=a:this.a.qa[1]=a};h.rd=function(){return 3==(this.a.D&49152)>>14?this.a.g[6]:this.a.qa[3]};h.pe=function(a){3==(this.a.D&49152)>>14?this.a.g[6]=a:this.a.qa[3]=a};h.$c=function(a){return this.a.Pb[a-65504>>1]};h.ae=function(a,b){this.a.Pb[b-65504>>1]=a};h.jc=function(a){return 65520==a?(Tb(this.h)>>6)-1:0};h.nc=function(){};h.Nd=function(){return 1};h.Le=function(){};h.Zc=function(){return this.a.X};h.$d=function(){this.a.X=0};h.fd=function(){return this.a.Ob};
|
|
h.ge=function(a,b){b&1||(a&=255);this.a.Ob=a};h.ld=function(a,b){return b?0:this.a.mb};h.je=function(a){var b=this.a;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1);b.w|=1}b.mb=a};h.Md=function(a,b){return b?0:this.a.$a&65280};h.Ke=function(a){this.a.$a=a|255};h.od=function(){return ec(this.a)};h.me=function(a){fc(this.a,a&-1793|ec(this.a)&1792)};h.mc=function(){};
|
|
var N={},ac=(N[61568]=[null,null,L.prototype.Sd,L.prototype.Qe,"UNIMAP",64,1170],N[62592]=[null,null,L.prototype.Ld,L.prototype.Je,"SIPDR",8,1145,64],N[62608]=[null,null,L.prototype.Jd,L.prototype.He,"SDPDR",8,1145,64],N[62624]=[null,null,L.prototype.Kd,L.prototype.Ie,"SIPAR",8,1145,64],N[62640]=[null,null,L.prototype.Id,L.prototype.Ge,"SDPAR",8,1145,64],N[62656]=[null,null,L.prototype.dd,L.prototype.ee,"KIPDR",8,1145,64],N[62672]=[null,null,L.prototype.bd,L.prototype.ce,"KDPDR",8,1145,64],N[62688]=
|
|
[null,null,L.prototype.cd,L.prototype.de,"KIPAR",8,1145,64],N[62704]=[null,null,L.prototype.ad,L.prototype.be,"KDPAR",8,1145,64],N[62798]=[null,null,L.prototype.kd,L.prototype.ie,"MMR3",1,1145,64],N[65382]=[null,null,L.prototype.ed,L.prototype.fe,"LKS"],N[65402]=[null,null,L.prototype.gd,L.prototype.he,"MMR0",1,1145,64],N[65404]=[null,null,L.prototype.hd,L.prototype.mc,"MMR1",1,1145,64],N[65406]=[null,null,L.prototype.jd,L.prototype.mc,"MMR2",1,1145,64],N[65408]=[null,null,L.prototype.Rd,L.prototype.Pe,
|
|
"UIPDR",8,1145,64],N[65424]=[null,null,L.prototype.Pd,L.prototype.Ne,"UDPDR",8,1145,64],N[65440]=[null,null,L.prototype.Qd,L.prototype.Oe,"UIPAR",8,1145,64],N[65456]=[null,null,L.prototype.Od,L.prototype.Me,"UDPAR",8,1145,64],N[65472]=[null,null,L.prototype.Ya,L.prototype.bb,"R0SET0"],N[65473]=[null,null,L.prototype.Ya,L.prototype.bb,"R1SET0"],N[65474]=[null,null,L.prototype.Ya,L.prototype.bb,"R2SET0"],N[65475]=[null,null,L.prototype.Ya,L.prototype.bb,"R3SET0"],N[65476]=[null,null,L.prototype.Ya,
|
|
L.prototype.bb,"R4SET0"],N[65477]=[null,null,L.prototype.Ya,L.prototype.bb,"R5SET0"],N[65478]=[null,null,L.prototype.pd,L.prototype.ne,"R6KERNEL"],N[65479]=[null,null,L.prototype.sd,L.prototype.qe,"R7KERNEL"],N[65480]=[null,null,L.prototype.Za,L.prototype.cb,"R0SET1",1,1145],N[65481]=[null,null,L.prototype.Za,L.prototype.cb,"R1SET1",1,1145],N[65482]=[null,null,L.prototype.Za,L.prototype.cb,"R2SET1",1,1145],N[65483]=[null,null,L.prototype.Za,L.prototype.cb,"R3SET1",1,1145],N[65484]=[null,null,L.prototype.Za,
|
|
L.prototype.cb,"R4SET1",1,1145],N[65485]=[null,null,L.prototype.Za,L.prototype.cb,"R5SET1",1,1145],N[65486]=[null,null,L.prototype.qd,L.prototype.oe,"R6SUPER",1,1145],N[65487]=[null,null,L.prototype.rd,L.prototype.pe,"R6USER",1,1145],N[65504]=[null,null,L.prototype.$c,L.prototype.ae,"CTRL",8,1170],N[65520]=[null,null,L.prototype.jc,L.prototype.nc,"LSIZE",1,1170],N[65522]=[null,null,L.prototype.jc,L.prototype.nc,"HSIZE",1,1170],N[65524]=[null,null,L.prototype.Nd,L.prototype.Le,"SYSID",1,1170],N[65526]=
|
|
[null,null,L.prototype.Zc,L.prototype.$d,"CPUERR",1,1170],N[65528]=[null,null,L.prototype.fd,L.prototype.ge,"MB",1,1170],N[65530]=[null,null,L.prototype.ld,L.prototype.je,"PIR"],N[65532]=[null,null,L.prototype.Md,L.prototype.Ke,"SL"],N[65534]=[null,null,L.prototype.od,L.prototype.me,"PSW"],N);
|
|
Ia(function(){for(var a=F(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=D(d);switch(c.type){case "default":c=new L(c);E(c,d);break;case "pc11":c=new gc(c);E(c,d);break;case "rl11":c=new O(c);E(c,d);break;case "rk11":c=new P(c),E(c,d)}}});var hc;if(Za){var ic=new ArrayBuffer(2);(new DataView(ic)).setUint16(0,256,!0);hc=256===(new Uint16Array(ic))[0]}else hc=!1;var jc=hc;
|
|
function I(a,b,c,d,e,f){this.h=a;this.id=kc+=2;this.a=null;this.Ha=b;this.nb=c;this.size=d||0;this.type=e||lc;this.l=e==mc;this.controller=null;Hb(this);this.wa=this.Hc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.a=a[0],nc(this,f.Bc);else if(Za)this.b=new ArrayBuffer(this.size),this.c=new DataView(this.b,0,this.size),this.j=new Uint8Array(this.b,0,this.size),this.s=new Uint16Array(this.b,0,this.size>>1),this.a=new Int32Array(this.b,0,this.size>>2),nc(this,jc?oc:pc);else{a=this.a=Array(this.size>>
|
|
2);for(f=0;f<a.length;f++)a[f]=0;nc(this,rc)}else nc(this)}var lc=0,Ub=1,mc=2,Jb=4,Nb=["NONE","RAM","ROM","VID","H/W"],kc=0;
|
|
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(Za)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.c.getInt32(b<<2,!0);else a=this.a;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(Za)for(b=0;b<a.length;b++)this.c.setInt32(b<<2,a[b],!0);else this.a=a;return this.wa=!0}return!1},u:function(a,b){J(this.h,b,32);return 255},f:function(a,b,c){J(this.h,c,32)},v:function(a,b){return this.Nb(a++,b++)|
|
|
this.Nb(a,b)<<8},A:function(a,b,c){this.Bb(a++,b&255,c++);this.Bb(a,b>>8,c)},L:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},ga:function(a,b){a&1&&J(this.h,b,64);b=a>>2;a=(a&3)<<3;var c=this.a[b]>>a;return 24>a?c&65535:c&255|(this.a[b+1]&255)<<8},ma:function(a,b){var c=a>>2;a=(a&3)<<3;this.a[c]=this.a[c]&~(255<<a)|b<<a;this.wa=!0},Ca:function(a,b,c){a&1&&J(this.h,c,64);c=a>>2;a=(a&3)<<3;24>a?this.a[c]=this.a[c]&~(65535<<a)|b<<a:(this.a[c]=this.a[c]&16777215|b<<24,c++,this.a[c]=this.a[c]&-256|
|
|
b>>8);this.wa=!0},F:function(a,b){return this.I(a,b)},U:function(a,b){return this.kc(a,b)},Ba:function(a,b,c){this.l?this.f(a,b,c):this.Ub(a,b,c)},ua:function(a,b,c){this.l?this.f(a,b,c):this.oc(a,b,c)},C:function(a){return this.j[a]},J:function(a){return this.j[a]},S:function(a,b){a&1&&J(this.h,b,64);return this.c.getUint16(a,!0)},fa:function(a,b){a&1&&J(this.h,b,64);return this.s[a>>1]},Aa:function(a,b){this.j[a]=b;this.wa=!0},sa:function(a,b){this.j[a]=b;this.wa=!0},na:function(a,b,c){a&1&&J(this.h,
|
|
c,64);this.c.setUint16(a,b,!0);this.wa=!0},va:function(a,b,c){a&1&&J(this.h,c,64);this.s[a>>1]=b;this.wa=!0}};function Hb(a,b,c){a.G=b;a.i=a.m=0;c&&((a.i=c.i)&&sc(a,tc,!1),(a.m=c.m)&&uc(a,tc,!1))}function uc(a,b,c){c&&a.m||(a.Bb=!a.l&&b[1]||a.f,a.Cb=!a.l&&b[3]||a.A);if(c||void 0===c)a.Ub=b[1]||a.f,a.oc=b[3]||a.A}function sc(a,b,c){c&&a.i||(a.Nb=b[0]||a.u,a.aa=b[2]||a.v);if(c||void 0===c)a.I=b[0]||a.u,a.kc=b[2]||a.v}function nc(a,b){b||(b=vc);sc(a,b,void 0);uc(a,b,void 0)}
|
|
var vc=[],rc=[I.prototype.L,I.prototype.ma,I.prototype.ga,I.prototype.Ca],tc=[I.prototype.F,I.prototype.Ba,I.prototype.U,I.prototype.ua];if(Za)var pc=[I.prototype.C,I.prototype.Aa,I.prototype.S,I.prototype.na],oc=[I.prototype.J,I.prototype.sa,I.prototype.fa,I.prototype.va];
|
|
function wc(a,b){z.call(this,"CPU",a,wc,1);b=a.cycles||b;var c=a.multiplier||1;this.Eb=0;this.rb=b;this.na=c;this.Jb=Math.round(this.rb/1E4)/100;this.Na=this.Jb*this.na;this.o.O=!1;this.o.Rb=!1;this.o.Ta=a.autoStart;this.o.wb=!1;this.pb=this.Qa=0;this.qb=a.csStart;this.gb=a.csInterval;this.hb=a.csStop;this.L=[];this.ic=this.Xd.bind(this);G(this)}B(wc);var xc=["power","reset"];h=wc.prototype;
|
|
h.ia=function(a,b,c,d){this.l=a;this.h=b;this.G=d;this.u=a.u;for(b=0;b<xc.length;b++)(c=this.j[xc[b]])&&this.l.ba(null,xc[b],c);a=yc(a,"autoStart");null!=a&&(this.o.Ta="true"==a?!0:"false"==a?!1:!!a);void 0===this.j.run&&(this.o.Ta=!0);G(this)};h.Wb=function(){};h.reset=function(){};h.save=function(){return null};h.restore=function(){return!1};h.ka=function(a,b){if(!b){this.Wb();if(a&&this.restore){zc(this);if(!this.restore(a))return!1;Ac(this)}else this.reset();this.W("No debugger detected")}return!0};
|
|
h.ja=function(a){return a?this.save():!0};h.Ta=function(){return this.o.O?!0:this.o.Ta?(pb(this),!0):!1};h.dc=function(){return 0};function Ac(a){void 0===a.qb&&(a.qb=0);void 0===a.gb&&(a.gb=-1);void 0===a.hb&&(a.hb=-1);a.o.wb=0<=a.qb&&0<a.gb;a.o.wb&&(a.pb=0,a.Qa=a.qb-a.ua)}function sb(a,b){if(a.o.wb){var c=!1;a.pb=a.pb+a.dc()|0;a.Qa-=b;0>=a.Qa&&(a.Qa+=a.gb,c=!0);0<=a.hb&&a.hb<=Bc(a)&&(a.gb=a.hb=-1,Ac(a),H(a),c=!0);c&&a.W(Bc(a)+" cycles: checksum="+r(a.pb))}}
|
|
h.ba=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.j[b]=c,!0;case "run":return this.j[b]=c,c.onclick=function(){var a;if(a=d.l)if(a=d.l,a.o.R)a=!0;else{var b=null,c,k=C(a.id);for(c=0;c<k.length&&(b=k[c],b===a||b.o.ready);c++);if(c==k.length)for(c=0;c<k.length&&(b=k[c],b===a||b.o.R);c++);c==k.length&&(b=a);x("The "+b.type+" component ("+b.id+") is not "+(b.o.ready?"powered yet":"ready yet"+(b.yb?" (waiting for notification)":""))+".");a=!1}a&&(d.o.O?H(d):pb(d))},!0;case "speed":return this.j[b]=
|
|
c,!0;case "setSpeed":return this.j[b]=c,c.onclick=function(){Cc(d,d.na<<1,!0)},c.textContent=this.Na.toFixed(2)+"Mhz",!0}return!1};h.za=function(a){this.l&&this.l.za(a)};function rb(a,b,c){a.ua+=b;c&&(a.ma=a.a=a.J=0)}function Dc(a,b){var c=1;b&&1<a.na&&a.Ma&&(c=a.Ma/a.Jb);a.fc=Math.round(1E3/30);a.sb=Math.floor(a.rb/30*c);b||(a.ib=a.sb);a.Kb=0}function Bc(a){return a.ua+a.ga+a.ma-a.a}function zc(a){a.Ma=0;a.hc=0;a.ua=a.ga=a.ma=a.a=a.J=0;Ac(a);Cc(a,1)}
|
|
function Cc(a,b,c){if(void 0!==b){.8>a.Ma/a.Na&&(b=1);a.na=b;b=a.Jb*a.na;if(a.Na!=b){a.Na=b;b=a.Na.toFixed(2)+"Mhz";var d=a.j.setSpeed;d&&(d.textContent=b);a.W("target speed: "+b)}c&&a.l&&Ec(a.l)}rb(a,a.ga);a.ga=0;a.fa=qa();a.sa=0;Dc(a)}function Xb(a,b){var c=a.L.length;a.L.push([-1,b]);return c}function Yb(a,b,c,d){0<=b&&b<a.L.length&&(d||0>a.L[b][0])&&(c=a.rb*a.na/1E3*c|0,a.o.O&&(c+=Fc(a)),a.L[b][0]=c)}
|
|
function qb(a,b){for(var c=a.L.length-1;0<=c;c--){var d=a.L[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function Fc(a,b){var c=a.ma-=a.a;a.a=a.J=0;b&&(a.ma=0);return c}
|
|
h.Xd=function(){if(this.o.O){this.Kb>=this.rb&&Dc(this,!0);this.jb=0;this.ob=qa();if(this.sa){var a=this.ob-this.sa;a>this.fc&&(this.fa+=a,this.fa>this.ob&&(this.fa=this.ob))}try{do{for(var b,c=this.o.wb?1:this.sb,d=this.L.length-1;0<=d;d--){var e=this.L[d];0>e[0]||c>e[0]&&(c=e[0])}b=c;try{this.Ab(b)}catch(f){if("number"!=typeof f)throw f;}b=Fc(this,!0);this.jb+=b;this.ga+=b;sb(this,b);qb(this,b);this.ib-=b;if(0>=this.ib){this.ib+=this.sb;15<=++this.hc&&(this.za(),this.hc=0);break}}while(this.o.O)}catch(f){H(this);
|
|
this.l&&this.l.stop(qa(),Bc(this));Ya(this,f.stack||f.message);return}if(this.o.O){a=setTimeout;b=this.ic;this.sa=qa();c=this.fc;this.jb&&(c=Math.round(c*this.jb/this.sb));c-=this.sa-this.ob;if(d=this.sa-this.fa)this.Ma=Math.round(this.ga/(10*d))/100,864E5<=d&&(this.ua=0,Cc(this));if(0>c||this.Ma<this.Na)-1E3>c&&(this.fa-=c),c=0;this.Kb+=this.jb;this.sa+=c;a(b,c)}}};
|
|
function pb(a){var b;a.o.error?(a.W(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.o.O)a.W(a.toString()+" busy");else{Cc(a);a.o.O=!0;a.o.Rb=!0;if(b=a.j.run)b.textContent="Halt";a.l&&a.l.start(a.fa,Bc(a));setTimeout(a.ic,0)}}h.Ab=function(){return 0};function H(a){var b=!1;if(a.o.O){Fc(a);rb(a,a.ga);a.ga=0;a.o.O=!1;if(b=a.j.run)b.textContent="Run";a.l&&a.l.stop(qa(),Bc(a));b=!0;a.G||a.status("Stopped")}a.o.complete=void 0;return b}
|
|
function Gc(a){this.Wa=+a.model||1170;this.bc=a.addrReset||0;wc.call(this,a,6666667);this.tb=0;this.ec=255;1120==this.Wa?(this.decode=Hc.bind(this),this.Ca=this.Fc,this.tb=8,this.ec=-1):(this.decode=Ic.bind(this),this.Ca=this.Gc);Jc(this);this.Ra=0;this.I=null;this.Db=[];this.o.complete=!1}B(Gc,wc);h=Gc.prototype;h.Wb=function(){for(var a=192,b=0;b<this.Db.length;b++){var c=this.Db[b];0>c.Tb&&(c.Tb=a,a+=4)}};
|
|
h.reset=function(){this.status("Model "+this.Wa);this.o.O&&H(this);Jc(this);zc(this);this.o.error=!1;this.parent.reset.call(this)};
|
|
function Jc(a){a.m=65536;a.f=32768;a.i=65535;a.s=32768;a.D=15;a.g=[0,0,0,0,0,0,0,a.bc,-1,-2,-3,-4,-5,-6,-7,-8];a.Fa=[0,0,0,0,0,0];a.qa=[0,0,0,0];a.v=0;a.Nc=[4,2,0,1];a.H=[[0,0,0,0,0,0,0,0,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,65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.Z=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,
|
|
0,0,0,0,0]];a.ab=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];a.Pb=[0,0,0,0,0,0,0,0];a.Ob=0;a.w=0;a.C=a.F=0;a.c=a.b=a.Hb=0;a.va=-1;ob(a)}function ob(a){a.Y=0;a.ub=0;a.vb=0;a.ya=0;a.X=0;a.mb=0;a.$a=255;a.Oa=0;a.eb=0;a.fb=0;a.Pa=262143;a.Sa=0;a.A=0;a.I=null;a.h&&(dc(a),a.Lc=Tb(a.h))}function dc(a){a.Oa?(a.U=65536,a.Fb=a.ya&16?4186112:253952,a.S=a.Jc,a.aa=a.Td,a.Cb=a.Re,Lb(a.h,a.ya&16?22:18)):(a.U=0,a.Fb=57344,a.S=a.Ic,a.aa=a.lc,a.Cb=a.pc,Lb(a.h,16))}
|
|
function cc(a,b){b&=-3073;if(a.Y!=b){b&57344&&!(a.Y&57344)&&(a.ub=a.A>>16&65535,a.vb=a.A&65535);a.Y=b;a.eb=(b&96)>>5;a.fb=(b&30)>>1;var c=0;b&257&&(c=4,b&1&&(c|=2));a.Oa!=c&&(a.Oa=c,dc(a))}}function Kc(a,b,c){a.bc=b;a.h.reset();ob(a);Q(a,b);fc(a,0);if(c){for(b=2;5>=b;b++)a.g[b]=0;a.o.O||pb(a)}else a.G?H(a)||a.G.h():!1===c&&H(a);!a.o.O&&a.u&&a.u.stop()}h.dc=function(){return 0};
|
|
h.save=function(){var a=new R(this);a.set(0,[this.g,this.Fa,this.qa,this.ab,this.Pb,this.X,this.Ob,this.mb,this.$a,ec(this),this.va,this.v,this.w,this.Y,this.ub,this.vb,this.ya,this.eb,this.fb,this.H,this.Z,this.Oa,this.Pa,this.Sa,this.A]);a.set(1,[this.ua,this.na]);a.set(2,Sb(this.h));return a.data()};
|
|
h.restore=function(a){var b=a[1];this.ua=b[1];Cc(this,b[3]);a:{b=this.h;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.J){for(var f=0,g=Array(b.J),k=0;k<e.length-1;)for(var l=e[k++],m=e[k++];l--;)g[f++]=m;e=g}f=b.h[d];if(!f||!f.restore(e)){x("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function S(a){return a.m&65536?1:0}function Lc(a){return a.s&32768?8:0}function Mc(a){var b=a.g[7];a.A=b;var c=a.aa(b);a.g[7]=b+2&65535;return c}
|
|
function Nc(a,b){var c=a.g[7];a.g[7]=c+b&65535;return c}function Q(a,b){a.g[7]=b&65535}function $b(a,b,c,d){c={Tb:b,Xa:c,message:d||0,next:null};c.name=$a[b];a.Db.push(c);return c}function bc(a,b){var c=a.I;if(c==b)a.I=b.next;else for(;c;){var d=c.next;if(d==b){c.next=d.next;break}c=d}a.I&&(a.w|=1)}function M(a,b){if(b!=a.I){var c=a.I;if(!c||c.Xa<=b.Xa)b.next=c,a.I=b;else{do{var d=c.next;if(!d||d.Xa<=b.Xa){b.next=d;c.next=b;break}c=d}while(c)}}a.w|=1}
|
|
function Oc(a){return a.w&64?(K(a,168,64,-6),!0):a.w&32?(K(a,4,32,-5),!0):a.w&16?(K(a,12,16,-7),!0):!1}function ec(a){return a.D=a.D&63728|Lc(a)|(a.i&65535?0:4)|(a.f&32768?2:0)|S(a)}function fc(a,b){a.s=b<<12;a.i=~b&4;a.f=b<<14;a.m=b<<16;if((b^a.D)&2048)for(var c=a.Fa.length;0<=--c;){var d=a.g[c];a.g[c]=a.Fa[c];a.Fa[c]=d}a.v=b>>14&3;c=a.D>>14&3;a.v!=c&&(a.qa[c]=a.g[6],a.g[6]=a.qa[a.v]);a.D=b;a.w&=-3;a.w|=a.I?2:1}h.ca=function(a){this.s=this.i=a;this.f=0};
|
|
h.Ga=function(a,b){this.s=this.i=this.m=a;this.f=b||0};function Pc(a,b){a.s=a.i=a.m=b;a.f=a.s^a.m>>1}function Qc(a,b,c,d){a.s=a.i=a.m=b;a.f=(c^d)&(d^b)}function K(a,b,c,d){if(!a.Ra){0>a.va?a.va=ec(a):a.v||(d=-4);-4==d&&(a.w&256&&(d=-1),a.w|=256,a.X|=4,a.g[6]=b=4);if(-1!=d){a.A=b|4143316992;a.v=0;var e=a.aa(b|a.U),f=a.aa(b+2&65535|a.U);fc(a,f&-12289|a.va>>2&12288);Rc(a,a.va);Rc(a,a.g[7]);Q(a,e)}a.a-=5;a.w&=~(c|19);a.w|=129;a.va=-1;-1==d&&H(a);if(-4<=d)throw b;}}
|
|
function Sc(a){var b=Tc(a),c=Tc(a)&-1793;a.D&49152&&(c=c&-225|a.D&63712);Q(a,b);fc(a,c);a.w&=-17}function Uc(a,b){var c=b>>13&31;31>c&&(b=a.ya&32?a.ab[c]+(b&8190)&4194302:b&-3932161);return b}
|
|
function wb(a,b,c){var d,e,f;if(!(c&a.Oa))return f=b&65535,57344<=f&&(f|=a.Fb),f;d=b>>13;a.ya&a.Nc[a.v]||(d&=7);e=a.H[a.v][d];f=(a.Z[a.v][d]<<6)+(b&8191)&a.Pa;3932160<=f&&(f=Uc(a,f));if(a.Ra)return f;f>=a.Lc&&f<a.Fb?(a.X|=32,K(a,4,0,f)):f&1&&!(c&1)&&(a.X|=64,K(a,4,0,f));var g=0;switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:128;break;default:g=32768}32512!=(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&
|
|
(g|=16384));a.H[a.v][d]=e;if(f!=(4194170&a.Pa)||a.v)a.eb=a.v,a.fb=d;g&&(g&57344&&(0<=a.va&&(g|=128),a.Y&57344||(g|=a.Y&4096|a.eb<<5|a.fb<<1,cc(a,a.Y&-61695|g&61694)),K(a,168,64,-2)),a.Y&61440||!(f<(4191360&a.Pa)||f>(4194239&a.Pa))||(a.Y|=4096,a.Y&512&&(a.w|=64)));return f}function Tc(a){var b=a.aa(a.g[6]|a.U);a.g[6]=a.g[6]+2&65535;return b}function Rc(a,b){var c=a.g[6]-2&65535;a.g[6]=c;a.A=a.A&65535|(a.A&-65536)<<8|16121856;a.w&256||a.Ca(4,-2,c);a.Cb(c,b)}
|
|
function Vc(a,b,c,d){var e,f,g=d&8?0:a.U;switch(b){case 0:return K(a,4,0,-3),0;case 1:return 6==c&&a.Ca(d,0,a.g[6]),a.a-=3,7==c?a.g[c]:a.g[c]|g;case 2:f=2;e=a.g[c];6==c&&a.Ca(d,f,e);7!=c&&(e|=g,6>c&&d&1&&(f=1));a.a-=3;break;case 3:f=2;e=a.g[c];7!=c&&(e|=g);e=a.aa(e);e|=g;a.a-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.g[c]+f&65535;6==c&&a.Ca(d,f,e);7!=c&&(e|=g);a.a-=4;break;case 5:f=-2;e=a.g[c]-2&65535;7!=c&&(e|=g);e=a.aa(e)|g;a.a-=8;break;case 6:return e=a.aa(Nc(a,2)),e=e+a.g[c]&65535,6==c&&a.Ca(d,
|
|
0,e),a.a-=6,e|g;case 7:return e=a.aa(Nc(a,2)),e=e+a.g[c]&65535,e=a.aa(e|a.U),a.a-=10,e|g}a.g[c]=a.g[c]+f&65535;a.A=a.A&65535|(a.A&-65536)<<8|(f<<3&248|c)<<16;return e}h.Fc=function(a,b,c){!this.v&&0>=b&&c<=this.$a&&(this.w|=32)};h.Gc=function(a,b,c){this.v||(65534<=c&&(c|=-65536),a&4&&c<=this.$a&&(c<=this.$a-32?K(this,4,0,-4):(this.X|=8,this.w|=32)))};h.Ic=function(a,b,c){a=Vc(this,a,b,c);3932160<=a&&(a=Uc(this,a));return a};h.Jc=function(a,b,c){return wb(this,Vc(this,a,b,c),c)};
|
|
h.lc=function(a){3932160<=a&&(a=Uc(this,a));return Pb(this.h,this.Sa=a)};h.Td=function(a){return Pb(this.h,this.Sa=wb(this,a,2))};h.pc=function(a,b){3932160<=a&&(a=Uc(this,a));Qb(this.h,this.Sa=a,b)};h.Re=function(a,b){Qb(this.h,this.Sa=wb(this,a,4),b)};function Wc(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?(d=Vc(a,b,d,2),c&65536||61440!==(a.D&61440)&&(d&=65535),a.v=a.D>>12&3,c=a.aa(d|c&a.U),a.v=a.D>>14&3):c=6!=d||(a.D>>2&12288)===(a.D&12288)?a.g[d]:a.qa[a.D>>12&3];return c}
|
|
function Xc(a,b,c,d){a.A=a.A&65535|1441792;var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=Vc(a,b,e,4),c&65536||(e&=65535),a.v=a.D>>12&3,e=wb(a,e|c&65536,4),a.v=a.D>>14&3,Qb(a.h,e,d)):6!=e||(a.D>>2&12288)===(a.D&12288)?a.g[e]=d:a.qa[a.D>>12&3]=d}function Yc(a,b){b>>=6;var c=a.F=b&7;(b=a.C=(b&56)>>3)?(c=a.S(b,c,3),a=Ob(a.h,c)):a=a.g[c+a.tb]&a.ec;return a}function Zc(a,b){b>>=6;var c=a.F=b&7;return(b=a.C=(b&56)>>3)?Pb(a.h,a.S(b,c,2)):a.g[c+a.tb]}
|
|
function $c(a,b){var c=a.b=b&7;b=a.c=(b&56)>>3;return Vc(a,b,c,8)}function ad(a,b){var c=a.b=b&7;(b=a.c=(b&56)>>3)?(c=a.S(b,c,3),a=Ob(a.h,c)):a=a.g[c]&255;return a}function bd(a,b){var c=a.b=b&7;return(b=a.c=(b&56)>>3)?Pb(a.h,a.S(b,c,2)):a.g[c]}function T(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.Hb=a.S(b,e,7),c=0>c?a.g[-c-1]&255:c,c=d.call(a,c,Ob(a.h,e)),e&1&&a.a--,a=a.h,a.f[(e&a.i)>>>a.b].Bb(e&a.l,c,e)):(b=a.g[e],c=0>c?a.g[-c-1]&255:c,a.g[e]=b&65280|d.call(a,c,b&255))}
|
|
function U(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.S(b,e,6),Qb(a.h,e,d.call(a,0>c?a.g[-c-1]:c,Pb(a.h,e)))):a.g[e]=d.call(a,0>c?a.g[-c-1]:c,a.g[e])}function cd(a,b,c,d,e){var f=a.b=b&7;(b=a.c=(b&56)>>3)?(d=a.S(b,f,5),e.call(a,(c=0>c?a.g[-c-1]&255:c)<<8),d&1&&a.a--,a=a.h,a.f[(d&a.i)>>>a.b].Bb(d&a.l,c,d)):(c?(c=0>c?a.g[-c-1]&255:c,a.g[f]=a.g[f]&~d|c<<24>>24&d):a.g[f]&=~d,e.call(a,c<<8))}
|
|
function dd(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.S(b,e,4),d.call(a,c=0>c?a.g[-c-1]:c),Qb(a.h,e,c)):(a.g[e]=c=0>c?a.g[-c-1]:c,d.call(a,c))}function V(a,b,c){c&&(Q(a,a.g[7]+(b<<24>>23)),a.a-=2);a.a-=3}
|
|
h.Ab=function(a){this.o.complete=!0;var b=a?this.o.Rb?0:1:-1;this.o.Rb=!1;this.ma=this.a=a;do{if(this.w){if(a=this.w&11){a=!1;if(this.w&2){var c=160,d=(this.mb&224)>>5,e=this.I&&this.I.Xa>d?this.I:null;e&&(c=e.Tb,d=e.Xa);d>(this.D&224)>>5?(this.w&8&&(Nc(this,2),this.w&=-9),K(this,c,0,-10),d=!0):d=!1;d&&(e&&bc(this,e),a=!0);this.I||this.mb||(this.w&=-3)}else this.w&1&&this.w++;a=a&&0>b}if(a)break;if(this.w&112&&Oc(this)&&0>b)break}this.w=this.w&15|this.D&16;this.decode(Mc(this))}while(0<this.a);return this.o.complete?
|
|
this.ma-this.a:void 0===this.o.complete?0:-1};Ia(function(){for(var a=F(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=D(c),d=new Gc(d);E(d,c)}});function ed(a,b){var c=b+a;this.s=this.i=this.m=c;this.f=(a^c)&(b^c);return c&65535}function fd(a,b){var c=b+a,d=c<<8;this.s=this.i=this.m=d;this.f=(a<<8^d)&(b<<8^d);return c&255}function gd(a,b){a=b<<1;Pc(this,a);return a&65535}function hd(a,b){a=b<<1;Pc(this,a<<8);return a&255}function id(a,b){a=b&32768|b>>1|b<<16;Pc(this,a);return a&65535}
|
|
function jd(a,b){a=b&128|b>>1|b<<8;Pc(this,a<<8);return a&255}function kd(a,b){a=b&~a;this.ca(a);return a}function ld(a,b){a=b&~a;this.ca(a<<8);return a}function md(a,b){a|=b;this.ca(a);return a}function nd(a,b){a|=b;this.ca(a<<8);return a}function od(a,b){a=~b|65536;this.Ga(a);return a&65535}function pd(a,b){a=~b|256;this.Ga(a<<8);return a&255}function qd(a,b){this.s=this.i=a=b-a;this.f=b&(b^a);return a&65535}function rd(a,b){a=b-a;var c=a<<8;b<<=8;this.s=this.i=c;this.f=b&(b^c);return a&255}
|
|
function sd(a,b){this.s=this.i=a=b+a;this.f=a&(b^a);return a&65535}function td(a,b){a=b+a;var c=a<<8;this.s=this.i=c;this.f=c&(b<<8^c);return a&255}function ud(a,b){a=-b;this.Ga(a,a&b&32768);return a&65535}function vd(a,b){a=-b;this.Ga(a<<8,(a&b&128)<<8);return a&255}function wd(a,b){a=b<<1|this.m>>16&1;Pc(this,a);return a&65535}function xd(a,b){a=b<<1|this.m>>16&1;Pc(this,a<<8);return a&255}function yd(a,b){a=(this.m&65536|b)>>1|b<<16;Pc(this,a);return a&65535}
|
|
function zd(a,b){a=((this.m&65536)>>8|b)>>1|b<<8;Pc(this,a<<8);return a&255}function Ad(a,b){var c=b-a;Qc(this,c,a,b);return c&65535}function Bd(a,b){var c=b-a;Qc(this,c<<8,a<<8,b<<8);return c&255}function Cd(a,b){this.s=this.i=b&65280;this.f=this.m=0;return(b<<8|b>>8)&65535}function Dd(a,b){a^=b;this.ca(a);return a&65535}function Ed(a){U(this,a,Zc(this,a),ed);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.C?5:3)+(7==this.b?2:0)}
|
|
function Fd(a){var b=bd(this,a);a=a>>6&7;var c=this.g[a];c&32768&&(c|=4294901760);this.m=this.f=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.m=c<<17-b,c>>=b;else if(b)if(16<b)this.f=c,c=0;else{this.m=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.f=32768)}this.g[a]=c&65535;this.s=this.i=c;this.a-=(this.c?6:7)+b}
|
|
function Gd(a){var b=bd(this,a);a=a>>6&7;var c=this.g[a]<<16|this.g[a|1];this.m=this.f=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.m=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.m=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.f=32768)):d=c;this.g[a]=d>>16&65535;this.g[a|1]=d&65535;this.s=d>>16;this.i=d>>16|d;this.a-=(this.c?6:7)+b}function Hd(a){V(this,a,!S(this))}function Id(a){V(this,a,S(this))}
|
|
function Jd(a){U(this,a,Zc(this,a),kd);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.C?5:3)+(7==this.b?2:0)}function Kd(a){T(this,a,Yc(this,a),ld);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.C?5:3)+(7==this.b?2:0)}function Ld(a){U(this,a,Zc(this,a),md);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.C?5:3)+(7==this.b?2:0)}function Md(a){T(this,a,Yc(this,a),nd);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.C?5:3)+(7==this.b?2:0)}
|
|
function Nd(a){var b=Zc(this,a);a=bd(this,a);this.ca((0>b?this.g[-b-1]:b)&a);this.a-=this.c?4+(this.F&&6<=this.b?1:0):(this.C?4:3)+(7==this.b?2:0)}function Od(a){var b=Yc(this,a);a=ad(this,a);this.ca(((0>b?this.g[-b-1]&255:b)&a)<<8);this.a-=this.c?4+(this.F&&6<=this.b?1:0):(this.C?4:3)+(7==this.b?2:0)}function Pd(a){V(this,a,this.i&65535?0:4)}function Qd(a){V(this,a,!Lc(this)==!(this.f&32768))}function Rd(a){V(this,a,!!(this.i&65535)&&!Lc(this)==!(this.f&32768))}
|
|
function Sd(a){V(this,a,!S(this)&&!!(this.i&65535))}function Td(a){V(this,a,(this.i&65535?0:4)||!Lc(this)!=!(this.f&32768))}function Ud(a){V(this,a,S(this)||(this.i&65535?0:4))}function Vd(a){V(this,a,!Lc(this)!=!(this.f&32768))}function Wd(a){V(this,a,Lc(this))}function Xd(a){V(this,a,!!(this.i&65535))}function Yd(a){V(this,a,!Lc(this))}function Zd(){K(this,12,0,-9)}function $d(a){V(this,a,!0)}function ae(a){V(this,a,!(this.f&32768))}function be(a){V(this,a,this.f&32768?2:0)}
|
|
function W(a){a&1&&(this.m=0);a&2&&(this.f=0);a&4&&(this.i=1);a&8&&(this.s=0);this.a-=5}function ce(a){var b=Zc(this,a);a=bd(this,a);var c=(b=0>b?this.g[-b-1]:b)-a;Qc(this,c,a,b);this.a-=this.c?4+(this.F&&6<=this.b?1:0):(this.C?4:3)+(7==this.b?2:0)}function de(a){var b=Yc(this,a);a=ad(this,a);var c=(b=(0>b?this.g[-b-1]&255:b)<<8)-(a<<=8);Qc(this,c,a,b);this.a-=this.c?4+(this.F&&6<=this.b?1:0):(this.C?4:3)+(7==this.b?2:0)}
|
|
function ee(a){var b=bd(this,a);if(b){a=a>>6&7;var c=this.g[a]<<16|this.g[a|1];this.m=this.f=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.g[a]=d&65535,this.g[a|1]=c-d*b&65535,this.i=d>>16|d,this.s=d>>16):(this.f=32768,this.i=d>>15|d,this.s=c>>16,-1===b&&65534===this.g[a]&&(this.g[a]=this.g[a|1]=1));this.a-=53}else this.i=this.s=0,this.f=32768,this.m=65536,this.a-=7}function fe(){K(this,24,0,-9);this.a-=20}
|
|
function ge(){this.D&49152?(this.X|=128,K(this,4,0,-8)):(this.u&&1120==this.Wa&&this.u.setData(this.g[0],!0),this.G?this.G.c():H(this));this.a-=7}function he(){K(this,16,0,-9);this.a-=20}var ie=[0,7,7,10,7,11,9,13];function je(a){this.J=this.a;Q(this,$c(this,a));this.a=this.J-ie[this.c]}var ke=[0,14,14,17,14,18,16,20];function le(a){this.J=this.a;var b=$c(this,a);a=a>>6&7;Rc(this,this.g[a]);this.g[a]=this.g[7];Q(this,b);this.a=this.J-ke[this.c]}var me=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];
|
|
function ne(a){var b=Zc(this,a);this.J=this.a;dd(this,a,b,this.ca);this.a=this.J-me[(this.C?8:0)+this.c]+(7!=this.b||this.c?0:2)}function oe(a){var b=Yc(this,a);cd(this,a,b,65535,this.ca);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.C?5:3)+(7==this.b?2:0)}var pe=[7,13,13,17,14,18,17,21];
|
|
function qe(a){var b=bd(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.g[a];c&32768&&(c|=-65536);b=~~(b*c);this.g[a]=b>>16&65535;this.g[a|1]=b&65535;this.s=b>>16;this.i=this.s|b;this.f=0;this.m=-32768>b||32767<b?65536:0;this.a-=23}function re(){this.a-=5}function se(){this.D&49152||(this.h.reset(),ob(this),this.u&&this.u.setData(this.g[0],!0));this.a-=667}function te(a){if(a&8)K(this,8,0,-9);else{var b=Tc(this);a&=7;7==a?Q(this,b):(Q(this,this.g[a]),this.g[a]=b);this.a-=9}}
|
|
function ue(){Sc(this);this.a-=13}function X(a){a&1&&(this.m=65536);a&2&&(this.f=32768);a&4&&(this.i=0);a&8&&(this.s=32768);this.a-=5}function ve(a){var b=(a&448)>>6;if(this.g[b]=this.g[b]-1&65535)Q(this,this.g[7]-((a&63)<<1)),this.a+=1;this.a-=6}function we(a){U(this,a,Zc(this,a),Ad);this.a-=this.c?9+(this.F&&6<=this.b?1:0):(this.C?5:3)+(7==this.b?2:0)}function xe(a){U(this,a,0,Cd);this.a-=this.c?9:3+(7==this.b?2:0)}function ye(){K(this,28,0,-9)}
|
|
function ze(){this.u&&(this.u.la=this.g[7],this.u.setData(this.g[0],!0));this.w|=8;Nc(this,-2);this.a-=3}function Ae(a){U(this,a,this.g[(a>>6&7)+this.tb],Dd);this.a-=this.c?9:3+(7==this.b?2:0)}function Y(){K(this,8,0,-9)}function Hc(a){Be[a>>12].call(this,a)}function Ce(a){De[a>>6&3].call(this,a)}function Ee(a){Fe[a>>6&3].call(this,a)}function Ge(a){He[a>>6&3].call(this,a)}function Ie(a){Je[a&15].call(this,a)}function Ke(a){Le[a&15].call(this,a)}function Me(a){Ne[a>>6&3].call(this,a)}
|
|
function Oe(a){Pe[a>>6&3].call(this,a)}function Qe(a){Re[a>>6&3].call(this,a)}
|
|
var Be=[function(a){Se[a>>8&15].call(this,a)},ne,ce,Nd,Jd,Ld,Ed,Y,function(a){Te[a>>8&15].call(this,a)},oe,de,Od,Kd,Md,we,Y],Se=[function(a){Ue[a>>4&15].call(this,a)},$d,Xd,Pd,Qd,Vd,Rd,Td,le,le,Ce,Ee,Ge,Y,Y,Y],De=[function(a){dd(this,a,0,this.Ga);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,od);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,1,sd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,1,qd);this.a-=this.c?9:3+(7==this.b?2:0)}],Fe=[function(a){U(this,a,0,ud);
|
|
this.a-=this.c?11:6},function(a){U(this,a,S(this)?1:0,ed);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,S(this)?1:0,Ad);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=bd(this,a);this.Ga(a);this.a-=this.c?4:3+(7==this.b?2:0)}],He=[function(a){U(this,a,0,yd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,wd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,id);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,gd);this.a-=this.c?9:3+(7==this.b?2:0)}],Ue=[function(a){Ve[a&
|
|
15].call(this,a)},Y,Y,Y,je,je,je,je,te,Y,Ie,Ke,xe,xe,xe,xe],Ve=[ge,ze,ue,Zd,he,se,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y],Je=[re,function(){this.m=0;this.a-=5},function(){this.f=0;this.a-=5},W,function(){this.i=1;this.a-=5},W,W,W,function(){this.s=0;this.a-=5},W,W,W,W,W,W,W],Le=[re,function(){this.m=65536;this.a-=5},function(){this.f=32768;this.a-=5},X,function(){this.i=0;this.a-=5},X,X,X,function(){this.s=32768;this.a-=5},X,X,X,X,X,X,X],Te=[Yd,Wd,Sd,Ud,ae,be,Hd,Id,fe,ye,Me,Oe,Qe,Y,Y,Y],Ne=[function(a){cd(this,a,0,
|
|
255,this.Ga);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,pd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,1,td);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,1,rd);this.a-=this.c?9:3+(7==this.b?2:0)}],Pe=[function(a){T(this,a,0,vd);this.a-=this.c?11:6},function(a){T(this,a,S(this)?1:0,fd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,S(this)?1:0,Bd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=ad(this,a);this.Ga(a<<8);this.a-=this.c?4:3+(7==this.b?
|
|
2:0)}],Re=[function(a){T(this,a,0,zd);this.a-=this.c?9+(this.Hb&1):3+(7==this.b?2:0)},function(a){T(this,a,0,xd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,jd);this.a-=this.c?9+(this.Hb&1):3+(7==this.b?2:0)},function(a){T(this,a,0,hd);this.a-=this.c?9:3+(7==this.b?2:0)}];function Ic(a){We[a>>12].call(this,a)}
|
|
var We=[function(a){Xe[a>>8&15].call(this,a)},ne,ce,Nd,Jd,Ld,Ed,function(a){Ye[a>>8&15].call(this,a)},function(a){Ze[a>>8&15].call(this,a)},oe,de,Od,Kd,Md,we,Y],Xe=[function(a){$e[a>>4&15].call(this,a)},$d,Xd,Pd,Qd,Vd,Rd,Td,le,le,Ce,Ee,Ge,function(a){af[a>>6&3].call(this,a)},Y,Y],af=[function(a){a=this.g[7]+((a&63)<<1)&65535;var b=this.aa(a|this.U);Q(this,this.g[5]);this.g[6]=a+2&65535;this.g[5]=b;this.a-=8},function(a){a=Wc(this,a,0);this.ca(a);Rc(this,a);this.a-=11},function(a){var b=Tc(this);this.J=
|
|
this.a;this.ca(b);Xc(this,a,0,b);this.a=this.J-pe[this.c]},function(a){dd(this,a,Lc(this)?65535:0,this.ca);this.a-=this.c?9:3+(7==this.b?2:0)}],$e=[function(a){bf[a&15].call(this,a)},Y,Y,Y,je,je,je,je,te,function(a){a&8?(this.D&49152||(this.D=this.D&-2017|(a&7)<<5,this.w|=1,this.w&=-3),this.a-=5):K(this,8,0,-9)},Ie,Ke,xe,xe,xe,xe],bf=[ge,ze,function(){Sc(this);this.w|=this.D&16;this.a-=13},Zd,he,se,ue,function(){K(this,8,0,-9)},Y,Y,Y,Y,Y,Y,Y,Y],Ye=[qe,qe,ee,ee,Fd,Fd,Gd,Gd,Ae,Ae,Y,Y,Y,Y,ve,ve],Ze=
|
|
[Yd,Wd,Sd,Ud,ae,be,Hd,Id,fe,ye,Me,Oe,Qe,function(a){cf[a>>6&3].call(this,a)},Y,Y],cf=[Y,function(a){a=Wc(this,a,65536);this.ca(a);Rc(this,a);this.a-=11},function(a){var b=Tc(this);this.J=this.a;this.ca(b);Xc(this,a,65536,b);this.a=this.J-pe[this.c]},Y];
|
|
function df(a){z.call(this,"ROM",a,df,128);this.da=this.c=null;this.i=a.addr;this.b=a.size;this.m=!1;this.f=a.alias;this.l=a.file;this.s=u(this.l);if(this.l){a=this.l;var b=ka(this.s);"json"!=b&&"hex"!=b&&(a=ta()+"/api/v1/dump?file="+this.l+"&format=bytes&decimal=true");var c=this;w(a,null,!0,function(a,b,f){f?(c.B("Unable to load ROM resource (error "+f+": "+a+")"),c.l=null):(Ta(c.Ba,a,b),(a=sa(a,b))?(c.c=a.M,c.da=a.da):c.l=null);ef(c)})}}B(df);h=df.prototype;
|
|
h.ia=function(a,b,c,d){this.h=b;this.a=c;this.G=d;ef(this)};h.ka=function(){this.da&&(this.G&&this.G.a(this.id,this.i,this.b,this.da),delete this.da);return!0};h.ja=function(){return!0};
|
|
function ef(a){if(!Xa(a)){if(a.l){if(!a.c||!a.h)return;a.b||(a.b=a.c.length);if(a.c.length!=a.b)Ya(a,"ROM size ("+r(a.c.length,8,!0)+") does not match specified size ("+r(a.b,8,!0)+")");else{var b;a:{b=a.i;a.status(a.b+"-byte ROM at "+ja(b));if(57344<=b&&b<57344+Cb){var c={};b=(c[b]=[df.prototype.Hd,df.prototype.Fe,null,null,null,a.b>>1],c);if(fb(a.h,a,b)){b=a.m=!0;break a}}else if(Ib(a.h,b,a.b,mc)){for(c=0;c<a.c.length;c++)Rb(a.h,b+c,a.c[c]);b=!0;break a}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 d=a,e=b[c],f=d.h,g=d.b,k=[],l=d.i>>>f.b;0<g&&l<f.h.length;)k.push(f.h[l++]),g-=f.c;f=d.h;d=d.b;g=0;for(e>>>=f.b;0<d&&e<f.h.length;){l=k[g++];if(!l)break;f.h[e++]=l;d-=f.c}}a.m||delete a.c}}}G(a)}}h.Hd=function(a){return this.c[a-this.i]};h.Fe=function(){};Ia(function(){for(var a=F(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=D(c),d=new df(d);E(d,c)}});
|
|
function ff(a){z.call(this,"RAM",a,ff);this.da=this.c=null;this.l=a.addr;this.f=a.size;this.pa=a.load;this.oa=a.exec;this.i=!1;this.b=a.file;this.m=u(this.b);if(this.b){a=this.b;var b=ka(this.m);"json"!=b&&"hex"!=b&&(a=ta()+"/api/v1/dump?file="+this.b+"&format=bytes&decimal=true");var c=this;w(a,null,!0,function(a,b,f){f?(c.B("Unable to load RAM resource (error "+f+": "+a+")"),c.b=null):(Ta(c.Ba,a,b),(a=sa(a,b))?(c.c=a.M,c.da=a.da,null==c.pa&&(c.pa=a.pa),null==c.oa&&(c.oa=a.oa)):c.b=null);gf(c)})}}
|
|
B(ff);ff.prototype.ia=function(a,b,c,d){this.h=b;this.a=c;this.G=d;gf(this)};ff.prototype.ka=function(){this.da&&(this.G&&this.G.a(this.id,this.l,this.f,this.da),delete this.da);return!0};ff.prototype.ja=function(){return!0};function gf(a){if(a.h&&(!a.i&&a.f&&(Ib(a.h,a.l,a.f,Ub)?a.i=!0:a.f=0),!Xa(a))){if(!a.i)x("No RAM allocated");else if(a.b){if(!a.c||!a.h)return;hf(a,a.c,a.pa,a.oa,a.l)}G(a)}}
|
|
ff.prototype.reset=function(){if(this.i){for(var a=this.h,b=this.l,c=this.f,d=b&a.l,b=b>>>a.b;0<c&&b<a.h.length;){var e=a.h[b],f=c,g=0,k,d=d||0,g=g&255;void 0===f&&(f=e.size);if(Za&&e.j)for(k=d;f--&&k<e.j.length;k++)e.j[k]=g;else for(k=d;f--&&k<e.size;k++)e.Ub(d,g,e.Ha+d);c-=a.c;b++;d=0}this.c&&hf(this,this.c,this.pa,this.oa,this.l,!0)}};
|
|
function hf(a,b,c,d,e,f){var g=!1,k=!1;if(null==c)for(var l=0;l<b.length-1;){var m=b[l]&255|(b[l+1]&255)<<8;if(m)if(m&255){if(1!=m)break;if(l+6>=b.length)break;for(var l=l+2,p=b[l++]&255|(b[l++]&255)<<8,t=b[l++]&255|(b[l++]&255)<<8,m=m+((p&255)+(p>>8)+(t&255)+(t>>8)),v=l,y=p-=6;0<p&&l<b.length;)m+=b[l++]&255,p--;if(p||l>=b.length)break;m+=b[l++]&255;if(m&255)break;if(y)for(;y--;)Rb(a.h,t++,b[v++]&255);else t&1?g=!0:null==d&&(d=t);k=!0}else l++;else l+=2}if(!k&&(null==c&&(c=e),null!=c)){for(e=0;e<
|
|
b.length;e++)Rb(a.h,c+e,b[e]);k=!0}if(k){if(null==d||g)H(a.a),f=!1;null!=d&&Kc(a.a,d,f)}return k}Ia(function(){for(var a=F(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=D(c),d=new ff(d);E(d,c)}});function jf(a){z.call(this,"Keyboard",a,jf,1024);G(this)}B(jf);jf.prototype.ba=function(){return!1};jf.prototype.ia=function(a,b,c,d){this.l=a;this.a=c;this.G=d};Ia(function(){for(var a=F(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=D(c),d=new jf(d);E(d,c)}});
|
|
function Z(a){this.A=a.adapter;this.L=a.baudReceive||9600;this.ma=a.baudTransmit||9600;this.sa=a.upperCase;this.f=this.m=null;this.fa=a.tabSize;this.S=a.charBOL;this.s=0;this.v=!0;z.call(this,"SerialPort",a,Z,262144);var b=a.binding;if("console"==b)this.m="";else{var c;a=kf;b&&(void 0===c&&(c="Panel"),(c=Va(c,this.id))&&(b=c.j[b])&&this.ba(null,a,b))}this.i=this.F=this.I=null;this.exports={connect:this.gc,receiveData:this.zb,receiveStatus:this.Wd}}B(Z);var kf="buffer";h=Z.prototype;
|
|
h.ba=function(a,b,c){var d=this;switch(b){case kf:return this.j[b]=this.f=c,c.onkeydown=function(a){a=a||window.event;var b=0,c=a.keyCode;8==c?b=a.altKey?n.Xb:n.tc:46==c?b=n.Xb:a.ctrlKey&&c>=n.Vb&&c<=n.Ac&&(b=c-(n.Vb-n.qc));b&&(a.preventDefault&&a.preventDefault(),d.zb(b));return!0},c.onkeypress=function(a){a=a||window.event;var b=a.which||a.keyCode;a.altKey&&b==n.sc&&(b=n.rc);d.zb(b);a.preventDefault&&a.preventDefault();return!0},c.onpaste=function(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&
|
|
a.preventDefault();(a=a.clipboardData||window.clipboardData)&&d.zb(a.getData("Text"))},c.removeAttribute("readonly"),!0}return!1};
|
|
h.ia=function(a,b,c,d){this.l=a;this.h=b;this.a=c;this.G=d;var e=this;this.U=$b(this.a,this.A?-1:48,4,262144);this.ga=Xb(this.a,function(){var a;a=-1;e.u.length&&(a=e.u.shift()&255,e.sa&&97<=a&&122>a&&(a-=32),Yb(e.a,e.ga,1E3/Math.round(e.L/10)));0<=a&&(e.C=a,e.b&128?e.C|=49152:e.b|=128,e.b&64&&M(c,e.U))});this.J=$b(this.a,this.A?-1:52,4,262144);this.na=Xb(this.a,function(){e.c|=128;e.c&64&&M(c,e.J)});fb(b,this,lf,this.A?64832+8*(this.A-1)-65392:0);hb(b,this.reset.bind(this));G(this)};
|
|
h.gc=function(a){if(!this.i){var b=yc(this.l,"connection");if(b){var c=b.split("->");if(2==c.length){var d=oa(c[0]);if(d!=this.Aa)return;c=oa(c[1]);if(this.i=Ua(c)){var e=this.i.exports;if(e){var f=e.connect;f&&f.call(this.i,this.v);if(this.F=e.receiveData){this.v=a;this.I=e.receiveStatus;this.status(this.Ba+"."+d+" connected to "+c);return}}}}this.status("Unable to establish connection: "+b)}}};
|
|
h.ka=function(a,b){if(!b)if(this.gc(this.v),!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 R(this);a.set(0,[]);return a.data()};h.restore=function(){return mf(this)};function mf(a){a.C=0;a.b=8192;a.c=128;a.u=[];return!0}
|
|
h.zb=function(a){if("number"==typeof a)this.u.push(a);else if("string"==typeof a)for(var b=0,c,d=0;d<a.length;d++){c=b;b=a.charCodeAt(d);if(10==b){if(13==c)continue;b=13}this.u.push(b)}else this.u=this.u.concat(a);Yb(this.a,this.ga,1E3/Math.round(this.L/10));return!0};h.Wd=function(a){var b=this.b;this.b&=-12289;a&32&&(this.b|=8192);a&256&&(this.b|=4096);b!=this.b&&(this.b|=32768,this.b&32&&M(this.a,this.U))};h.ud=function(){var a=this.b&65534;this.b&=-32769;return a};
|
|
h.se=function(a){var b=a^this.b;this.b=this.b&-112|a&111;this.I&&b&6&&(b=0,b=this.v?b|(a&4?32:0)|(a&2?320:0):b|(a&4?16:0)|(a&2?1048576:0),this.I.call(this.i,b))};h.td=function(){this.b&=-129;return this.C};h.re=function(){};h.Vd=function(){return this.c};h.Te=function(a){this.c&128&&(a&64?M(this.a,this.J):bc(this.a,this.J));this.c=this.c&-70|a&69};h.Ud=function(){return 0};
|
|
h.Se=function(a){a&=255;this.F&&this.F.call(this.i,a);a&=127;if(this.f)if(13==a)this.s=0;else if(8==a)this.f.value=this.f.value.slice(0,-1),0<this.s&&this.s--;else{if(a){var b;b=(b=pa[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.fa||8,c=a-this.s%a,this.fa&&(b=" ".slice(0,c)));this.S&&!this.s&&c&&(b=String.fromCharCode(this.S)+b);this.f.value+=b;this.f.scrollTop=this.f.scrollHeight;this.s+=c}}else if(null!=this.m){if(10==
|
|
a||1024<=this.m.length)this.W(this.m),this.m="";10!=a&&(this.m+=String.fromCharCode(a))}Yb(this.a,this.na,1E3/Math.round(this.ma/10));this.c&=-129};var nf={},lf=(nf[65392]=[null,null,Z.prototype.ud,Z.prototype.se,"RCSR"],nf[65394]=[null,null,Z.prototype.td,Z.prototype.re,"RBUF"],nf[65396]=[null,null,Z.prototype.Vd,Z.prototype.Te,"XCSR"],nf[65398]=[null,null,Z.prototype.Ud,Z.prototype.Se,"XBUF"],nf);
|
|
Ia(function(){for(var a=F(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=D(c),d=new Z(d);E(d,c)}});function gc(a){z.call(this,"PC11",a,gc);this.C=of(this,a.autoMount);this.c=0;this.S=a.baudReceive||3600;this.u=this.v=this.b=0;this.s=[];this.m=pf;this.f=qf;this.A=this.i="";this.M=this.pa=this.oa=null;this.J=-1;this.F=!Ba("Mobi")&&window&&"FileReader"in window}B(gc);var pf="",qf=0;
|
|
function of(a,b){if(b&&"string"==typeof b)try{b=eval("("+b+")")}catch(c){x(a.type+" auto-mount error: "+c.message+" ("+b+")"),b=null}return b||{}}h=gc.prototype;
|
|
h.ba=function(a,b,c){var d=this,e=qf;switch(b){case "listTapes":return this.j[b]=c,c.onchange=function(){var a=d.j.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(l){x("PC11 option error: "+l.message)}b=e.desc;void 0===b&&(b="");e=e.href;void 0!==e&&(b='<a href="'+e+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descTape":return this.j[b]=c,!0;case "readTape":e=2;case "loadTape":return e||(e=1),this.j[b]=c,c.onclick=function(){var a=
|
|
d.j.listTapes;a&&rf(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.F){c.parentNode.removeChild(c);break}this.j[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;rf(d,u(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.j[b]=c,!0}return!1};
|
|
h.ia=function(a,b,c,d){this.l=a;this.h=b;this.a=c;this.G=d;this.L=sf(a);var e=this;if(a=of(this,yc(this.l,"autoMount")))for(var f in a)"PTR"==f&&(this.C[f]=a[f]);this.I=$b(this.a,56,4,4096);this.U=Xb(this.a,function(){1==(e.b&32769)&&!(e.b&128)&&e.u<e.s.length&&(e.v=e.s[e.u++]&255,tf(e,e.u/e.s.length*100),e.b|=128,e.b&=-2049,e.b&64&&M(e.a,e.I))});fb(b,this,uf);hb(b,this.reset.bind(this));vf(this,"None",pf,!0);this.F&&vf(this,"Local Tape","?");vf(this,"Remote Tape","??");wf(this)||G(this)};
|
|
h.ka=function(a,b){if(!b)if(!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(){this.b&=-2241;this.v=0};function wf(a){a.c=0;var b=a.C.PTR;if(b){var c=b.path||"";if(!(b=b.name))a:{if((b=a.j.listTapes)&&b.options)for(var d=0;d<b.options.length;d++){var e=b.options[d];if(e.value==c){b=e.text;break a}}b=u(c,!0)}c&&b?xf(a,b,c,1,!0):yf(a)}return!!a.c}
|
|
function rf(a,b,c,d,e){if(c)if("?"==c)a.B('Use "Choose File" and "Mount" to select and load a local tape.');else{if("??"==c){c=window.prompt("Enter the URL of a remote tape image.","")||"";if(!c)return;b=u(c);a.status("Attempting to load "+c+' as "'+b+'"');a.m="??"}else a.m=c;xf(a,b,c,d,!1,e)}else zf(a,!1)}function xf(a,b,c,d,e,f){var g=-1;if(a.i.toLowerCase()!=c.toLowerCase()||a.f!=d)g++,zf(a,!0),a.o.Ia?a.B("PC11 busy"):(e&&a.c++,Af(a,b,c,d,f)?g++:a.o.Ia=!0);g&&Bf(a,a.A,a.i,a.f,a.M,a.pa,a.oa)}
|
|
function Af(a,b,c,d,e){var f=c;if(e){var g=new FileReader;g.onload=function(){var e=g.result;e&&(e=new Uint8Array(e,0,e.byteLength),Bf(a,b,c,d,e),a.m="?");yf(a)};g.readAsArrayBuffer(e);return!0}0>c.indexOf("/api/v1/dump")&&(e=ka(c),f="json"==e||"gz"==e?encodeURI(c):ta()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!w(f,null,!0,function(e,f,g){var k=0>g&&a.l&&!a.l.o.R;g?a.B('Unable to load tape "'+b+'" (error '+g+": "+e+")",k):(Ta(a.Ba,e,f),(e=sa(e,f))&&Bf(a,b,c,d,e.M,e.pa,e.oa));
|
|
a.o.Ia=!1;a.c&&(a.c--,a.c||G(a));yf(a)})}function vf(a,b,c,d){if((a=a.j.listTapes)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}function yf(a){var b=a.j.listTapes;if(b&&b.options){a=a.m||a.i;for(var c=0;c<b.options.length;c++)if(b.options[c].value==a){b.selectedIndex!=c&&(b.selectedIndex=c);break}c==b.options.length&&(b.selectedIndex=0)}}
|
|
function tf(a,b){b|=0;if(b!==a.J){var c=a.j.readProgress;c&&(c=(c=F(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.J=b}}function Bf(a,b,c,d,e,f,g){a.A=b;a.i=c;a.f=d;a.M=e;a.pa=f;a.oa=g;2==d?a.L&&hf(a.L,e,f,g,null,!1)?a.status('Read tape "'+b+'"'):a.B('No valid memory address for tape "'+b+'"'):(a.u=0,a.s=e,a.status('Loaded tape "'+b+'"'),tf(a,0))}function zf(a,b){if(a.i||!1===b)a.A="",a.i="",b||(a.f&&a.status(1==a.f?"tape detached":"tape unloaded"),a.m=pf,a.f=qf,yf(a))}h.save=function(){return(new R(this)).data()};
|
|
h.restore=function(){return!0};h.nd=function(){return this.b&65534};h.le=function(a){a&1&&(this.b&32768?(a&=-2,this.b&64&&M(this.a,this.I)):(this.b&=-129,this.b|=2048,this.v=0,Yb(this.a,this.U,1E3/Math.round(this.S/10))));this.b=this.b&-66|a&65};h.md=function(){this.b&=-129;this.b|=2048;return this.v};h.ke=function(){};var Cf={},uf=(Cf[65384]=[null,null,gc.prototype.nd,gc.prototype.le,"PRS"],Cf[65386]=[null,null,gc.prototype.md,gc.prototype.ke,"PRB"],Cf);
|
|
function Df(a,b,c){z.call(this,"Disk",{id:a.Ba+".disk"+r(++Ef,4)},Df,8192);this.controller=a;this.l=a.l;this.G=a.G;this.f=b;this.ra=b.name;this.xb=b.xb;Ff(this,c,b.K,b.P,b.N,b.V);G(this)}var Ef=0;B(Df);h=Df.prototype;h.ia=function(a,b,c,d){this.G=d};
|
|
function Ff(a,b,c,d,e,f){a.mode=b;a.K=c;a.P=d;a.N=e;a.V=f;a.a=[];if("preload"!=a.mode){b=Array(a.K);for(c=0;c<b.length;c++){d=Array(a.P);for(e=0;e<d.length;e++){f=Array(a.N);for(var g=1;g<=f.length;g++)f[g-1]=Gf(null,c,e,g,a.V,0);d[e]=f}b[c]=d}a.a=b}a.b=null}
|
|
function Hf(a,b,c,d,e){var f=c;if(a.h)return!0;a.ra=b;a.ea=c;a.Qb=u(c);a.h=e;a.i=a.controller;if(d){var g=new FileReader;g.onload=function(){var b=g.result,c,d=b?b.byteLength:0,e=ia[d];if(e){a.K=e[0];a.P=e[1];a.N=e[2];a.V=e[3]||512;c=a.V>>2;var f=e=0,b=new DataView(b,0,d);a.a=Array(a.K);for(d=0;d<a.a.length;d++)for(var v=a.a[d]=Array(a.P),y=0;y<v.length;y++)for(var xa=v[y]=Array(a.N),ya=0;ya<xa.length;ya++){for(var Zb=Gf(null,d,y,ya+1,a.V,0),tg=Zb.data,qc=0;qc<c;qc++,f+=4)var ug=tg[qc]=b.getInt32(f,
|
|
!0),e=e+ug&-1;Zb.ha=c;xa[ya]=Zb}a.b=e;c=a}else a.B("Unrecognized disk format ("+d+" bytes)");a.h&&(a.h.call(a.controller,a.f,c,a.ra,a.ea),a.h=null)};g.readAsArrayBuffer(d);return!0}0>c.indexOf("/api/v1/dump")&&(b=ka(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):la(c,"/")&&(d="dir"),f=ta()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.xb?"":e)+"&format=json"));return!!w(f,
|
|
null,!0,function(b,c,d){If(a,b,c,d)})}
|
|
function If(a,b,c,d){var e=null;a.c=!1;var f=0>d&&a.l&&!a.l.o.R;if(d)a.controller.B('Unable to load disk "'+a.ra+'" (error '+d+": "+b+")",f);else{Ta(a.controller.Ba,b,c);try{if(0<u(a.Qb,!0).toLowerCase().indexOf("-readonly"))a.c=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.c=!0)}var k;"<"==c.substr(0,1)?k=["Missing disk image: "+a.ra]:k=0>c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+
|
|
c+")");if(k.length)if(1==k.length)x(k[0]);else{a.K=k.length;a.P=k[0].length;a.N=k[0][0].length;var l=k[0][0][0];a.V=l&&l.length||512;for(d=c=0;d<a.K;d++)for(f=0;f<a.P;f++)for(g=0;g<a.N;g++)if(l=k[d][f][g]){var m=l.length;void 0===m&&(m=l.length=512);var m=m>>2,p=l.pattern;void 0===p&&(p=l.pattern=0);var t=l.data;if(void 0===t){var v=l.bytes;if(void 0!==v&&v.length){for(var y=m<<2,xa=v.length;xa<y;xa++)v[xa]=p;Jf(l,v)}else t=[],p=l.pattern=p|p<<8|p<<16|p<<24,l.data=t;delete l.bytes}Gf(l,d,f);for(y=
|
|
0;y<t.length;y++)c=c+t[y]&-1}a.a=k;a.b=c;e=a}else x("Empty disk image: "+a.ra)}catch(ya){x("Disk image error ("+b+"): "+ya.message)}}a.h&&(a.h.call(a.i,a.f,e,a.ra,a.ea),a.h=null)}function Gf(a,b,c,d,e,f){a||(a={sector:d,length:e,data:[],pattern:f});a.Wf=b;a.Xf=c;a.ta=a.ha=0;a.wa=!1;return a}
|
|
h.seek=function(a,b,c,d,e){d=null;var f=this.f,g=this.a[a];if(g){var k=g[b];if(!k&&f.Dc&&b<f.P)for(k=g[b]=Array(f.$b),g=0;g<k.length;g++)k[g]=Gf(null,a,b,g+1,f.Mb,0);if(k){for(g=0;g<k.length;g++)if(k[g]&&k[g].sector==c){d=k[g];break}!d&&f.Dc&&9==f.Gb&&(d=k[g]=Gf(null,a,b,f.Gb,f.Mb,0))}}e&&e(d,!1);return d};function Jf(a,b){for(var c=0,d=a.length>>2,e=Array(d),f=0;f<d;f++)e[f]=b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24,c+=4;a.data=e}
|
|
h.read=function(a,b){var c=-1;if(a&&b<a.length)var c=a.data,d=b>>2,c=(d<c.length?c[d]:a.pattern)>>((b&3)<<3)&255;return c};h.write=function(a,b,c){if(this.c)return!1;if(b<a.length){if(c!=this.read(a,b,!0)){var d=a.data,e=a.pattern,f=b>>2;b=(b&3)<<3;for(var g=d.length;g<=f;g++)d[g]=e;a.ha?f<a.ta?(a.ha+=a.ta-f,a.ta=f):f>=a.ta+a.ha&&(a.ha+=f-(a.ta+a.ha)+1):(a.ta=f,a.ha=1);d[f]=d[f]&~(255<<b)|c<<b}return!0}return null};
|
|
function Kf(a,b){var c=a.P*a.N,d=b/c|0;return d<a.K?(b%=c,a.seek(d,b/a.N|0,b%a.N+1)):null}function Lf(a,b,c){for(var d=1,e=0,f=0;d--;){var g=a.read(b,c++);if(0>g)break;e|=g<<f;f+=8}return e}function Mf(a){for(var b="",c=0,d;d=Kf(a,c++);)for(var e=0,f=d.length;e<f;e++)b+=String.fromCharCode(Lf(a,d,e));return btoa(b)}
|
|
h.save=function(){var a=0,b=[];b[a++]=[this.ea,this.b,this.K,this.P,this.N,this.V];if(!this.c)for(var c=this.a,d=0;d<c.length;d++)for(var e=0;e<c[d].length;e++)for(var f=0;f<c[d][e].length;f++){var g=c[d][e][f];if(g&&g.ha){for(var k=[],l=0,m=g.ta,p=g.ta+g.ha;m<p;)k[l++]=g.data[m++];b[a++]=[d,e,f,g.ta,k]}}return b};
|
|
h.restore=function(a){var b=0,c="unsupported restore format";if(a&&0<a.length){var d=0,e=a[d++];e&&2<=e.length&&(!this.a.length&&6<=e.length?Ff(this,"local",e[2],e[3],e[4],e[5]):null!=e[1]&&null!=this.b&&e[1]!=this.b&&(c="original checksum ("+e[1]+") differs from current checksum ("+this.b+")",b=-2));for(this.a.length||(b=-1);d<a.length&&0<=b;){var f=0,g=a[d++],k=g[f++],l=g[f++],m=g[f++];if(k>=this.a.length||l>=this.a[k].length||m>=this.a[k][l].length){c="sector (CHS="+k+":"+l+":"+m+") out of range ("+
|
|
b+" changes applied)";b=-1;break}if(this.c){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(k=this.a[k][l][m]){for(l=k.data.length;l<e;)k.data[l++]=k.pattern;l=0;k.ta=e;for(k.ha=f.length;e<g;)k.data[e++]=f[l++];b++}}}0>b&&-2!=b&&this.controller.B("Unable to restore disk '"+this.ra+": "+c);return b};
|
|
h.toJSON=function(){var a;a=0;for(var b;b=Kf(this,a++);)Nf(b);a=JSON.stringify(this.a,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")};
|
|
function Nf(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}function P(a){z.call(this,"RK11",a,P,65536);this.v=Of(this,a.autoMount);this.m=0;this.c=Array(8);this.A=!Ba("Mobi")&&window&&"FileReader"in window}B(P);function Of(a,b){if(b&&"string"==typeof b)try{b=eval("("+b+")")}catch(c){x(a.type+" auto-mount error: "+c.message+" ("+b+")"),b=null}return b||{}}h=P.prototype;
|
|
h.ba=function(a,b,c){var d=this;switch(b){case "listDisks":return this.j[b]=c,c.onchange=function(){var a=d.j.descDisk,b=c.options&&c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(k){x("RK11 option error: "+k.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.j[b]=c,c.onchange=function(){var a=q(c.value);null!=a&&Pf(d,a)},
|
|
!0;case "loadDisk":return this.j[b]=c,c.onclick=function(){var a=d.j.listDisks;a&&a.options&&Qf(d,a.options[a.selectedIndex].text,a.value)},!0;case "bootDisk":return this.j[b]=c,c.onclick=function(){var a,b=d.j.listDrives,b=b&&q(b.value);null==b||0>b||b>=d.c.length||!(a=d.c[b])?d.B("Unable to boot the selected drive"):a.T?(Kc(d.a,0,!0),(a=d.Yb(a,0,0,0,512,0))&&d.B("Unable to read the boot sector ("+a+")")):d.B("Load a disk into the drive first")},!0;case "saveDisk":if(!this.A){c.parentNode.removeChild(c);
|
|
break}this.j[b]=c;c.onclick=function(){var a=d.j.listDrives;a&&a.options&&d.c&&((a=d.c[q(a.value)||0])?(a=a.T)?(a=Ca(Mf(a),a.Qb.replace(".json",".img")),x(a)):d.B("No disk loaded in drive."):d.B("No disk drive selected."))};return!0;case "mountDisk":if(this.A)return this.j[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Qf(d,u(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};
|
|
h.ia=function(a,b,c,d){this.l=a;this.h=b;this.a=c;this.G=d;if(a=Of(this,yc(this.l,"autoMount")))for(var e in a)e.substr(0,2)==this.type.substr(0,2)&&(this.v[e]=a[e]);Rf(this);this.Ua=$b(this.a,144,5,65536);fb(b,this,Sf);hb(b,this.reset.bind(this));Tf(this,"None","",!0);this.A&&Tf(this,"Local Disk","?");Tf(this,"Remote Disk","??");Uf(this)||G(this)};
|
|
h.ka=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.l.Lb){for(a=0;a<this.c.length;a++)Vf(this,a,!0);Uf(this,!0)}}else if(!this.restore(a))return!1;if(a=this.j.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;8>b;b++){var c=document.createElement("option");c.value=b;c.text="RK"+b;a.appendChild(c)}a.value="0";Pf(this,0)}}return!0};h.ja=function(a){return a?this.save():!0};h.reset=function(){Rf(this)};h.save=function(){return(new R(this)).data()};
|
|
h.restore=function(a){return Rf(this,a[0])};function Uf(a,b){b||(a.m=0);for(var c in a.v){var d=a.v[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.j.listDisks)&&f.options)for(var g=0;g<f.options.length;g++){var k=f.options[g];if(k.value==e){f=k.text;break a}}f=u(e,!0)}if(e&&f&&(g=-1,c&&(g=c.charCodeAt(c.length-1)-48,0>g||9<g)&&(g=-1),0<=g&&g<a.c.length)){!Wf(a,g,f,e,!0)&&b&&G(a,!1);continue}a.B("Incorrect auto-mount settings for drive "+c+" ("+JSON.stringify(d)+")")}return!!a.m}
|
|
function Qf(a,b,c,d){var e=a.j.listDrives,e=e&&q(e.value);if(void 0===e||0>e||e>=a.c.length)a.B("Unable to load the selected drive");else if(c)if("?"==c)a.B('Use "Choose File" and "Mount" to select and load a local disk.');else{if("??"==c){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=u(c);a.status("Attempting to load "+c+' as "'+b+'"')}Wf(a,e,b,c,!1,d)}else Vf(a,e)}
|
|
function Wf(a,b,c,d,e,f){var g=-1,k=a.c[b];k.ea.toLowerCase()!=d.toLowerCase()&&(g++,Vf(a,b,!0),k.Ka?a.B("RK11 busy"):(k.Ka=!0,e&&(k.Ja=!0,a.m++),k.xa=!!f,Hf(new Df(a,k,"preload"),c,d,f,a.vc)&&g++));return g}h.vc=function(a,b,c,d,e){a.Ka=!1;b&&(b.K>a.K||b.P>a.P)&&(this.B('Disk "'+c+'" too large for drive '+("RK"+a.La)),b=null);b?(a.T=b,a.ra=c,a.ea=d,this.B('Loaded disk "'+c+'" in drive '+("RK"+a.La),a.Ja||e),this.l&&Ec(this.l)):a.xa=!1;a.Ja&&(a.Ja=!1,--this.m||G(this));Pf(this,a.La)};
|
|
function Tf(a,b,c,d){if((a=a.j.listDisks)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
|
|
function Pf(a,b){if(0<=b&&b<a.c.length){var c=a.c[b],d=a.j.listDisks;a=a.j.listDrives;if(d&&a&&d.options&&a.options&&(a=q(a.value),c=c.xa?"?":c.ea,!isNaN(a)&&a==b)){for(b=0;b<d.options.length;b++)if(d.options[b].value==c){d.selectedIndex!=b&&(d.selectedIndex=b);break}b==d.options.length&&(d.selectedIndex=0)}}}function Vf(a,b,c){var d=a.c[b];if(d.T||!1===c)d.ra="",d.ea="",d.T=null,d.xa=!1,c||(a.B("Drive RK"+b+" unloaded",c),Pf(a,b))}
|
|
function Rf(a,b){var c=0;b||(b=[]);a.F=b[c++]||2496;a.i=b[c++]||0;a.b=b[c++]||128;a.u=b[c++]||0;a.s=b[c++]||0;a.f=b[c++]||0;a.C=b[c]||0;for(b=0;b<a.c.length;b++){var d=a.c[b];void 0===d&&(d=a.c[b]={});c=a;d.La=b;d.name=c.Aa;d.Ka=d.xa=!1;d.K=203;d.P=2;d.N=12;d.V=512;d.xb=!0;d.Ec=0;d.Cc=0;d.Gb=1;d.$b=d.N;d.Mb=d.V;d.Kc=0;d.Yd=null;d.T||(d.ea="");d.status=2368}return!0}
|
|
h.uc=function(a,b,c,d,e,f){this.s=f&65535;this.b=this.b&-49|f>>12&48;this.u=65536-e&65535;this.f=this.f&-16|d&15;a&&(this.i=this.i|a|32768,this.b|=49152);return!0};
|
|
h.Yb=function(a,b,c,d,e,f,g,k){var l=0;a=a.T;var m=null,p;a||(l=128,e=0);for(;e--;){if(!m){m=a.seek(b,c,d+1);if(!m){l=4096;break}p=0}var t,v;if(0>(t=a.read(m,p++))||0>(v=a.read(m,p++))){l=32;break}if(!g&&(vb(this.h,f,t|v<<8),Wb(this.h))){l=1024;break}f+=2;if(p>=a.V&&(m=null,++d>=a.N&&(d=0,++c>=a.P&&(c=0,++b>=a.K)))){l=64;break}}return k?k(l,b,c,d,e,f):l};
|
|
h.wc=function(a,b,c,d,e,f,g,k){var l=0;a=a.T;var m=null,p;a||(l=128,e=0);for(;e--;){var t=xb(this.h,f);if(Wb(this.h)){l=1024;break}f+=2;if(!m){m=a.seek(b,c,d+1,!0);if(!m){l=4096;break}p=0}if(g){var v,y;if(0>(v=a.read(m,p++))||0>(y=a.read(m,p++))){l=32;break}if(t!=(v|y<<8)){l=1;break}}else if(!a.write(m,p++,t&255)||!a.write(m,p++,t>>8)){l=32;break}if(p>=a.V&&(m=null,++d>=a.N&&(d=0,++c>=a.P&&(c=0,++b>=a.K)))){l=64;break}}return k?k(l,b,c,d,e,f):l};h.zd=function(){return this.F};h.xe=function(){};
|
|
h.Ad=function(){return this.i};h.ye=function(){};h.wd=function(){return this.b&61438};
|
|
h.ue=function(a){this.b=this.b&-3968|a&3967;if(this.b&1){a=!0;var b,c=(this.f&57344)>>13,d=this.c[c],e,f,g,k,l;this.b&=-129;var m=(this.b&14)>>1;switch(m){case 0:this.i=0;this.b=128;this.f=0;break;case 4:e=(this.f&8160)>>5;e>=d.K&&(this.i|=32832,this.b|=49152);break;case 5:case 2:b=this.Yb;case 3:case 1:b||(b=this.wc),e=(this.f&8160)>>5,f=(this.f&16)>>4,g=this.f&15,k=65536-this.u&65535,l=(this.b&48)<<12|this.s,e>=d.K?(this.i|=32832,this.b|=49152):g>=d.N?(this.i|=32800,this.b|=49152):a=b.call(this,
|
|
d,e,f,g,k,l,3<=m,this.uc.bind(this))}this.F=d.status|(d.T?128:0)|c<<13|this.f&15;a&&(this.b&=-2,this.b|=128,this.b&64&&M(this.a,this.Ua))}};h.Bd=function(){return this.u};h.ze=function(a){this.u=a};h.vd=function(){return this.s};h.te=function(a){this.s=a};h.xd=function(){return this.f};h.ve=function(a){this.f=a};h.yd=function(){return this.C};h.we=function(a){this.C=a};
|
|
var Xf={},Sf=(Xf[65280]=[null,null,P.prototype.zd,P.prototype.xe,"RKDS"],Xf[65282]=[null,null,P.prototype.Ad,P.prototype.ye,"RKER"],Xf[65284]=[null,null,P.prototype.wd,P.prototype.ue,"RKCS"],Xf[65286]=[null,null,P.prototype.Bd,P.prototype.ze,"RKWC"],Xf[65288]=[null,null,P.prototype.vd,P.prototype.te,"RKBA"],Xf[65290]=[null,null,P.prototype.xd,P.prototype.ve,"RKDA"],Xf[65294]=[null,null,P.prototype.yd,P.prototype.we,"RKDB"],Xf);
|
|
function O(a){z.call(this,"RL11",a,O,131072);this.A=Yf(this,a.autoMount);this.u=0;this.c=Array(4);this.C=!Ba("Mobi")&&window&&"FileReader"in window}B(O);function Yf(a,b){if(b&&"string"==typeof b)try{b=eval("("+b+")")}catch(c){x(a.type+" auto-mount error: "+c.message+" ("+b+")"),b=null}return b||{}}h=O.prototype;
|
|
h.ba=function(a,b,c){var d=this;switch(b){case "listDisks":return this.j[b]=c,c.onchange=function(){var a=d.j.descDisk,b=c.options&&c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(k){x("RL11 option error: "+k.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.j[b]=c,c.onchange=function(){var a=q(c.value);null!=a&&Zf(d,a)},
|
|
!0;case "loadDisk":return this.j[b]=c,c.onclick=function(){var a=d.j.listDisks;a&&a.options&&$f(d,a.options[a.selectedIndex].text,a.value)},!0;case "bootDisk":return this.j[b]=c,c.onclick=function(){var a,b=d.j.listDrives,b=b&&q(b.value);null==b||0>b||b>=d.c.length||!(a=d.c[b])?d.B("Unable to boot the selected drive"):a.T?(Kc(d.a,0,!0),(a=d.Zb(a,0,0,0,512,0))&&d.B("Unable to read the boot sector ("+a+")")):d.B("Load a disk into the drive first")},!0;case "saveDisk":if(!this.C){c.parentNode.removeChild(c);
|
|
break}this.j[b]=c;c.onclick=function(){var a=d.j.listDrives;a&&a.options&&d.c&&((a=d.c[q(a.value)||0])?(a=a.T)?(a=Ca(Mf(a),a.Qb.replace(".json",".img")),x(a)):d.B("No disk loaded in drive."):d.B("No disk drive selected."))};return!0;case "mountDisk":if(this.C)return this.j[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;$f(d,u(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};
|
|
h.ia=function(a,b,c,d){this.l=a;this.h=b;this.a=c;this.G=d;if(a=Yf(this,yc(this.l,"autoMount")))for(var e in a)e.substr(0,2)==this.type.substr(0,2)&&(this.A[e]=a[e]);ag(this);this.Ua=$b(this.a,112,5,131072);fb(b,this,bg);hb(b,this.reset.bind(this));cg(this,"None","",!0);this.C&&cg(this,"Local Disk","?");cg(this,"Remote Disk","??");dg(this)||G(this)};
|
|
h.ka=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.l.Lb){for(a=0;a<this.c.length;a++)eg(this,a,!0);dg(this,!0)}}else if(!this.restore(a))return!1;if(a=this.j.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;4>b;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";Zf(this,0)}}return!0};h.ja=function(a){return a?this.save():!0};h.reset=function(){ag(this)};h.save=function(){return(new R(this)).data()};
|
|
h.restore=function(a){return ag(this,a[0])};function dg(a,b){b||(a.u=0);for(var c in a.A){var d=a.A[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.j.listDisks)&&f.options)for(var g=0;g<f.options.length;g++){var k=f.options[g];if(k.value==e){f=k.text;break a}}f=u(e,!0)}if(e&&f&&(g=-1,c&&(g=c.charCodeAt(c.length-1)-48,0>g||9<g)&&(g=-1),0<=g&&g<a.c.length)){!fg(a,g,f,e,!0)&&b&&G(a,!1);continue}a.B("Incorrect auto-mount settings for drive "+c+" ("+JSON.stringify(d)+")")}return!!a.u}
|
|
function $f(a,b,c,d){var e=a.j.listDrives,e=e&&q(e.value);if(void 0===e||0>e||e>=a.c.length)a.B("Unable to load the selected drive");else if(c)if("?"==c)a.B('Use "Choose File" and "Mount" to select and load a local disk.');else{if("??"==c){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=u(c);a.status("Attempting to load "+c+' as "'+b+'"')}fg(a,e,b,c,!1,d)}else eg(a,e)}
|
|
function fg(a,b,c,d,e,f){var g=-1,k=a.c[b];k.ea.toLowerCase()!=d.toLowerCase()&&(g++,eg(a,b,!0),k.Ka?a.B("RL11 busy"):(k.Ka=!0,e&&(k.Ja=!0,a.u++),k.xa=!!f,Hf(new Df(a,k,"preload"),c,d,f,a.yc)&&g++));return g}h.yc=function(a,b,c,d,e){a.Ka=!1;b&&(b.K>a.K||b.P>a.P)&&(this.B('Disk "'+c+'" too large for drive '+("RL"+a.La)),b=null);b?(a.T=b,a.ra=c,a.ea=d,this.B('Loaded disk "'+c+'" in drive '+("RL"+a.La),a.Ja||e),this.l&&Ec(this.l)):a.xa=!1;a.Ja&&(a.Ja=!1,--this.u||G(this));Zf(this,a.La)};
|
|
function cg(a,b,c,d){if((a=a.j.listDisks)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
|
|
function Zf(a,b){if(0<=b&&b<a.c.length){var c=a.c[b],d=a.j.listDisks;a=a.j.listDrives;if(d&&a&&d.options&&a.options&&(a=q(a.value),c=c.xa?"?":c.ea,!isNaN(a)&&a==b)){for(b=0;b<d.options.length;b++)if(d.options[b].value==c){d.selectedIndex!=b&&(d.selectedIndex=b);break}b==d.options.length&&(d.selectedIndex=0)}}}function eg(a,b,c){var d=a.c[b];if(d.T||!1===c)d.ra="",d.ea="",d.T=null,d.xa=!1,c||(a.B("Drive RL"+b+" unloaded",c),Zf(a,b))}
|
|
function ag(a,b){var c=0;b||(b=[]);a.b=b[c++]||129;a.v=b[c++]||0;a.f=b[c++]||0;a.i=b[c++]||0;a.s=b[c++]||0;a.m=b[c]||0;for(b=0;b<a.c.length;b++){var d=a.c[b];void 0===d&&(d=a.c[b]={});c=a;d.La=b;d.name=c.Aa;d.Ka=d.xa=!1;d.K=512;d.P=2;d.N=40;d.V=256;d.xb=!0;d.Ec=0;d.Cc=0;d.Gb=1;d.$b=d.N;d.Mb=d.V;d.Kc=0;d.Yd=null;d.T||(d.ea="");d.status=29}return!0}
|
|
h.xc=function(a,b,c,d,e,f){this.v=f&65535;this.b=this.b&-49|f>>12&48;this.m=f>>16&63;this.i=this.f=b<<7|(c?64:0)|d&63;this.s=65536-e&65535;a&&(this.b=this.b|a|32768);return!0};
|
|
h.Zb=function(a,b,c,d,e,f,g){var k=0;a=a.T;var l=null,m;a||(k=5120,e=0);for(;e--;){if(!l){l=a.seek(b,c,d+1);if(!l){k=5120;break}m=0}var p,t;if(0>(p=a.read(l,m++))||0>(t=a.read(l,m++))){k=5120;break}vb(this.h,Uc(this.a,f),p|t<<8);if(Wb(this.h)){k=8192;break}f+=2;if(m>=a.V&&(l=null,++d>=a.N&&(d=0,++c>=a.P&&(c=0,++b>=a.K)))){k=5120;break}}return g?g(k,b,c,d,e,f):k};
|
|
h.zc=function(a,b,c,d,e,f,g){var k=0;a=a.T;var l=null,m;a||(k=5120,e=0);for(;e--;){var p=xb(this.h,Uc(this.a,f));if(Wb(this.h)){k=8192;break}f+=2;if(!l){l=a.seek(b,c,d+1,!0);if(!l){k=5120;break}m=0}if(!a.write(l,m++,p&255)||!a.write(l,m++,p>>8)){k=5120;break}if(m>=a.V&&(l=null,++d>=a.N&&(d=0,++c>=a.P&&(c=0,++b>=a.K)))){k=5120;break}}return g?g(k,b,c,d,e,f):k};h.Ed=function(){return this.b&65535};
|
|
h.Ce=function(a){this.b=this.b&-1023|a&1022;this.m=this.m&60|(a&48)>>4;if(!(this.b&128)){a=!0;var b,c=this.c[(this.b&768)>>8],d=c.T,e,f,g;this.b&=-2;switch(this.b&14){case 4:this.s&8&&(this.b&=63);this.s=c.status|this.i&64|(d&&512==d.K?128:0);break;case 6:1==(this.f&3)&&(b=this.f&65408,c=(this.f&16)<<2,this.i=this.f&4?this.i+b:this.i-b,this.f=this.i=this.i&65408|c);break;case 8:this.s=this.i;break;case 12:b=this.Zb;case 10:b||(b=this.zc),e=this.f>>7,f=this.f&64?1:0,g=this.f&63,!d||e>=d.K||g>=d.N?
|
|
this.b|=37888:(a=65536-this.s&65535,d=(this.m&63)<<16|this.v,a=b.call(this,c,e,f,g,a,d,this.xc.bind(this)))}a&&(this.b|=129,this.b&64&&M(this.a,this.Ua))}};h.Cd=function(){return this.v};h.Ae=function(a){this.v=a&65534};h.Fd=function(){return this.f};h.De=function(a){this.f=a};h.Gd=function(){return this.s};h.Ee=function(a){this.s=a};h.Dd=function(){return this.m};h.Be=function(a){this.m=a&63;this.b=this.b&-49|(this.m&3)<<4};
|
|
var gg={},bg=(gg[63744]=[null,null,O.prototype.Ed,O.prototype.Ce,"RLCS"],gg[63746]=[null,null,O.prototype.Cd,O.prototype.Ae,"RLBA"],gg[63748]=[null,null,O.prototype.Fd,O.prototype.De,"RLDA"],gg[63750]=[null,null,O.prototype.Gd,O.prototype.Ee,"RLMP"],gg[63752]=[null,null,O.prototype.Dd,O.prototype.Be,"RLBE"],gg);
|
|
function hg(a,b,c){z.call(this,"Computer",a,hg,33554432);this.o.R=!1;ig(this,b);this.A=yc(this,"autoPower",a);this.l=0;this.L=a.busWidth||a.buswidth;this.b=jg;this.s=null;this.i=this.I=!1;this.S=yc(this,"url")||"";(Math.random()+.1).toString(36);this.c=kg(this);if(this.a=Va("CPU",this.id)){this.G=Va("Debugger",this.id);this.h=new Bb({id:this.Ba+".bus",busWidth:this.L},this.a,this.G);var d,e=C(this.id);if((this.u=Va("Panel",this.id))&&this.u.kb)for(b=0;b<e.length;b++)d=e[b],d.B=this.u.B,d.W=this.u.W,
|
|
d.kb=this.u.kb;this.W("PDPjs v1.30.6\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.W("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.ia&&d.ia(this,this.h,this.a,this.G);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.m=d:this.b=parseInt(d,10));var f;if(a=yc(this,"state")||(f=!0,a.state))b=this.C=a,f||(this.i=!0,this.b=jg),this.b&&(this.v=
|
|
new R(this,"1.30.6"),lg(this.v)?b=null:delete this.v);!b&&this.b&&(b=mg(this))&&(this.i=!0);if(b){var g=this;w(b,null,!0,function(a,b,c){c?(g.m=null,g.i=!1,g.B("Unable to load machine state from server (error "+c+(b?": "+oa(b):"")+")")):(g.s=b,g.I=!0);G(g)})}else G(this);this.j.power||(this.A=!0);!c&&this.A&&ng(this,this.lb)}else x("Unable to find CPU component")}B(hg);var jg=0;
|
|
function ig(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){x(d.message+" ("+c+")")}}a.J=b}function yc(a,b,c){var d=b.toLowerCase(),d=Na[b]||Na[d];void 0===d&&a.J&&(d=a.J[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function ng(a,b,c){for(var d=C(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!Xa(f)){Xa(f,function(){ng(a,b,c)});return}}b.call(a,c)}
|
|
function og(a,b){var c=new R(a,"1.30.6","validate");if(lg(c)&&pg(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.B("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}h=hg.prototype;
|
|
h.lb=function(a){void 0===a&&(a=this.b||(this.s?1:jg));if(!this.l){this.l++;var b=!1,c=!1;this.F=!1;var d=this.v||new R(this,"1.30.6");if(-1==a)b=!0;else if(a>jg){if(lg(d,this.s)){this.f=new R(this,"1.30.6","failsafe");lg(this.f)&&(qg(this,d),a=2,rg(this.f));this.f.set("timestamp",ra());sg(this.f);var e=this.b&&!this.i;if(1==a||ua("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=pg(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?lg(d,g):("error"==
|
|
f&&"no machine state"!=g?(this.B("Error: "+g),"unable to verify user"==g&&(Aa("user",""),this.c=null)):this.W(f+": "+g),rg(d),lg(d)?(c=pg(d),e=!0):c=!1))}e&&og(this,c?d:null)}else 2==a&&d.clear()}else og(this);delete this.s;delete this.v}e=C(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.a&&(c=vg(this,g,d,b,c));b=[d,a,c];-1!=a?ng(this,this.ac,b):this.ac(b)}};
|
|
function vg(a,b,c,d,e){if(!b.o.R){b.o.R=!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&&(x("Unable to restore state for "+b.type),a.C&&!a.I?(c.clear(),a.b=jg,window&&window.location.reload()):a.F=!0,b.ka(null),e=!1)}if(!d&&b.cc)for(a=b.cc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
|
|
h.ac=function(a){var b=a[0],c=0>a[1];a=a[2];this.U=!0;this.o.R=!0;var d=this.j.power;d&&(d.textContent="Shutdown");this.a&&(vg(this,this.a,b,c,a),this.za(),this.a.Ta());this.F&&(qg(this,b),b.clear());!c&&this.f&&(this.f.clear(),delete this.f);this.l=0};
|
|
function qg(a,b){if(ua("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.c||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.6"};d.url=a.S;d.user=c;d.type="bug";d.data=b;w("http://www.pcjs.org/api/v1/report",d,!0)}}
|
|
function wg(a,b,c){var d,e="none";if(a.l)return null;a.l--;var f=new R(a,"1.30.6"),g=new R(a,"1.30.6","validate"),k=ra();g.set("timestamp",k);f.set("timestamp",k);f.set("version","1.30.6");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.a&&a.a.ja&&(c&&H(a.a),d=a.a.ja(b,c),"object"===typeof d&&f.set(a.a.id,d),c&&(a.a.o.R=!1,!1===d&&(e=null)));for(var k=C(a.id),l=0;l<k.length;l++){var m=k[l];m.o.R&&(m.ja&&(d=m.ja(b,c),"object"===typeof d&&f.set(m.id,
|
|
d)),c&&(m.o.R=!1,!1===d&&(e=null)))}e&&(c?(k=d=!1,b?(a.c&&xg(a,a.c,f.toString()),sg(g)&&sg(f)||(e=null,d=k=!0)):a.b&&(d=!0,k=3==a.b),d&&f.clear(k)):e=f.toString());c&&(a.o.R=!1,b=a.j.power)&&(b.textContent="Power");a.l=0;return e}h.reset=function(){this.h&&this.h.reset&&this.h.reset();this.a&&this.a.reset&&this.a.reset();for(var a=C(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.h&&c!==this.a&&c.reset&&c.reset()}this.za(-1)};
|
|
h.start=function(a,b){for(var c=C(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.za(-1)};h.stop=function(a,b){for(var c=C(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.za(-1)};
|
|
h.za=function(a){if(this.a){var b=this.a,c=a||0,d=b.j.speed;d&&(0>=c||30<=(b.Eb+=c))&&(d.textContent=b.o.O?b.Ma.toFixed(2)+"Mhz":"Stopped",b.Eb=0)}if(this.u&&(b=this.u,a=a||0,b.u)){c=b.a.o.O;d=!!(b.a.w&8);if(0>=a||60<=(b.s+=a)){for(var e=0;e<b.a.g.length;e++)nb(b,"R"+e,b.a.g[e]);e=ec(b.a);nb(b,"PS",e);nb(b,"NF",e&8?1:0,1);nb(b,"ZF",e&4?1:0,1);nb(b,"VF",e&2?1:0,1);nb(b,"CF",e&1?1:0,1);b.s=0}yb(b,0<a&&c&&!d?b.a.Sa:b.la);ub(b,b.m);a=b.a;a=a.Oa?a.ya&16?1:2:4;zb(b,"B22",a&1);zb(b,"B18",a&2);zb(b,"B16",
|
|
a&4)}};
|
|
h.ba=function(a,b,c){var d=this;switch(b){case "power":return this.j[b]=c,c.onclick=function(){d.l||(d.o.R?wg(d,!1,!0):ng(d,d.lb))},!0;case "reset":return this.j[b]=c,c.onclick=function(){if(d.o.R&&!d.l)if(d.b&&!d.m){var a=ua("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");wg(d,a,!0);!a&&d.C?window&&window.location.reload():(a||(d.Lb=!0),d.lb(jg),d.Lb=!1)}else d.reset(),d.a&&d.a.Ta()},!0;case "save":if(la(ta(),"pcjs.org"))c.parentNode.removeChild(c);else return this.j[b]=
|
|
c,c.onclick=function(){var a=kg(d,!0);if(a){var b=!!(d.b&&!d.m||d.C),c=wg(d,b);b?xg(d,a,c):d.B("Resume disabled, machine state not saved")}},!0}return!1};
|
|
function kg(a,b){var c=a.c;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=yg(a,c))||a.B("The user ID is invalid.")):b&&a.B("Browser local storage is not available"));return c}
|
|
function yg(a,b){a.c=null;b=w(ta()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Aa("user",b.data),a.c=b.data)}catch(d){x(d.message+" ("+c+")")}return a.c}function mg(a){var b=null;a.c&&(b=ta()+"/api/v1/user?req=load&user="+a.c+"&state="+zg(a,"1.30.6"));return b}
|
|
function xg(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=zg(a,"1.30.6");d.data=c;b=w(ta()+"/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.B("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.B(c),Aa("user",""),a.c=null)}}
|
|
function sf(a){var b;a=C(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}function Ec(a){if(a.kb){var b=0,c=0;window&&(b=window.scrollX,c=window.scrollY);a.kb.focus();window&&window.scrollTo(b,c)}}Ia(function(){for(var a=F(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=D(c),c=F(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=D(f),g=new hg(g,d,!0);E(g,f);g.A&&ng(g,g.lb)}});
|
|
Da.show.push(function(){for(var a=F(document,"pdp11","computer"),b=0;b<a.length;b++){var c=D(a[b]);(c=Va("Computer",c.id))&&c.U&&!c.o.R&&c.lb(-1)}});Da.exit.push(function(){for(var a=F(document,"pdp11","computer"),b=0;b<a.length;b++){var c=D(a[b]);(c=Va("Computer",c.id))&&c.o.R&&wg(c,!(!c.b||c.m),!0)}});function R(a,b,c){this.id=a.id;this.key=zg(a,b,c);this.G=a.G;rg(this,a.Oc)}function zg(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}
|
|
R.prototype={constructor:R,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){rg(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 rg(a,b){a[a.id]={};b&&a.set("parms",b);a.a=!1}function sg(a){var b=!0;if(wa()){var c=JSON.stringify(a[a.id]);Aa(a.key,c)||(x("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function pg(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){x(c.message||c),b=!1}return b}function lg(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:wa()&&(b=za(a.key))?(a[a.id]=b,a.a=!0):!1}var Ag=0;
|
|
function Bg(a,b,c,d,e,f){e("Loading "+a+"...");w(a,null,!0,function(g,k,l){l?(k||(k="unable to load "+a+" ("+l+")"),f(k,null)):Cg(k,a,b,c,d,e,f)})}
|
|
function Cg(a,b,c,d,e,f,g){function k(a,f){if(f)g(f,null);else{c&&(Ta(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?Dg(a,f,k):k(a,null):g("no data"+(b?" for file: "+b:""),null)}
|
|
function Dg(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");w(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 l=k[0],m,p=/( [a-z]+=)(['"])(.*?)\2/g;m=p.exec(f);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);k[0]!=l&&(g=g.replace(k[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
|
|
"");a=a.replace(d[0],g);Dg(a,b,c)}})}else c(a,null)}
|
|
function Eg(a,b,c,d){function e(a){if(void 0===k){var b=g&&F(g,"machine-warning");k=b&&b[0]||g}k&&(k.innerHTML=na(a))}function f(a){e("Error: "+a);l&&(--Ag||Ka(!0));l=!1}var g,k,l=!0;Ag++;Sa[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css";t.styleSheet?t.styleSheet.cssText=m:t.appendChild(document.createTextNode(m));p.appendChild(t)}c||
|
|
(c="/versions/pdpjs/1.30.6/components.xsl");m=function(d,k){k?Bg(c,null,null,!1,e,function(d,l){l?(Ta(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=k.transformNode(l))?(g.outerHTML=l,--Ag||Ka(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(l),(l=d.transformToFragment(k,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--Ag||Ka(!0)):f("invalid machine element: "+
|
|
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?Bg(b,a,d,!0,e,m):Cg(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(v){f(v.message)}return l}window.embedPDP11=function(a,b,c,d){Ka(!1);return Eg(a,b,c,d)};window.enableEvents=Ka;window.sendEvent=La;})();//# sourceMappingURL=/tmp/pdpjs/1.30.6/pdp11.map
|