diff --git a/modules/pdp11/lib/computer.js b/modules/pdp11/lib/computer.js index 88ba03876..57005c32c 100644 --- a/modules/pdp11/lib/computer.js +++ b/modules/pdp11/lib/computer.js @@ -126,14 +126,14 @@ class ComputerPDP11 extends Component { */ this.nBusWidth = +parmsComputer['busWidth'] || +parmsComputer['buswidth']; - this.resume = ComputerPDP11.RESUME_NONE; + this.sResumePath = this.sStatePath = null; this.sStateData = null; this.fStateData = false; // remembers if sStateData was loaded this.fServerState = false; + this.stateComputer = this.stateFailSafe = null; this.fInitialized = this.fReload = this.fRestoreError = false; - this.stateFailSafe = null; - this.url = this.getMachineParm('url') || ""; + this.url = /** @type {string} */ (this.getMachineParm('url') || ""); /* * Generate a random number x (where 0 <= x < 1), add 0.1 so that it's guaranteed to be @@ -143,7 +143,7 @@ class ComputerPDP11 extends Component { this.sUserID = this.queryUserID(); /* - * Find the appropriate CPU (and Debugger and Control Panel, if any) + * Find the appropriate CPU (and Debugger and Control Panel, if any). * * CLOSURE COMPILER TIP: To override the type of a right-hand expression (as we need to do here, * where we know getComponentByType() will only return an CPUState object or null), wrap the expression @@ -196,20 +196,7 @@ class ComputerPDP11 extends Component { if (component.initBus) component.initBus(this, this.bus, this.cpu, this.dbg); } - var sStatePath = null; - var sResume = parmsComputer['resume']; - if (sResume !== undefined) { - /* - * DEPRECATE: This goofiness is a holdover from when the 'resume' property was a string (either a - * single-digit string or a path); now it's always a number, so it never has a 'length' property and - * the call to parseInt() is unnecessary. - */ - if (sResume.length > 1) { - sStatePath = this.sResumePath = sResume; - } else { - this.resume = parseInt(sResume, 10); - } - } + this.resume = /** @type {number} */ (this.getMachineParm('resume', parmsComputer, Str.TYPES.NUMBER, ComputerPDP11.RESUME_NONE)); /* * The Computer 'state' property allows a state file to be specified independent of the 'resume' feature; @@ -225,11 +212,11 @@ class ComputerPDP11 extends Component { * OVERRIDES everything; it overrides any 'state' Computer parameter AND it disables resume of any saved state in * localStorage (in other words, it prevents fAllowResume from being true, and forcing resume off). */ - var fAllowResume; + var fAllowResume, sStatePath = null; var sState = this.getMachineParm('state') || (fAllowResume = true) && parmsComputer['state']; if (sState) { - sStatePath = this.sStatePath = sState; + this.sStatePath = sStatePath = sState; if (!fAllowResume) { this.fServerState = true; this.resume = ComputerPDP11.RESUME_NONE; @@ -303,21 +290,26 @@ class ComputerPDP11 extends Component { } /** - * getMachineParm(sParm, parmsComponent, type) + * getMachineParm(sParm, parmsComponent, type, defaultValue) * - * If the machine parameter doesn't exist, we check for a matching component parameter (if parmsComponent is provided), - * and failing that, we check the bundled resources (if any). + * If the machine parameter doesn't exist, we check for a matching component parameter + * (if parmsComponent is provided), and failing that, we check the bundled resources (if any). * - * At the moment, the only bundled resource request we expect to encounter is 'state'; if it exists, then we return - * 'state' back to the caller (ie, the name of the resource), so that the caller will then attempt to load the 'state' - * resource to obtain the actual state. + * At the moment, the only bundled resource request we expect to encounter is 'state'; if it exists, + * then we return 'state' back to the caller (ie, the name of the resource), so that the caller will + * then attempt to load the 'state' resource to obtain the actual state. + * + * TODO: It would be nice if we could tell the Closure Compiler that when a specific type parameter + * (eg, Str.TYPES.NUMBER) is used, the return value will be that type; unfortunately, every caller + * must coerce their own return value. * * @param {string} sParm * @param {Object|null} [parmsComponent] * @param {number} [type] (from Str.TYPES) - * @return {string|undefined} + * @param {*} [defaultValue] + * @return {*} */ - getMachineParm(sParm, parmsComponent, type) + getMachineParm(sParm, parmsComponent, type, defaultValue) { /* * When checking parmsURL, the check is allowed be a bit looser, because URL parameters are @@ -327,20 +319,15 @@ class ComputerPDP11 extends Component { */ var sParmLC = sParm.toLowerCase(); var value = Web.getURLParm(sParm) || Web.getURLParm(sParmLC); - - if (value === undefined && this.parmsMachine) { - value = this.parmsMachine[sParm]; - } - if (value === undefined && parmsComponent) { - value = parmsComponent[sParm]; - } - if (value === undefined && typeof resources == 'object' && resources[sParm]) { - value = sParm; - } + if (value === undefined && this.parmsMachine) value = this.parmsMachine[sParm]; + if (value === undefined && parmsComponent) value = parmsComponent[sParm]; + if (value === undefined && typeof resources == 'object' && resources[sParm]) value = sParm; + if (value === undefined) value = defaultValue; if (typeof value == "string" && type) { switch(type) { case Str.TYPES.NUMBER: value = +value; + if (isNaN(value)) value = defaultValue || 0; break; case Str.TYPES.BOOLEAN: value = (value == "true"); diff --git a/modules/pdp11/lib/debugger.js b/modules/pdp11/lib/debugger.js index 462484fa3..6f8d29115 100644 --- a/modules/pdp11/lib/debugger.js +++ b/modules/pdp11/lib/debugger.js @@ -301,7 +301,7 @@ class DebuggerPDP11 extends Debugger { /* * Re-initialize Debugger message support if necessary */ - var sMessages = cmp.getMachineParm('messages'); + var sMessages = /** @type {string|undefined} */ (cmp.getMachineParm('messages')); if (sMessages) this.messageInit(sMessages); if (this.cpu.model < PDP11.MODEL_1140) { diff --git a/versions/pdpjs/1.32.0/pdp11-dbg.js b/versions/pdpjs/1.32.0/pdp11-dbg.js index 2a38737d7..18d058b63 100644 --- a/versions/pdpjs/1.32.0/pdp11-dbg.js +++ b/versions/pdpjs/1.32.0/pdp11-dbg.js @@ -41,7 +41,7 @@ var qa={163840:[40,1,8,,254],184320:[40,1,9,,252],327680:[40,2,8,,255],368640:[4 function ta(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),e=0>=1,f--;return d}function q(a,b,c){var d="";b?11>=3;return(c?"0o":"")+d} function va(a){var b=2,c="";b?10=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}function w(a){return v(a,4,!0)} -function x(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0"']/g,function(a){return Aa[a]})}function Ba(a,b){return(a+" ").slice(0,b)} +function x(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0"']/g,function(a){return Aa[a]})}function Ba(a,b){return(a+" ").slice(0,b)} function Ca(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var Aa={"&":"&","<":"<",">":">",'"':""","'":"'"},Da={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",10:"LF",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"}; function Ea(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a>1,k;k=c(b,a[g]);0a?"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 La(a,b,c,d){c=void 0===c?!1:c;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, @@ -179,11 +179,11 @@ a);this.hb(a<<8);this.b-=this.v?4:3+(7==this.j?2:0)}],fh=[function(a){lf(this,a, var kh=[function(a){lh[a>>8&15].call(this,a)},Bg,pg,Zf,Vf,Xf,Qf,function(a){mh[a>>8&15].call(this,a)},function(a){nh[a>>8&15].call(this,a)},Cg,qg,$f,Wf,Yf,Lg,U],lh=[function(a){oh[a>>4&15].call(this,a)},lg,ig,ag,bg,gg,cg,eg,zg,zg,Rg,Tg,Vg,function(a){ph[a>>6&3].call(this,a)},U,U],ph=[function(a){a=this.g[7]+((a&63)<<1)&65535;var b=this.ka(a|this.Ga);se(this,this.g[5]);this.g[6]=a+2&65535;this.g[5]=b;this.b-=8},function(a){a=Je(this,a,0);this.Ba(a);Ce(this,a);this.b-=11},function(a){var b=Ee(this); this.ga=this.b;this.Ba(b);Ke(this,a,0,b);this.b=this.ga-Dg[this.v]},function(a){nf(this,a,we(this)?65535:0,this.Ba);this.b-=this.v?9:3+(7==this.j?2:0)}],oh=[function(a){qh[a&15].call(this,a)},U,U,U,xg,xg,xg,xg,Hg,function(a){!(a&8)||1145>this.ba?U.call(this,a):(this.w&49152||(this.w=this.w&-225|(a&7)<<5,this.i|=1,this.i&=-3),this.b-=5)},Xg,Zg,Mg,Mg,Mg,Mg],qh=[tg,Og,function(){De(this);this.i|=this.w&16;this.b-=13},kg,vg,Gg,Ig,function(){this.la(8,0,-9)},U,U,U,U,U,U,U,U],mh=[Eg,Eg,rg,rg,Rf,Rf,Sf,Sf, Pg,Pg,U,U,U,U,Kg,Kg],nh=[jg,hg,dg,fg,mg,ng,Tf,Uf,sg,Ng,ah,ch,eh,function(a){1145>this.ba?U.call(this,a):rh[a>>6&3].call(this,a)},U,U],rh=[U,function(a){a=Je(this,a,65536);this.Ba(a);Ce(this,a);this.b-=11},function(a){var b=Ee(this);this.ga=this.b;this.Ba(b);Ke(this,a,65536,b);this.b=this.ga-Dg[this.v]},U]; -function sh(a){A.call(this,"ROM",a,0,128);this.ea=this.g=null;this.v=+a.addr;this.b=+a.size;this.w=!1;this.i=a.alias;"string"==typeof this.i&&(this.i=eval(this.i));this.j=a.file;this.B=x(this.j);if(this.j){a=this.j;var b=xa(this.B);"json"!=b&&"hex"!=b&&(a=Na()+"/api/v1/dump?file="+this.j+"&format=bytes&decimal=true");var c=this;La(a,null,!0,function(a,b,f){f?(c.O("Unable to load ROM resource (error "+f+": "+a+")"),c.j=null):(sb(c.lb,a,b),(a=Ma(a,b))?(c.g=a.ca,c.ea=a.ea):c.j=null);th(c)})}}p(sh,A); +function sh(a){A.call(this,"ROM",a,0,128);this.ea=this.g=null;this.v=+a.addr;this.b=+a.size;this.w=!1;this.i=a.alias;"string"==typeof this.i&&(this.i=eval(this.i));this.j=a.file;this.B=x(this.j);if(this.j){a=this.j;var b=wa(this.B);"json"!=b&&"hex"!=b&&(a=Na()+"/api/v1/dump?file="+this.j+"&format=bytes&decimal=true");var c=this;La(a,null,!0,function(a,b,f){f?(c.O("Unable to load ROM resource (error "+f+": "+a+")"),c.j=null):(sb(c.lb,a,b),(a=Ma(a,b))?(c.g=a.ca,c.ea=a.ea):c.j=null);th(c)})}}p(sh,A); h=sh.prototype;h.ta=function(a,b,c,d){this.D=b;this.f=c;this.F=d;th(this)};h.za=function(){this.ea&&(this.F&&uh(this.F,this.id,this.v,this.b,this.ea),delete this.ea);return!0};h.ya=function(){return!0}; function th(a){if(!Bb(a)){if(a.j){if(!a.g||!a.D)return;a.b||(a.b=a.g.length);if(a.g.length!=a.b)zb(a,"ROM size ("+v(a.g.length,8,!0)+") does not match specified size ("+v(a.b,8,!0)+")");else{var b;a:{b=a.v;a.status(a.b+"-byte ROM at "+q(b));if(57344<=b&&b<57344+Nc){var c={};b=(c[b]=[sh.prototype.Me,sh.prototype.Wf,null,null,null,a.b>>1],c);if(Xb(a.D,a,b)){b=a.w=!0;break a}}else if(Tc(a.D,b,a.b,Jd)){for(c=0;c>>f.g;0>>=f.g;0>>a.g;0c.indexOf("/api/v1/dump")&&(e=xa(c),f="json"==e||"gz"==e?encodeURI(c):Na()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!La(f,null,!0,function(e,f,g){var k=0>g&&!!a.J&&!a.J.A.fa;g?a.O('Unable to load tape "'+b+'" (error '+g+": "+e+")",k):(sb(a.lb,e,f),(e=Ma(e,f))&&Wh(a,b,c,d,e.ca,e.wa, +function Vh(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),Wh(a,b,c,d,e),a.v=Ph);Th(a)};g.readAsArrayBuffer(e);return!0}0>c.indexOf("/api/v1/dump")&&(e=wa(c),f="json"==e||"gz"==e?encodeURI(c):Na()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!La(f,null,!0,function(e,f,g){var k=0>g&&!!a.J&&!a.J.A.fa;g?a.O('Unable to load tape "'+b+'" (error '+g+": "+e+")",k):(sb(a.lb,e,f),(e=Ma(e,f))&&Wh(a,b,c,d,e.ca,e.wa, e.va));a.A.eb=!1;a.g&&(a.g--,a.g||G(a));Th(a)})}function Oh(a,b,c,d){if((a=a.C.listTapes)&&a.options){for(var e=0;e>2;var f=e=0,b=new DataView(b,0,d);a.b=Array(a.X);for(d=0;dc.indexOf("/api/v1/dump")&&(b=xa(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"):ya(c,"/")&&(d="dir"),f=Na()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.cc?"":e)+"&format=json"));return!!La(f,null, +e=e+W&-1;C.Ja=c;D[z]=C}a.i=e;c=a}else a.O("Unrecognized disk format ("+d+" bytes)");a.g&&(a.g.call(a.controller,a.v,c,a.Na,a.Aa),a.g=null)};g.readAsArrayBuffer(d);return!0}0>c.indexOf("/api/v1/dump")&&(b=wa(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"):ya(c,"/")&&(d="dir"),f=Na()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.cc?"":e)+"&format=json"));return!!La(f,null, !0,function(b,c,d){di(a,b,c,d)})} function di(a,b,c,d){var e=null,f=0>d&&!!a.J&&!a.J.A.fa;a.j=!1;if(d)a.controller.O('Unable to load disk "'+a.Na+'" (error '+d+": "+b+")",f);else{sb(a.controller.lb,b,c);try{if(0g&&0c.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)y(k[0]);else{a.X=k.length;a.da=k[0].length;a.aa=k[0][0].length;var l=k[0][0][0];a.pa=l&&l.length||512;for(d=c=0;d>2,n=l.pattern;void 0===n&&(n=l.pattern=0);var r=l.data;if(void 0===r){var u=l.bytes;if(void 0!==u&&u.length){for(var t=m<<2,D=u.length;Db||b>=d.i.length||!(a=d.i[b])?d.O("Unable to boot the selected drive"):a.ia?(re(d.f,0,!0),(a=d.Vc(a,0,0,0,512,0,2))&&d.O("Unable to read the boot sector ("+a+")")):d.O("Load a disk into the drive first")},!0;case "saveDisk":if(!this.H){c.parentNode.removeChild(c); break}this.C[b]=c;c.onclick=function(){var a=d.C.listDrives;a&&a.options&&d.i&&((a=d.i[ta(a.value,10)||0])?(a=a.ia)?(a=$a(hi(a),a.gc.replace(".json",".img")),Oa(a)):d.O("No disk loaded in drive."):d.O("No disk drive selected."))};return!0;case "mountDisk":if(this.H)return this.C[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;Fi(d,x(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1}; h.ta=function(a,b,c,d){this.J=a;this.D=b;this.f=c;this.F=d;if(a=ji(this,$d(this.J,"autoMount")))for(var e in a)e.substr(0,2)==this.type.substr(0,2)&&(this.G[e]=a[e]);Gi(this);this.fb=kd(this.f,144,5,65536);Xb(b,this,Hi);Zb(b,this.reset.bind(this));Ii(this,"None",Ji,!0);this.H&&Ii(this,"Local Disk",Ki);Ii(this,"Remote Disk",Li);Mi(this)||G(this)}; -h.za=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.J.w){for(a=0;ab;b++){var c=document.createElement("option");c.value=b;c.text="RK"+b;a.appendChild(c)}a.value="0";Di(this,0)}}return!0};h.ya=function(a){return a?this.save():!0};h.reset=function(){Gi(this)};h.save=function(){return(new M(this)).data()}; +h.za=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.J.B){for(a=0;ab;b++){var c=document.createElement("option");c.value=b;c.text="RK"+b;a.appendChild(c)}a.value="0";Di(this,0)}}return!0};h.ya=function(a){return a?this.save():!0};h.reset=function(){Gi(this)};h.save=function(){return(new M(this)).data()}; h.restore=function(a){return Gi(this,a[0])};function Mi(a,b){b||(a.B=0);for(var c in a.G){var d=a.G[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.C.listDisks)&&f.options)for(var g=0;gg||9e||e>=a.i.length)a.O("Unable to load the selected drive");else if(c)if(c==Ki)a.O('Use "Choose File" and "Mount" to select and load a local disk.');else{if(c==Li){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=x(c);a.status("Attempting to load "+c+' as "'+b+'"')}Oi(a,e,b,c,!1,d)}else Ni(a,e)} function Oi(a,b,c,d,e,f){var g=-1,k=a.i[b];k.Aa.toLowerCase()!=d.toLowerCase()&&(g++,Ni(a,b,!0),k.sb?a.O("RK11 busy"):(k.sb=!0,e&&(k.rb=!0,a.B++,H(a)&&I(a,"auto-loading disk: "+c)),k.Xa=!!f,ci(new Zh(a,k,"preload"),c,d,f,a.Ad)&&g++));return g} @@ -255,7 +255,7 @@ h.qa=function(a,b,c){var d=this;switch(b){case "listDisks":return this.C[b]=c,c. a)},!0;case "loadDisk":return this.C[b]=c,c.onclick=function(){var a=d.C.listDisks;a&&a.options&&Ti(d,a.options[a.selectedIndex].text,a.value)},!0;case "bootDisk":return this.C[b]=c,c.onclick=function(){var a,b=d.C.listDrives,b=b&&ta(b.value,10);null==b||0>b||b>=d.g.length||!(a=d.g[b])?d.O("Unable to boot the selected drive"):a.ia?(re(d.f,0,!0),(a=d.Wc(a,0,0,0,512,0))&&d.O("Unable to read the boot sector ("+a+")")):d.O("Load a disk into the drive first")},!0;case "saveDisk":if(!this.I){c.parentNode.removeChild(c); break}this.C[b]=c;c.onclick=function(){var a=d.C.listDrives;a&&a.options&&d.g&&((a=d.g[ta(a.value,10)||0])?(a=a.ia)?(a=$a(hi(a),a.gc.replace(".json",".img")),Oa(a)):d.O("No disk loaded in drive."):d.O("No disk drive selected."))};return!0;case "mountDisk":if(this.I)return this.C[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;Ti(d,x(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1}; h.ta=function(a,b,c,d){this.J=a;this.D=b;this.f=c;this.F=d;if(a=Ri(this,$d(this.J,"autoMount")))for(var e in a)e.substr(0,2)==this.type.substr(0,2)&&(this.H[e]=a[e]);Ui(this);this.fb=kd(this.f,112,5,131072);Xb(b,this,Vi);Zb(b,this.reset.bind(this));Wi(this,"None",Xi,!0);this.I&&Wi(this,"Local Disk",Yi);Wi(this,"Remote Disk",Zi);$i(this)||G(this)}; -h.za=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.J.w){for(a=0;ab;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";Si(this,0)}}return!0};h.ya=function(a){return a?this.save():!0};h.reset=function(){Ui(this)};h.save=function(){return(new M(this)).data()}; +h.za=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.J.B){for(a=0;ab;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";Si(this,0)}}return!0};h.ya=function(a){return a?this.save():!0};h.reset=function(){Ui(this)};h.save=function(){return(new M(this)).data()}; h.restore=function(a){return Ui(this,a[0])};function $i(a,b){b||(a.G=0);for(var c in a.H){var d=a.H[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.C.listDisks)&&f.options)for(var g=0;gg||9e||e>=a.g.length)a.O("Unable to load the selected drive");else if(c)if(c==Yi)a.O('Use "Choose File" and "Mount" to select and load a local disk.');else{if(c==Zi){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=x(c);a.status("Attempting to load "+c+' as "'+b+'"')}bj(a,e,b,c,!1,d)}else aj(a,e)} function bj(a,b,c,d,e,f){var g=-1,k=a.g[b];k.Aa.toLowerCase()!=d.toLowerCase()&&(g++,aj(a,b,!0),k.sb?a.O("RL11 busy"):(k.sb=!0,e&&(k.rb=!0,a.G++,H(a)&&I(a,"auto-loading disk: "+c)),k.Xa=!!f,ci(new Zh(a,k,"preload"),c,d,f,a.Dd)&&g++));return g} @@ -321,8 +321,8 @@ wj(a,g[1],!0);if(r)if(a.N=r,void 0===g[2])a.u("begin assemble at "+zj(a,r)),a.P= else{var F=D.charAt(1);if("l"==F){var gb;gb=0+Wj(a,a.g);gb+=Wj(a,a.L);(gb+=Wj(a,a.G))||a.u("no breakpoints")}else if("n"==F)a.ba=ij(a,z),a.u("break after "+a.ba+" instruction(s)");else if(void 0===z)a.u("missing breakpoint address");else{var W=V();if("*"!=z&&(W=wj(a,z,!0),!W))break a;"c"==F?null==W.K?(nj(a),a.u("all breakpoints cleared")):Uj(a,a.g,W)||Uj(a,a.L,W)||Uj(a,a.G,W)||a.u("breakpoint missing: "+zj(a,W)):null!=W.K&&(yj(a,W,C),"p"==F?a.pb(a.g,W):"r"==F?a.pb(a.L,W):"w"==F?a.pb(a.G,W):a.u("unknown breakpoint command: "+ F))}}}break;case "c":a.Pa&&(a.Pa.value="");break;case "d":a:{var Ib,Ua=g[0],Ga=g[1],Va=g[2],Rk=g[3];if("?"==Ga){var Jb="";for(Ib in Sb)a.ma[Ib]&&(Jb&&(Jb+=","),Jb+=Ib);Jb+=",state,symbols";a.u("dump memory commands:");a.u("\tda [a] dump info for address a");a.u("\tdb [a] [n] dump n bytes at address a");a.u("\tdw [a] [n] dump n words at address a");a.u("\tdd [a] [n] dump n dwords at address a");a.u("\tds [a] [n] dump n words at address a as JSON");a.u("\tdh [p] [n] dump n instructions from history position p"); Jb.length&&a.u("dump extension commands:\n\t"+Jb)}else if("state"==Ga){var Oe=sk(a.J,!0);"console"==Va?console.log(Oe):(a.Pa&&(a.Pa.value=""),Oe&&a.u(Oe))}else if("symbols"==Ga)for(var Pe=0;PeHa.length&&(a.u("note: only "+Ha.length+" available"),ra=Ha.length);wa-=ra;0>wa&&(null==Ha[Ha.length-1].K?(ra=wa+ra,wa=0):wa+=Ha.length);var Re=[];"call"==oi&&(sc=1E5,Re=["CALL"]);for(void 0!==ni&&a.u(ra+" instructions earlier:");0=Ha.length&&(wa=0);a.oa=ra;qi++;sc--}}qi||(a.u("no "+pi+"history available"),a.oa=void 0)}else{var fa=wj(a,Ga);if(fa)if("da"==Ua){var Se=fa.Ka||65535K.length?(2Ha.length&&(a.u("note: only "+Ha.length+" available"),ra=Ha.length);xa-=ra;0>xa&&(null==Ha[Ha.length-1].K?(ra=xa+ra,xa=0):xa+=Ha.length);var Re=[];"call"==oi&&(sc=1E5,Re=["CALL"]);for(void 0!==ni&&a.u(ra+" instructions earlier:");0=Ha.length&&(xa=0);a.oa=ra;qi++;sc--}}qi||(a.u("no "+pi+"history available"),a.oa=void 0)}else{var fa=wj(a,Ga);if(fa)if("da"==Ua){var Se=fa.Ka||65535K.length?(2ib&&(ib=0);65536We?String.fromCharCode(We):"."),zd=zd>>8}kb&&(kb+="\n");kb=Te?kb+(lb+","):kb+(Ga+": "+lb+(yd?"":" "+Ve))}kb&&a.u(kb);a.Ca=fa;a.xa=Uk}}}}break;case "e":if("else"==g[0])break;var Mb,Xe,Ye,Ze,$e=g[0],af=g[1];"eb"==$e? (Mb=1,Xe=255,Ye=a.Mc,Ze=a.Nc):"e"==$e||"ew"==$e?(Mb=2,Xe=65535,Ye=a.Oa,Ze=a.yd):af=null;if(null==af)a.u("edit memory commands:"),a.u("\teb [a] [...] edit bytes at address a"),a.u("\tew [a] [...] edit words at address a");else{var Ad=wj(a,af);if(Ad)for(var Bd=2;Bd\nLicense: GPL version 3 or later ");this.u("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis ");for(b=0;b\nLicense: GPL version 3 or later ");this.u("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis ");for(b=0;bxk){if(zk(d,this.H)){this.v=new M(this,"1.32.0",Ik);zk(this.v)&&(Jk(this,d),a=Kk,Lk(this.v));this.v.set(Fk,Ka());Mk(this.v);var e=this.b&&!this.B;if(a==Gk||Pa("Click OK to restore the previous "+Fb+" machine state, or CANCEL to reset the machine.")){if(c=Ek(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?zk(d,g):("error"==f&&"no machine state"!= -g?(this.O("Error: "+g),"unable to verify user"==g&&(Ta(Nk,""),this.g=null)):this.u(f+": "+g),Lk(d),zk(d)?(c=Ek(d),e=!0):c=!1))}e&&Ck(this,c?d:null)}else a==Kk&&d.clear()}else Ck(this);delete this.H;delete this.I}e=ub(this.id);for(f=0;fa[1];a=a[2];this.R=!0;this.A.fa=!0;var d=this.C.power;d&&(d.textContent="Shutdown");this.f&&(Ok(this,this.f,b,c,a),J(this),this.f.Ia());this.M&&(Jk(this,b),b.clear());!c&&this.v&&(this.v.clear(),delete this.v);this.j=0}; +h.Ub=function(a){void 0===a&&(a=this.b||(this.I?Gk:yk));if(!this.j){this.j++;var b=!1,c=!1;this.N=!1;var d=this.w||new M(this,"1.32.0");if(a==Hk)b=!0;else if(a>yk){if(zk(d,this.I)){this.v=new M(this,"1.32.0",Ik);zk(this.v)&&(Jk(this,d),a=Kk,Lk(this.v));this.v.set(Fk,Ka());Mk(this.v);var e=this.b&&!this.G;if(a==Gk||Pa("Click OK to restore the previous "+Fb+" machine state, or CANCEL to reset the machine.")){if(c=Ek(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?zk(d,g):("error"==f&&"no machine state"!= +g?(this.O("Error: "+g),"unable to verify user"==g&&(Ta(Nk,""),this.g=null)):this.u(f+": "+g),Lk(d),zk(d)?(c=Ek(d),e=!0):c=!1))}e&&Ck(this,c?d:null)}else a==Kk&&d.clear()}else Ck(this);delete this.I;delete this.w}e=ub(this.id);for(f=0;fa[1];a=a[2];this.R=!0;this.A.fa=!0;var d=this.C.power;d&&(d.textContent="Shutdown");this.f&&(Ok(this,this.f,b,c,a),J(this),this.f.Ia());this.N&&(Jk(this,b),b.clear());!c&&this.v&&(this.v.clear(),delete this.v);this.j=0}; function Jk(a,b){if(Pa("There may be a problem with your "+Fb+" machine.\n\nTo help us diagnose it, click OK to send this "+Fb+" machine state to http://www.pcjs.org.")){var c=a.V;a=a.g||"";b=b.toString();var d={};d.app=Fb;d.ver="1.32.0";d.url=c;d.user=a;d.type="bug";d.data=b;La("http://www.pcjs.org/api/v1/report",d,!0)}} function sk(a,b,c){var d,e="none";if(a.j)return null;a.j--;var f=new M(a,"1.32.0"),g=new M(a,"1.32.0",Dk),k=Ka();g.set(Fk,k);f.set(Fk,k);f.set(Pk,"1.32.0");f.set(Qk,window?window.location.href:null);f.set(Tk,window?window.navigator.userAgent:"");a.f&&a.f.ya&&(c&&a.f.Z(),d=a.f.ya(b,c),"object"===typeof d&&f.set(a.f.id,d),c&&(a.f.A.fa=!1,!1===d&&(e=null)));for(var k=ub(a.id),l=0;l=d||30<=(c.oc+=d))&&(e.textContent=c.A.U?c.mb.toFixed(2)+"Mhz":"Stopped",c.oc=0)}if(a.i&&(a=a.i,b=b||0,a.v)){c=a.f.A.U;d=!!(a.f.i&8);if(0>=b||60<=(a.j+=b)){for(e=0;eb||b>=d.f.length||!(a=d.f[b])?d.B("Unable to boot the selected drive"):a.T?(Xc(d.c,0,!0),(a=d.sc(a,0,0,0,512,0,2))&&d.B("Unable to read the boot sector ("+a+")")):d.B("Load a disk into the drive first")},!0;case "saveDisk":if(!this.s){c.parentNode.removeChild(c); break}this.j[b]=c;c.onclick=function(){var a=d.j.listDrives;a&&a.options&&d.f&&((a=d.f[r(a.value)||0])?(a=a.T)?(a=La(eg(a),a.Ib.replace(".json",".img")),z(a)):d.B("No disk loaded in drive."):d.B("No disk drive selected."))};return!0;case "mountDisk":if(this.s)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;ig(d,u(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1}; h.aa=function(a,b,c,d){this.A=a;this.u=b;this.c=c;this.D=d;if(a=gg(this,Kc(this.A,"autoMount")))for(var e in a)e.substr(0,2)==this.type.substr(0,2)&&(this.o[e]=a[e]);jg(this);this.Ia=lc(this.c,144,5,65536);kb(b,this,kg);mb(b,this.reset.bind(this));lg(this,"None",mg,!0);this.s&&lg(this,"Local Disk",ng);lg(this,"Remote Disk",og);pg(this)||H(this)}; -h.ha=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.A.i){for(a=0;ab;b++){var c=document.createElement("option");c.value=b;c.text="RK"+b;a.appendChild(c)}a.value="0";hg(this,0)}}return!0};h.ga=function(a){return a?this.save():!0};h.reset=function(){jg(this)};h.save=function(){return(new K(this)).data()}; +h.ha=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.A.m){for(a=0;ab;b++){var c=document.createElement("option");c.value=b;c.text="RK"+b;a.appendChild(c)}a.value="0";hg(this,0)}}return!0};h.ga=function(a){return a?this.save():!0};h.reset=function(){jg(this)};h.save=function(){return(new K(this)).data()}; h.restore=function(a){return jg(this,a[0])};function pg(a,b){b||(a.m=0);for(var c in a.o){var d=a.o[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.j.listDisks)&&f.options)for(var g=0;gg||9e||e>=a.f.length)a.B("Unable to load the selected drive");else if(c)if(c==ng)a.B('Use "Choose File" and "Mount" to select and load a local disk.');else{if(c==og){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+'"')}rg(a,e,b,c,!1,d)}else qg(a,e)} function rg(a,b,c,d,e,f){var g=-1,k=a.f[b];k.ba.toLowerCase()!=d.toLowerCase()&&(g++,qg(a,b,!0),k.Ua?a.B("RK11 busy"):(k.Ua=!0,e&&(k.Ta=!0,a.m++),k.ya=!!f,$f(new Wf(a,k,"preload"),c,d,f,a.Mc)&&g++));return g}h.Mc=function(a,b,c,d,e){a.Ua=!1;b&&(b.J>a.J||b.O>a.O)&&(this.B('Disk "'+c+'" too large for drive '+("RK"+a.Va)),b=null);b?(a.T=b,a.na=c,a.ba=d,this.B('Loaded disk "'+c+'" in drive '+("RK"+a.Va),a.Ta||e),this.A&&Rc(this.A)):a.ya=!1;a.Ta&&(a.Ta=!1,--this.m||H(this));hg(this,a.Va)}; @@ -237,7 +237,7 @@ h.ca=function(a,b,c){var d=this;switch(b){case "listDisks":return this.j[b]=c,c. !0;case "loadDisk":return this.j[b]=c,c.onclick=function(){var a=d.j.listDisks;a&&a.options&&wg(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&&r(b.value);null==b||0>b||b>=d.b.length||!(a=d.b[b])?d.B("Unable to boot the selected drive"):a.T?(Xc(d.c,0,!0),(a=d.tc(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.v){c.parentNode.removeChild(c); break}this.j[b]=c;c.onclick=function(){var a=d.j.listDrives;a&&a.options&&d.b&&((a=d.b[r(a.value)||0])?(a=a.T)?(a=La(eg(a),a.Ib.replace(".json",".img")),z(a)):d.B("No disk loaded in drive."):d.B("No disk drive selected."))};return!0;case "mountDisk":if(this.v)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;wg(d,u(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1}; h.aa=function(a,b,c,d){this.A=a;this.u=b;this.c=c;this.D=d;if(a=ug(this,Kc(this.A,"autoMount")))for(var e in a)e.substr(0,2)==this.type.substr(0,2)&&(this.s[e]=a[e]);xg(this);this.Ia=lc(this.c,112,5,131072);kb(b,this,yg);mb(b,this.reset.bind(this));zg(this,"None",Ag,!0);this.v&&zg(this,"Local Disk",Bg);zg(this,"Remote Disk",Cg);Dg(this)||H(this)}; -h.ha=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.A.i){for(a=0;ab;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";vg(this,0)}}return!0};h.ga=function(a){return a?this.save():!0};h.reset=function(){xg(this)};h.save=function(){return(new K(this)).data()}; +h.ha=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.A.m){for(a=0;ab;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";vg(this,0)}}return!0};h.ga=function(a){return a?this.save():!0};h.reset=function(){xg(this)};h.save=function(){return(new K(this)).data()}; h.restore=function(a){return xg(this,a[0])};function Dg(a,b){b||(a.o=0);for(var c in a.s){var d=a.s[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.j.listDisks)&&f.options)for(var g=0;gg||9e||e>=a.b.length)a.B("Unable to load the selected drive");else if(c)if(c==Bg)a.B('Use "Choose File" and "Mount" to select and load a local disk.');else{if(c==Cg){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.b[b];k.ba.toLowerCase()!=d.toLowerCase()&&(g++,Eg(a,b,!0),k.Ua?a.B("RL11 busy"):(k.Ua=!0,e&&(k.Ta=!0,a.o++),k.ya=!!f,$f(new Wf(a,k,"preload"),c,d,f,a.Pc)&&g++));return g}h.Pc=function(a,b,c,d,e){a.Ua=!1;b&&(b.J>a.J||b.O>a.O)&&(this.B('Disk "'+c+'" too large for drive '+("RL"+a.Va)),b=null);b?(a.T=b,a.na=c,a.ba=d,this.B('Loaded disk "'+c+'" in drive '+("RL"+a.Va),a.Ta||e),this.A&&Rc(this.A)):a.ya=!1;a.Ta&&(a.Ta=!1,--this.o||H(this));vg(this,a.Va)}; @@ -250,27 +250,27 @@ h.Oc=function(a,b,c,d,e,f){this.m=f&65535;this.a=this.a&-49|f>>12&48;this.h=f>>1 h.hf=function(a){this.a=this.a&-1023|a&1022;this.h=this.h&60|(a&48)>>4;if(!(this.a&128)){a=!0;var b,c=this.b[(this.a&768)>>8],d=c.T,e,f,g;this.a&=-2;switch(this.a&14){case 4:this.i&8&&(this.a&=63);this.i=c.status|this.g&64|(d&&512==d.J?128:0);break;case 6:1==(this.f&3)&&(b=this.f&65408,c=(this.f&16)<<2,this.g=this.f&4?this.g+b:this.g-b,this.f=this.g=this.g&65408|c);break;case 8:this.i=this.g;break;case 12:b=this.tc;case 10:b||(b=this.Qc),e=this.f>>7,f=this.f&64?1:0,g=this.f&63,!d||e>=d.J||g>=d.M? this.a|=37888:(a=65536-this.i&65535,d=(this.h&63)<<16|this.m,a=b.call(this,c,e,f,g,a,d,this.Oc.bind(this)))}a&&(this.a|=129,this.a&64&&jc(this.c,this.Ia))}};h.Xd=function(){return this.m};h.ff=function(a){this.m=a&65534};h.$d=function(){return this.f};h.jf=function(a){this.f=a};h.ae=function(){return this.i};h.kf=function(a){this.i=a};h.Yd=function(){return this.h};h.gf=function(a){this.h=a&63;this.a=this.a&-49|(this.h&3)<<4}; var Ag="",Bg="?",Cg="??",Gg={},yg=(Gg[63744]=[null,null,P.prototype.Zd,P.prototype.hf,"RLCS"],Gg[63746]=[null,null,P.prototype.Xd,P.prototype.ff,"RLBA"],Gg[63748]=[null,null,P.prototype.$d,P.prototype.jf,"RLDA"],Gg[63750]=[null,null,P.prototype.ae,P.prototype.kf,"RLMP"],Gg[63752]=[null,null,P.prototype.Yd,P.prototype.gf,"RLBE"],Gg); -function Hg(a,b,c){A.call(this,"Computer",a,0,33554432);this.l.R=!1;this.F=null;Ig(this,b);this.w=Kc(this,"autoPower",a,6);this.g=0;this.K=+a.busWidth||+a.buswidth;this.a=Jg;this.s=null;this.H=this.i=this.C=this.m=this.I=!1;this.h=null;this.L=Kc(this,"url")||"";(Math.random()+.1).toString(36);this.b=Kg(this);if(this.c=Ya("CPU",this.id)){this.D=Ya("Debugger",this.id);this.u=new Mb({id:this.La+".bus",busWidth:this.K},this.c,this.D);var d,e=C(this.id);if((this.f=Ya("Panel",this.id))&&this.f.ab)for(b= -0;b\nLicense: GPL version 3 or later ");this.V("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis ");for(b=0;b\nLicense: GPL version 3 or later ");this.V("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis ");for(b=0;bJg){if(Lg(d,this.s)){this.h=new K(this,"1.32.0",Ug);Lg(this.h)&&(Vg(this,d),a=Wg,Zg(this.h));this.h.set(Rg,za());$g(this.h);var e=this.a&&!this.m;if(a==Sg||Ca("Click OK to restore the previous "+cb+" machine state, or CANCEL to reset the machine.")){if(c=Qg(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&&(Ha(ah,""),this.b=null)):this.V(f+": "+g),Zg(d),Lg(d)?(c=Qg(d),e=!0):c=!1))}e&&Og(this,c?d:null)}else a==Wg&&d.clear()}else Og(this);delete this.s;delete this.v}e=C(this.id);for(f=0;fa[1];a=a[2];this.H=!0;this.l.R=!0;var d=this.j.power;d&&(d.textContent="Shutdown");this.c&&(bh(this,this.c,b,c,a),Cb(this),this.c.ma());this.C&&(Vg(this,b),b.clear());!c&&this.h&&(this.h.clear(),delete this.h);this.g=0}; +h.ub=function(a){void 0===a&&(a=this.a||(this.v?Sg:Kg));if(!this.g){this.g++;var b=!1,c=!1;this.F=!1;var d=this.i||new K(this,"1.32.0");if(a==Tg)b=!0;else if(a>Kg){if(Lg(d,this.v)){this.h=new K(this,"1.32.0",Ug);Lg(this.h)&&(Vg(this,d),a=Wg,Zg(this.h));this.h.set(Rg,za());$g(this.h);var e=this.a&&!this.o;if(a==Sg||Ca("Click OK to restore the previous "+cb+" machine state, or CANCEL to reset the machine.")){if(c=Qg(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&&(Ha(ah,""),this.b=null)):this.V(f+": "+g),Zg(d),Lg(d)?(c=Qg(d),e=!0):c=!1))}e&&Og(this,c?d:null)}else a==Wg&&d.clear()}else Og(this);delete this.v;delete this.i}e=C(this.id);for(f=0;fa[1];a=a[2];this.H=!0;this.l.R=!0;var d=this.j.power;d&&(d.textContent="Shutdown");this.c&&(bh(this,this.c,b,c,a),Cb(this),this.c.ma());this.F&&(Vg(this,b),b.clear());!c&&this.h&&(this.h.clear(),delete this.h);this.g=0}; function Vg(a,b){if(Ca("There may be a problem with your "+cb+" machine.\n\nTo help us diagnose it, click OK to send this "+cb+" machine state to http://www.pcjs.org.")){var c=a.L;a=a.b||"";b=b.toString();var d={};d.app=cb;d.ver="1.32.0";d.url=c;d.user=a;d.type="bug";d.data=b;v("http://www.pcjs.org/api/v1/report",d,!0)}} function ch(a,b,c){var d,e="none";if(a.g)return null;a.g--;var f=new K(a,"1.32.0"),g=new K(a,"1.32.0",Pg),k=za();g.set(Rg,k);f.set(Rg,k);f.set(dh,"1.32.0");f.set(eh,window?window.location.href:null);f.set(fh,window?window.navigator.userAgent:"");a.c&&a.c.ga&&(c&&I(a.c),d=a.c.ga(b,c),"object"===typeof d&&f.set(a.c.id,d),c&&(a.c.l.R=!1,!1===d&&(e=null)));for(var k=C(a.id),l=0;l=d||30<=(c.ec+=d))&&(e.textContent=c.l.P?c.Ma.toFixed(2)+"Mhz":"Stopped",c.ec=0)}if(a.f&&(a=a.f,b=b||0,a.m)){c=a.c.l.P;d=!!(a.c.g&8);if(0>=b||60<=(a.i+=b)){for(e=0;e