Fixed PCx86 "Save Machine" functionality (broken by the inclusion of source maps at the end of the compiled scripts)

This commit is contained in:
Jeff Parsons 2017-08-16 20:52:14 -07:00 committed by Jeff Parsons
commit 159588623a
341 changed files with 193383 additions and 320 deletions

View file

@ -14,12 +14,12 @@
<xsl:variable name="CSSCLASS">pcjs</xsl:variable>
<xsl:variable name="APPCLASS">pcx86</xsl:variable>
<xsl:variable name="APPNAME">PCx86</xsl:variable>
<xsl:variable name="APPVERSION">1.36.1</xsl:variable>
<xsl:variable name="APPVERSION">1.36.2</xsl:variable>
<xsl:variable name="SITEHOST">www.pcjs.org</xsl:variable>
<xsl:variable name="BGNDCOLOR">#FAEBD7</xsl:variable>
<xsl:template name="componentStyles">
<link rel="stylesheet" type="text/css" href="/versions/pcx86/1.36.1/components.css"/>
<link rel="stylesheet" type="text/css" href="/versions/pcx86/1.36.2/components.css"/>
</xsl:template>
<xsl:template name="componentScripts">

View file

@ -835,7 +835,7 @@ break}a:{var qd,rd=null,gb=g[1];"?"==gb&&(gb=void 0);if(void 0!==gb){var Xd=0;if
gb==qd){var AC=!!(a.fc&Tb[qd]);if(null===rd||rd==AC)eh&&(eh+=","),++zC%10||(eh+="\n\t"),"key"==qd&&(qd="keys"),eh+=qd}void 0===gb&&a.O("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.O((null!==rd?rd?"messages on: ":"messages off: ":"message categories:\n\t")+(eh||"none"));Fy(a)}break;case "o":var Pm=g[1],BC=g[2];if(Pm&&"?"!=Pm){var Qm=sy(a,Pm,"port #"),Rm=sy(a,BC);void 0!==Qm&&void 0!==Rm&&(Nc(a.na,Qm,1,Rm),a.O(oa(Qm)+": "+na(Rm)))}else a.O("output commands:"),a.O("\to [p] [b]\twrite byte [b] to port [p]"),
a.O("warning: port accesses can affect hardware state");break;case "p":if("print"==g[0]){BB(a,b.substr(5));break}var cu="pr"==g[0]?1:0,tf=1+cu;if(a.K)a.O("step in progress");else{var mj,du=!1,Kb=Dy(a,z(a.H),a.H.ba.T);do switch(mj=!1,a.ya(Kb)){case 38:case 46:case 54:case 62:case 100:case 101:case 102:case 103:case 240:fz(a,Kb,1);mj=!0;break;case 204:case 206:a.K=tf;fz(a,Kb,1);break;case 205:case 224:case 225:case 226:a.K=tf;fz(a,Kb,Kb.Jb?4:2);break;case 232:a.K=tf;fz(a,Kb,Kb.Jb?5:3);break;case 154:a.K=
tf;fz(a,Kb,Kb.Jb?7:5);break;case 255:var eu=a.nb(Kb)&14591;if(4351==eu||6399==eu)a.K=tf,sA(a,Kb);break;case 243:case 242:fz(a,Kb,1);du=mj=!0;break;case 108:case 109:case 110:case 111:case 164:case 165:case 166:case 167:case 170:case 171:case 172:case 173:case 174:case 175:du&&(a.K=tf,fz(a,Kb,1))}while(mj);a.K?(a.td(a.B,Kb,!0),iA(a,void 0)&&Ad(a.H,void 0,void 0)||(a.oa&&a.oa.dd(),a.K=0)):DB(a,cu?"tr":"t")}break;case "r":if("reset"==b){a.oa&&a.oa.reset();break}jA(a,g);break;case "t":DB(a,g[0],g[1]);
break;case "u":kA(a,g[1],g[2],8);break;case "v":if("var"==g[0]){wB(a,b.substr(3))||(d=!1);break}a.O("PCx86 version 1.36.1 ("+a.H.da+",RELEASE,NOPREFETCH"+(Pb?",TYPEDARRAYS":",LONGARRAYS")+",NOBACKTRACK)");a.O(Ha());break;case "x":a:if(g[1]&&"?"!=g[1])switch(g[1]){case "cs":var fh;void 0!==g[3]&&(fh=+g[3]);switch(g[2]){case "int":a.H.Y.Te=fh;break;case "start":a.H.Y.wf=fh;break;case "stop":a.H.Y.Ve=fh;break;default:a.O("unknown cs option");break a}void 0!==fh&&yd(a.H);a.O("checksums "+(a.H.Z.Ke?"enabled":
break;case "u":kA(a,g[1],g[2],8);break;case "v":if("var"==g[0]){wB(a,b.substr(3))||(d=!1);break}a.O("PCx86 version 1.36.2 ("+a.H.da+",RELEASE,NOPREFETCH"+(Pb?",TYPEDARRAYS":",LONGARRAYS")+",NOBACKTRACK)");a.O(Ha());break;case "x":a:if(g[1]&&"?"!=g[1])switch(g[1]){case "cs":var fh;void 0!==g[3]&&(fh=+g[3]);switch(g[2]){case "int":a.H.Y.Te=fh;break;case "start":a.H.Y.wf=fh;break;case "stop":a.H.Y.Ve=fh;break;default:a.O("unknown cs option");break a}void 0!==fh&&yd(a.H);a.O("checksums "+(a.H.Z.Ke?"enabled":
"disabled"));break;case "sp":void 0!==g[2]&&(Ed(a.H,+g[2])||a.O("warning: using 1x multiplier, previous target not reached"));a.O("target speed: "+(a.H.Y.te.toFixed(2)+"Mhz")+" ("+a.H.Y.Cd+"x)");break;default:a.O("unknown option: "+g[1])}else a.O("execution options:"),a.O("\tcs int #\tset checksum cycle interval to #"),a.O("\tcs start #\tset checksum cycle start count to #"),a.O("\tcs stop #\tset checksum cycle stop count to #"),a.O("\tsp #\t\tset speed multiplier to #");break;case "?":if(g[1]){BB(a,
b.substr(1));break}var Sm="commands:",Tm;for(Tm in FB)Sm+="\n"+va(Tm,7)+FB[Tm];Jg(a)||(Sm+="\nnote: frequency/history disabled if no exec breakpoints");a.O(Sm);break;default:a.O("unknown command: "+b),d=!1}}}catch(gu){a.O("debugger error: "+(gu.stack||gu.message)),d=!1}return d}function Hy(a,b,c){b=a.Bg(b,c);for(var d in b)if(!rA(a,b[+d]))return!1;return!0}
var fA={16:262144,19:524288,21:32768,22:65536,28:2048,33:134217728,51:16777216},eA=[26,28,40,42,109],FB={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory",f:"frequencies","g [#]":"go [to #]",h:"halt","i [#]":"input port #","if":"eval expression",k:"stack trace",l:"load sector(s)",ln:"list nearest symbol(s)",m:"messages",mouse:"mouse action","o [#]":"output port #",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",
@ -867,24 +867,24 @@ Jy,[119,R|S|W,HB|4096]],[[155,R|U|4096,V|U|4096],Jy,[98,R|U|W],[96,R|U|W],[95,R|
CPL0_SS:4,CPL1_SP:6,CPL1_SS:8,CPL2_SP:10,CPL2_SS:12,TASK_IP:14,TASK_PS:16,TASK_AX:18,TASK_CX:20,TASK_DX:22,TASK_BX:24,TASK_SP:26,TASK_BP:28,TASK_SI:30,TASK_DI:32,TASK_ES:34,TASK_CS:36,TASK_SS:38,TASK_DS:40,TASK_LDT:42},Ty={PREV_TSS:0,CPL0_ESP:4,CPL0_SS:8,CPL1_ESP:12,CPL1_SS:16,CPL2_ESP:20,CPL2_SS:24,TASK_CR3:28,TASK_EIP:32,TASK_PS:36,TASK_EAX:40,TASK_ECX:44,TASK_EDX:48,TASK_EBX:52,TASK_ESP:56,TASK_EBP:60,TASK_ESI:64,TASK_EDI:68,TASK_ES:72,TASK_CS:76,TASK_SS:80,TASK_DS:84,TASK_FS:88,TASK_GS:92,TASK_LDT:96,
TASK_IOPM:100};Xa(function(){for(var a=vb(document,"pcx86","debugger"),b=0;b<a.length;b++){var c=a[b],d=wb(c),d=new Cy(d);ub(d,c)}});
function XB(a,b,c){ib.call(this,"Computer",a,67108864);var d=this;YB(this,b);this.U=ud(this,"autoPower",a);this.D=+ud(this,"diagnostics",a);0<=this.D&&2>=this.D||(this.D=1);this.F=0;this.pa=a.busWidth||a.buswidth;this.A=ZB;this.P=null;this.L=this.ha=!1;this.ra=ud(this,"url")||"";this.va=(Math.random()+.1).toString(36).substr(2,12);this.B=$B(this);if(this.H=tb("CPU",this.id)){this.ca=tb("Debugger",this.id);this.C=[];for(b=null;b=Vb(this,"Video",b);)this.C.push(b);this.na=new hc({id:this.ee+".bus",
busWidth:this.pa},this.H,this.ca);var e,f=xb(this.id);this.K=(this.J=tb("Panel",this.id))&&this.J.ma.print;this.ka=this.Da;this.la=this.print;this.qa=this.O;this.K&&(this.ka=this.J.Da,this.la=this.J.print,this.qa=this.J.O);for(b=0;b<f.length;b++)e=f[b],e.Da=function(a,b,c){aC(d,a);return d.ka.call(this,a,b,c)}.bind(e),e.print=function(a){return d.la.call(this,a)}.bind(e),e.O=function(a,b,c){aC(d,a,b);return d.qa.call(this,a,b,c)}.bind(e);this.I=0;!this.K&&this.D&&bC(this);this.O("PCx86 v1.36.1\nCopyright \u00a9 2012-2017 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");
for(b=0;b<f.length;b++)e=f[b],e.uc&&e.uc(this,this.na,this.H,this.ca);vd(this.H,this.id,function(){Rd(d)},1E3/cC);b=null;e=ud(this,"resume");void 0!==e&&(1<e.length?b=this.N=e:this.A=parseInt(e,10));e=!1;f=Qa("state");f||(e=!0,f=ud(this,"state",a));f&&(b=this.ba=f,e||(this.L=!0,this.A=ZB),this.A&&(this.V=new Wf(this,"1.36.1"),this.V.load()?b=null:delete this.V));!b&&this.A&&(b=dC(this))&&(this.L=!0);if(this.ea=b){var g="Loading "+this.ea+"...";Fa(this.ea,null,!0,function(a,b,c){c?(d.N=null,d.L=!1,
busWidth:this.pa},this.H,this.ca);var e,f=xb(this.id);this.K=(this.J=tb("Panel",this.id))&&this.J.ma.print;this.ka=this.Da;this.la=this.print;this.qa=this.O;this.K&&(this.ka=this.J.Da,this.la=this.J.print,this.qa=this.J.O);for(b=0;b<f.length;b++)e=f[b],e.Da=function(a,b,c){aC(d,a);return d.ka.call(this,a,b,c)}.bind(e),e.print=function(a){return d.la.call(this,a)}.bind(e),e.O=function(a,b,c){aC(d,a,b);return d.qa.call(this,a,b,c)}.bind(e);this.I=0;!this.K&&this.D&&bC(this);this.O("PCx86 v1.36.2\nCopyright \u00a9 2012-2017 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");
for(b=0;b<f.length;b++)e=f[b],e.uc&&e.uc(this,this.na,this.H,this.ca);vd(this.H,this.id,function(){Rd(d)},1E3/cC);b=null;e=ud(this,"resume");void 0!==e&&(1<e.length?b=this.N=e:this.A=parseInt(e,10));e=!1;f=Qa("state");f||(e=!0,f=ud(this,"state",a));f&&(b=this.ba=f,e||(this.L=!0,this.A=ZB),this.A&&(this.V=new Wf(this,"1.36.2"),this.V.load()?b=null:delete this.V));!b&&this.A&&(b=dC(this))&&(this.L=!0);if(this.ea=b){var g="Loading "+this.ea+"...";Fa(this.ea,null,!0,function(a,b,c){c?(d.N=null,d.L=!1,
d.Da("Unable to load machine state from server (error "+c+(b?": "+wa(b):"")+")")):(d.P=b,d.ha=!0);Jb(d)},function(){d.O(g,Fb.Ee)})}else Jb(this);this.ma.power||(this.U=!0);!c&&this.U&&this.bf(this.Ye)}else ab("Unable to find CPU component")}ba(XB,ib);function zB(a){a.K&&(a.K.value="")}function bC(a){if(!a.I)for(var b=0;b<a.C.length;b++){var c=a.C[b];c&&(c=c.og)&&(c.style.opacity="1",c.style.lineHeight="1",a.I++)}}
function aC(a,b,c){if(a.I)for(var d=0;d<a.C.length;d++){var e=a.C[d];e&&(e=e.og)&&(c!=Fb.Ee||"..."!=b.slice(-3)?qb(e,b+"\n"):rb(e,b,b+"."))}}function yq(a){var b=a.D;3==a.D&&(a.D++,Jb(a));return!b}function YB(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){ab(d.message+" ("+c+")")}}a.M=b}function ud(a,b,c){var d=Qa(b);void 0===d&&a.M&&(d=a.M[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}l=XB.prototype;
l.bf=function(a,b){for(var c=this,d=xb(this.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:this;if(!Ib(f)){Ib(f,function(){c.bf(a,b)});return}}a.call(this,b)};function eC(a,b){var c=new Wf(a,"1.36.1",fC);if(c.load()&&gC(c)){var d=c.get(hC),e=b?b.get(hC):"unknown";d!=e&&(a.Da("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}
l.Ye=function(a){void 0===a&&(a=this.A||(this.P?iC:ZB));if(!this.F){this.F++;var b=!1,c=!1;this.fa=!1;var d=this.V||new Wf(this,"1.36.1");if(a==Dd)b=!0;else if(a>ZB){if(d.load(this.P)){this.G=new Wf(this,"1.36.1",jC);this.G.load()&&(a!=iC&&kC(this,d)&&(a=lC),mC(this.G));this.G.set(hC,za("Y-m-d H:i:s"));nC(this.G);var e=this.A&&!this.L;if(a==iC||pb("Click OK to restore the previous PCx86 machine state.")){if(c=gC(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?d.load(g):("error"==f&&"no machine state"!=
l.bf=function(a,b){for(var c=this,d=xb(this.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:this;if(!Ib(f)){Ib(f,function(){c.bf(a,b)});return}}a.call(this,b)};function eC(a,b){var c=new Wf(a,"1.36.2",fC);if(c.load()&&gC(c)){var d=c.get(hC),e=b?b.get(hC):"unknown";d!=e&&(a.Da("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}
l.Ye=function(a){void 0===a&&(a=this.A||(this.P?iC:ZB));if(!this.F){this.F++;var b=!1,c=!1;this.fa=!1;var d=this.V||new Wf(this,"1.36.2");if(a==Dd)b=!0;else if(a>ZB){if(d.load(this.P)){this.G=new Wf(this,"1.36.2",jC);this.G.load()&&(a!=iC&&kC(this,d)&&(a=lC),mC(this.G));this.G.set(hC,za("Y-m-d H:i:s"));nC(this.G);var e=this.A&&!this.L;if(a==iC||pb("Click OK to restore the previous PCx86 machine state.")){if(c=gC(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?d.load(g):("error"==f&&"no machine state"!=
g?(this.Da("Error: "+g),"unable to verify user"==g&&(La(oC,""),this.B=null)):this.O(f+": "+g),mC(d),d.load()?(c=gC(d),e=!0):c=!1))}e&&eC(this,c?d:null)}else a==lC&&d.clear()}else eC(this);delete this.P;delete this.V}e=xb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.H&&(c=pC(this,g,d,b,c));b=[d,a,c];a!=Dd?this.bf(this.$g,b):this.$g(b)}};
function pC(a,b,c,d,e){if(!b.Z.bc){b.Z.bc=!0;if(b.ac){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/-[0-9]+\./i,"."))));"string"===typeof f&&(f=null);!b.ac(f,d)&&f&&(b.Da("Unable to restore hardware state")&&(a.ba&&!a.ha?(c.clear(),a.A=ZB,window&&window.location.reload()):a.fa=!0),b.ac(null),e=!1)}b.Z.pf=!0;if(!d&&b.vj)for(a=b.vj.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
l.$g=function(a){if(!this.Z.pf){var b;a:{if(this.I){if(2==this.D){this.D++;this.O("Press any key to continue...");b=!1;break a}for(b=0;b<this.C.length;b++){var c=this.C[b];if(c&&(c=c.og)){var d=Ha();c.style.opacity="0";c.style.lineHeight="0";if(0<=d.indexOf("MSIE")||0<=d.indexOf("Trident"))c.style.fontSize="0";c.value=""}}this.I=0}this.D=0;b=!0}if(!b){Jb(this,!1);this.bf(this.$g,a);return}this.Z.pf=!0}b=a[0];c=0>a[1];a=a[2];if(d=this.ma.power)d.textContent="Shutdown";this.Z.bc=!0;this.H&&(pC(this,
this.H,b,c,a),this.H.je());this.fa&&(kC(this,b),b.clear());!c&&this.G&&(this.G.clear(),delete this.G);this.F=0;zb(this.ee,ud(this,"autoScript"))};function kC(a,b){if(!a.Z.Ae){if(pb("There may be a problem with your PCx86 machine.\n\nTo help us diagnose it, click OK to send this PCx86 machine state to http://www.pcjs.org.")){var c=a.B||"";b=b.toString();var d={app:"PCx86",ver:"1.36.1"};d.url=a.ra;d.user=c;d.type="bug";d.data=b;Fa("http://www.pcjs.org/api/v1/report",d,!0)}return!0}return!1}
function EB(a,b,c){var d,e="none";if(a.F)return null;a.F--;var f=new Wf(a,"1.36.1"),g=new Wf(a,"1.36.1",fC),h=za("Y-m-d H:i:s");g.set(hC,h);f.set(hC,h);f.set(qC,"1.36.1");f.set(rC,window?window.location.href:null);f.set(sC,Ha());a.H&&a.H.$b&&(d=a.H.$b(b,c),"object"===typeof d&&f.set(a.H.id,d),c&&(a.H.Z.bc=!1,!1===d&&(e=null)));for(var h=xb(a.id),k=0;k<h.length;k++){var m=h[k];m.Z.bc&&(m.$b&&(d=m.$b(b,c),"object"===typeof d&&f.set(m.id,d)),c&&(m.Z.bc=!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.B&&CC(a,
this.H,b,c,a),this.H.je());this.fa&&(kC(this,b),b.clear());!c&&this.G&&(this.G.clear(),delete this.G);this.F=0;zb(this.ee,ud(this,"autoScript"))};function kC(a,b){if(!a.Z.Ae){if(pb("There may be a problem with your PCx86 machine.\n\nTo help us diagnose it, click OK to send this PCx86 machine state to http://www.pcjs.org.")){var c=a.B||"";b=b.toString();var d={app:"PCx86",ver:"1.36.2"};d.url=a.ra;d.user=c;d.type="bug";d.data=b;Fa("http://www.pcjs.org/api/v1/report",d,!0)}return!0}return!1}
function EB(a,b,c){var d,e="none";if(a.F)return null;a.F--;var f=new Wf(a,"1.36.2"),g=new Wf(a,"1.36.2",fC),h=za("Y-m-d H:i:s");g.set(hC,h);f.set(hC,h);f.set(qC,"1.36.2");f.set(rC,window?window.location.href:null);f.set(sC,Ha());a.H&&a.H.$b&&(d=a.H.$b(b,c),"object"===typeof d&&f.set(a.H.id,d),c&&(a.H.Z.bc=!1,!1===d&&(e=null)));for(var h=xb(a.id),k=0;k<h.length;k++){var m=h[k];m.Z.bc&&(m.$b&&(d=m.$b(b,c),"object"===typeof d&&f.set(m.id,d)),c&&(m.Z.bc=!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.B&&CC(a,
a.B,f.toString()),nC(g)&&nC(f)||(e=null,d=h=!0)):a.A&&(d=!0,h=a.A==DC),d&&f.clear(h)):e=f.toString());c&&(a.Z.bc=!1,b=a.ma.power)&&(b.textContent="Power");a.F=0;return e}l.reset=function(){this.na&&this.na.reset&&(Nb(this,"Resetting "+this.na.type),this.na.reset());for(var a=xb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.na&&c.reset&&(Nb(this,"Resetting "+c.type),c.reset())}};
l.start=function(a,b){for(var c=xb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};l.stop=function(a,b){for(var c=xb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
l.Eb=function(a,b,c){var d=this;switch(b){case "power":return this.ma[b]=c,c.onclick=function(){d.F||(d.Z.bc?EB(d,!1,!0):d.bf(d.Ye))},!0;case "reset":return this.ma[b]=c,c.onclick=function(){if(d.Z.bc&&!d.F)if(d.H&&(d.H.Z.je=d.H.Z.Xa),d.A&&!d.N){var a=d.Z.Ae||!pb("Click OK to reset this PCx86 machine and discard all disk modifications.");EB(d,a,!0);!a&&d.ba?window&&window.location.reload():(a||(d.aa=!0),d.Ye(ZB),d.aa=!1)}else d.reset(),d.H&&d.H.je()},!0;case "save":if(sa(Ga(),"pcjs.org"))c.parentNode.removeChild(c);
else return this.ma[b]=c,c.onclick=function(){var a=$B(d,!0);if(a){var b=!!(d.A&&!d.N||d.ba),c=EB(d,b);b?CC(d,a,c):d.Da("Resume disabled, machine state not saved")}},!0}return!1};
function $B(a,b){var c=a.B;c||((c=Ka(oC),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=EC(a,c))||a.Da("The user ID is invalid.")):b&&a.Da("Browser local storage is not available"));return c}
function EC(a,b){a.B=null;b=Fa(Ga()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(La(oC,b.data),a.B=b.data)}catch(d){ab(d.message+" ("+c+")")}return a.B}function dC(a){var b=null;a.B&&(b=Ga()+"/api/v1/user?req=load&user="+a.B+"&state="+FC(a,"1.36.1"));return b}
function CC(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=FC(a,"1.36.1");d.data=c;b=Fa(Ga()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.Da("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.Da(c),La(oC,""),a.B=null)}}
function EC(a,b){a.B=null;b=Fa(Ga()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(La(oC,b.data),a.B=b.data)}catch(d){ab(d.message+" ("+c+")")}return a.B}function dC(a){var b=null;a.B&&(b=Ga()+"/api/v1/user?req=load&user="+a.B+"&state="+FC(a,"1.36.2"));return b}
function CC(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=FC(a,"1.36.2");d.data=c;b=Fa(Ga()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.Da("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.Da(c),La(oC,""),a.B=null)}}
function Vb(a,b,c){a=xb(a.id);for(var d=0;d<a.length;d++){var e=a[d];if(c)c==e&&(c=null);else if(e.type==b)return e}return null}l.dd=function(a){if(this.C.length){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);var d=this.C[0];d.F&&d.F.focus();!a&&window&&window.scrollTo(b,c)}};
function Rd(a,b){if(a.H){var c=a.H;if(c.rj&&(b||!c.Z.Xa||c.Z.jj)){Ig(c,"EAX",c.D);Ig(c,"EBX",c.G);Ig(c,"ECX",c.I);Ig(c,"EDX",c.L);Ig(c,"ESP",y(c));Ig(c,"EBP",c.N);Ig(c,"ESI",c.K);Ig(c,"EDI",c.J);Ig(c,"CS",c.ba.T);Ig(c,"DS",c.Fa.T);Ig(c,"SS",c.U.T);Ig(c,"ES",c.pa.T);Ig(c,"EIP",z(c));var d=qe(c);Ig(c,"PS",d);Ig(c,"V",d&2048);Ig(c,"D",d&1024);Ig(c,"I",d&512);Ig(c,"T",d&256);Ig(c,"S",d&128);Ig(c,"Z",d&64);Ig(c,"A",d&16);Ig(c,"P",d&4);Ig(c,"C",d&1);80386==c.da&&(Ig(c,"FS",c.Ka.T),Ig(c,"GS",c.La.T),Ig(c,
"CR0",c.ra),Ig(c,"CR2",c.qd),Ig(c,"CR3",c.Uc))}if(d=c.ma.speed)d.textContent=c.Z.Xa&&c.Y.Ld?c.Y.Ld.toFixed(2)+"Mhz":"Stopped"}for(c=0;c<a.C.length;c++)Js(a.C[c],b)}var jC="failsafe",fC="validate",hC="timestamp",qC="version",rC="url",sC="browser",oC="user",Dd=-1,ZB=0,iC=1,lC=2,DC=3,cC=2;Xa(function(){for(var a=vb(document,"pcx86-machine"),b=0;b<a.length;b++)for(var c=a[b],d=wb(c),c=vb(c,"pcx86","computer"),e=0;e<c.length;e++){var f=c[e],g=wb(f),g=new XB(g,d,!0);ub(g,f);g.U&&g.bf(g.Ye)}});
@ -899,10 +899,10 @@ b:""),null)}
function JC(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");Fa(e,null,!0,function(f,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(f=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=h[0],m,p=/( [a-z]+=)(['"])(.*?)\2/gi;m=p.exec(f);)k=0>k.toLowerCase().indexOf(m[1].toLowerCase())?k.replace(">",m[0]+">"):k.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=k&&(g=g.replace(h[0],k))}else{c(a,"missing <"+d[1]+
"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,"");a=a.replace(d[0],g);JC(a,b,c)}})}else c(a,null)}
function KC(a,b,c,d){function e(a){if(void 0===h){var b=g&&vb(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ta(a))}function f(a){e("Error: "+a);k&&(--GC||bb(!0));k=!1}var g,h,k=!0;GC++;ob[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],v=document.createElement("style");v.type="text/css";v.styleSheet?v.styleSheet.cssText=m:v.appendChild(document.createTextNode(m));p.appendChild(v)}c||
(c="/versions/pcx86/1.36.1/components.xsl");m=function(d,h){h?HC(c,null,null,!1,e,function(d,k){k?(nb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(k=h.transformNode(k))?(g.outerHTML=k,--GC||bb(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(k),(k=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(k,g),--GC||bb(!0)):f("invalid machine element: "+
(c="/versions/pcx86/1.36.2/components.xsl");m=function(d,h){h?HC(c,null,null,!1,e,function(d,k){k?(nb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(k=h.transformNode(k))?(g.outerHTML=k,--GC||bb(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(k),(k=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(k,g),--GC||bb(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?HC(b,a,d,!0,e,m):IC(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(u){f(u.message)}return k}function LC(a,b,c,d){bb(!1);return KC(a,b,c,d)}window.embedPC=LC;window.embedPCx86=LC;
window.commandMachine=function(a,b,c,d,e,f){if("script"==e)return zb(c,f)?(b&&(a.disabled=!0),!0):!1;if(d){var g=tb(d,c+".machine");if(g){var h=g.exports;if(h&&(h=h[e]))return h.call(g,f)?(b&&(a.disabled=!0),!0):!1}}console.log("unimplemented: commandMachine('"+c+"','"+d+"','"+e+"','"+f+"')");return!1};window.enableEvents=bb;window.sendEvent=fb;
function MC(a,b,c,d){if(!c&&b){d.push(b);a=ob[d[0]];b=null;for(var e in a)if(sa(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?Fa(b,null,!0,function(a,b){NC(b,d)}):NC(null,d)}else ab("Error ("+c+") requesting "+a)}
function NC(a,b){var c,d,e,f=b[0],g=b[1];c=b[4];c=c.match(/^(\s*\(function\(\)\{)([\s\S]*)(}\)\(\);\s*)$/);var h=ob[f],k={},m;for(m in h){var p=h[m],v=ra(m);if("xml"==v){for(v=/[ \t]*<disk [^>]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=v.exec(h[m]);){var u=d[2];u&&(h[u]||(p=p.replace(d[0],"")))}d=m=pa(m)}else"xsl"==v&&(e=m=pa(m));k[m]=p}a&&(k[m="css"]=a);b[2]&&(k[m="parms"]=b[2]);b[3]&&(k[m="state"]=b[3]);d&&e?(a=JSON.stringify(k),g+=".js",c=c[1]+"var resources="+a+";"+c[2]+c[3],c=c.replace(/\u00A9/g,
"&#xA9;"),a=Ta(c,"javascript",!1,g),a=a+(', copy it to your web server as "'+g+'", and then add the following to your web page:\n\n')+('<div id="'+f+'"></div>\n')+"...\n",a=a+('<script type="text/javascript" src="'+g+'">\x3c/script>\n')+('<script type="text/javascript">embedPC("'+f+'","'+d+'","'+e+'");\x3c/script>\n\n')+"The machine should appear where the <div> is located.",ab(a)):ab("Missing XML/XSL resources")}
window.savePC=function(a,b,c){var d=tb("Computer",a),e=tb("Debugger",a);if(d){var f=EB(d,!0),g=d.M?JSON.stringify(d.M):null;b||(b="/versions/pcx86/1.36.1/pcx86"+(e?"-dbg":"")+".js");if(c&&c({state:f,Nk:g}))return!0;Fa(b,null,!0,function(c,d,e){MC(c,d,e,[a,pa(b,!0),g,f])});return!0}ab("Unable to identify machine '"+a+"'");return!1};})();//# sourceMappingURL=/versions/pcx86/1.36.1/pcx86-dbg.map
function NC(a,b){var c,d,e,f=b[0],g=b[1];c=b[4];if(c=c.match(/^(\s*\(function\(\)\{)([\s\S]*)(}\)\(\);)/)){var h=ob[f],k={},m;for(m in h){var p=h[m],v=ra(m);if("xml"==v){for(v=/[ \t]*<disk [^>]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=v.exec(h[m]);){var u=d[2];u&&(h[u]||(p=p.replace(d[0],"")))}d=m=pa(m)}else"xsl"==v&&(e=m=pa(m));k[m]=p}a&&(k[m="css"]=a);b[2]&&(k[m="parms"]=b[2]);b[3]&&(k[m="state"]=b[3]);d&&e?(a=JSON.stringify(k),g+=".js",c=c[1]+"var resources="+a+";"+c[2]+c[3],c=c.replace(/\u00A9/g,
"&#xA9;"),a=Ta(c,"javascript",!1,g),a=a+(', copy it to your web server as "'+g+'", and then add the following to your web page:\n\n')+('<div id="'+f+'"></div>\n')+"...\n",a=a+('<script type="text/javascript" src="'+g+'">\x3c/script>\n')+('<script type="text/javascript">embedPC("'+f+'","'+d+'","'+e+'");\x3c/script>\n\n')+"The machine should appear where the <div> is located.",ab(a)):ab("Missing XML/XSL resources")}else ab("Unsupported script")}
window.savePC=function(a,b,c){var d=tb("Computer",a),e=tb("Debugger",a);if(d){var f=EB(d,!0),g=d.M?JSON.stringify(d.M):null;b||(b="/versions/pcx86/1.36.2/pcx86"+(e?"-dbg":"")+".js");if(c&&c({state:f,Nk:g}))return!0;Fa(b,null,!0,function(c,d,e){MC(c,d,e,[a,pa(b,!0),g,f])});return!0}ab("Unable to identify machine '"+a+"'");return!1};})();//# sourceMappingURL=/versions/pcx86/1.36.2/pcx86-dbg.map

View file

@ -672,24 +672,24 @@ var Pt="Hard Drive",Ut=["XTC","ATC","COMPAQ"],Qt=[{0:[306,2],1:[375,8],2:[306,6]
112,ru=144,yu=145,su=240,zu=2,mu=4,Fu=0,Gu=2,Ju=0,Ku=1,Bu=3,Lu=5,Mu=8,Ou=10,Zt=12,Qu=15,Hu=224,Iu=228,Ot=0,Du=4,Su=20,Nt=0,$t=1,Wt=2,Xt=4,Yt=8,Vt=32,Ft={800:Z.prototype.wl,801:Z.prototype.xl,802:Z.prototype.vl},Et={496:Z.prototype.Yj,497:Z.prototype.Dk,498:Z.prototype.Fk,499:Z.prototype.Gk,500:Z.prototype.Bk,501:Z.prototype.Ak,502:Z.prototype.Ck,503:Z.prototype.Hk},Ht={800:Z.prototype.Om,801:Z.prototype.Rm,802:Z.prototype.Qm,803:Z.prototype.Pm,807:Z.prototype.gh,811:Z.prototype.gh,815:Z.prototype.gh},
Gt={496:Z.prototype.Zl,497:Z.prototype.dm,498:Z.prototype.bm,499:Z.prototype.cm,500:Z.prototype.Yl,501:Z.prototype.Xl,502:Z.prototype.$l,503:Z.prototype.Wl,1014:Z.prototype.am};Ma(function(){for(var a=cb(document,"pcx86","hdc"),b=0;b<a.length;b++){var c=a[b],d=db(c),d=new Z(d);bb(d,c)}});
function Uu(a,b,c){u.call(this,"Computer",a);var d=this;Vu(this,b);this.U=Fc(this,"autoPower",a);this.D=+Fc(this,"diagnostics",a);0<=this.D&&2>=this.D||(this.D=1);this.F=0;this.ma=a.busWidth||a.buswidth;this.A=Wu;this.M=null;this.J=this.fa=!1;this.pa=Fc(this,"url")||"";this.ra=(Math.random()+.1).toString(36).substr(2,12);this.B=Xu(this);if(this.R=ab("CPU",this.id)){this.Ea=ab("Debugger",this.id);this.C=[];for(b=null;b=tb(this,"Video",b);)this.C.push(b);this.oa=new Gb({id:this.Cd+".bus",busWidth:this.ma},
this.R,this.Ea);var e,f=eb(this.id);this.ba=(this.I=ab("Panel",this.id))&&this.I.ia.print;this.ja=this.wa;this.la=this.print;this.qa=this.qb;this.ba&&(this.ja=this.I.wa,this.la=this.I.print,this.qa=this.I.qb);for(b=0;b<f.length;b++)e=f[b],e.wa=function(a,b,c){Yu(d,a);return d.ja.call(this,a,b,c)}.bind(e),e.print=function(a){return d.la.call(this,a)}.bind(e),e.qb=function(a,b,c){Yu(d,a,b);return d.qa.call(this,a,b,c)}.bind(e);this.H=0;!this.ba&&this.D&&Zu(this);this.qb("PCx86 v1.36.1\nCopyright \u00a9 2012-2017 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");
for(b=0;b<f.length;b++)e=f[b],e.kc&&e.kc(this,this.oa,this.R,this.Ea);Gc(this.R,this.id,function(){bd(d)},1E3/$u);b=null;e=Fc(this,"resume");void 0!==e&&(1<e.length?b=this.L=e:this.A=parseInt(e,10));e=!1;f=Ia("state");f||(e=!0,f=Fc(this,"state",a));f&&(b=this.Y=f,e||(this.J=!0,this.A=Wu),this.A&&(this.N=new Me(this,"1.36.1"),this.N.load()?b=null:delete this.N));!b&&this.A&&(b=av(this))&&(this.J=!0);if(this.aa=b){var g="Loading "+this.aa+"...";wa(this.aa,null,!0,function(a,b,c){c?(d.L=null,d.J=!1,
this.R,this.Ea);var e,f=eb(this.id);this.ba=(this.I=ab("Panel",this.id))&&this.I.ia.print;this.ja=this.wa;this.la=this.print;this.qa=this.qb;this.ba&&(this.ja=this.I.wa,this.la=this.I.print,this.qa=this.I.qb);for(b=0;b<f.length;b++)e=f[b],e.wa=function(a,b,c){Yu(d,a);return d.ja.call(this,a,b,c)}.bind(e),e.print=function(a){return d.la.call(this,a)}.bind(e),e.qb=function(a,b,c){Yu(d,a,b);return d.qa.call(this,a,b,c)}.bind(e);this.H=0;!this.ba&&this.D&&Zu(this);this.qb("PCx86 v1.36.2\nCopyright \u00a9 2012-2017 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");
for(b=0;b<f.length;b++)e=f[b],e.kc&&e.kc(this,this.oa,this.R,this.Ea);Gc(this.R,this.id,function(){bd(d)},1E3/$u);b=null;e=Fc(this,"resume");void 0!==e&&(1<e.length?b=this.L=e:this.A=parseInt(e,10));e=!1;f=Ia("state");f||(e=!0,f=Fc(this,"state",a));f&&(b=this.Y=f,e||(this.J=!0,this.A=Wu),this.A&&(this.N=new Me(this,"1.36.2"),this.N.load()?b=null:delete this.N));!b&&this.A&&(b=av(this))&&(this.J=!0);if(this.aa=b){var g="Loading "+this.aa+"...";wa(this.aa,null,!0,function(a,b,c){c?(d.L=null,d.J=!1,
d.wa("Unable to load machine state from server (error "+c+(b?": "+pa(b):"")+")")):(d.M=b,d.fa=!0);v(d)},function(){d.qb(g,mb.ae)})}else v(this);this.ia.power||(this.U=!0);!c&&this.U&&this.ye(this.ue)}else q("Unable to find CPU component")}ca(Uu,u);function Zu(a){if(!a.H)for(var b=0;b<a.C.length;b++){var c=a.C[b];c&&(c=c.Ef)&&(c.style.opacity="1",c.style.lineHeight="1",a.H++)}}
function Yu(a,b,c){if(a.H)for(var d=0;d<a.C.length;d++){var e=a.C[d];e&&(e=e.Ef)&&(c!=mb.ae||"..."!=b.slice(-3)?Ya(e,b+"\n"):Za(e,b,b+"."))}}function ho(a){var b=a.D;3==a.D&&(a.D++,v(a));return!b}function Vu(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){q(d.message+" ("+c+")")}}a.K=b}function Fc(a,b,c){var d=Ia(b);void 0===d&&a.K&&(d=a.K[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}l=Uu.prototype;
l.ye=function(a,b){for(var c=this,d=eb(this.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:this;if(!ob(f)){ob(f,function(){c.ye(a,b)});return}}a.call(this,b)};function bv(a,b){var c=new Me(a,"1.36.1",cv);if(c.load()&&dv(c)){var d=c.get(ev),e=b?b.get(ev):"unknown";d!=e&&(a.wa("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}
l.ue=function(a){void 0===a&&(a=this.A||(this.M?fv:Wu));if(!this.F){this.F++;var b=!1,c=!1;this.da=!1;var d=this.N||new Me(this,"1.36.1");if(a==Oc)b=!0;else if(a>Wu){if(d.load(this.M)){this.G=new Me(this,"1.36.1",gv);this.G.load()&&(a!=fv&&hv(this,d)&&(a=iv),jv(this.G));this.G.set(ev,ra("Y-m-d H:i:s"));kv(this.G);var e=this.A&&!this.J;if(a==fv||Xa("Click OK to restore the previous PCx86 machine state.")){if(c=dv(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?d.load(g):("error"==f&&"no machine state"!=
l.ye=function(a,b){for(var c=this,d=eb(this.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:this;if(!ob(f)){ob(f,function(){c.ye(a,b)});return}}a.call(this,b)};function bv(a,b){var c=new Me(a,"1.36.2",cv);if(c.load()&&dv(c)){var d=c.get(ev),e=b?b.get(ev):"unknown";d!=e&&(a.wa("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}
l.ue=function(a){void 0===a&&(a=this.A||(this.M?fv:Wu));if(!this.F){this.F++;var b=!1,c=!1;this.da=!1;var d=this.N||new Me(this,"1.36.2");if(a==Oc)b=!0;else if(a>Wu){if(d.load(this.M)){this.G=new Me(this,"1.36.2",gv);this.G.load()&&(a!=fv&&hv(this,d)&&(a=iv),jv(this.G));this.G.set(ev,ra("Y-m-d H:i:s"));kv(this.G);var e=this.A&&!this.J;if(a==fv||Xa("Click OK to restore the previous PCx86 machine state.")){if(c=dv(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?d.load(g):("error"==f&&"no machine state"!=
g?(this.wa("Error: "+g),"unable to verify user"==g&&(Da(lv,""),this.B=null)):this.qb(f+": "+g),jv(d),d.load()?(c=dv(d),e=!0):c=!1))}e&&bv(this,c?d:null)}else a==iv&&d.clear()}else bv(this);delete this.M;delete this.N}e=eb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.R&&(c=mv(this,g,d,b,c));b=[d,a,c];a!=Oc?this.ye(this.ig,b):this.ig(b)}};
function mv(a,b,c,d,e){if(!b.X.Sb){b.X.Sb=!0;if(b.Rb){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/-[0-9]+\./i,"."))));"string"===typeof f&&(f=null);!b.Rb(f,d)&&f&&(b.wa("Unable to restore hardware state")&&(a.Y&&!a.fa?(c.clear(),a.A=Wu,window&&window.location.reload()):a.da=!0),b.Rb(null),e=!1)}b.X.Je=!0;if(!d&&b.ki)for(a=b.ki.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
l.ig=function(a){if(!this.X.Je){var b;a:{if(this.H){if(2==this.D){this.D++;this.qb("Press any key to continue...");b=!1;break a}for(b=0;b<this.C.length;b++){var c=this.C[b];if(c&&(c=c.Ef)){var d=za();c.style.opacity="0";c.style.lineHeight="0";if(0<=d.indexOf("MSIE")||0<=d.indexOf("Trident"))c.style.fontSize="0";c.value=""}}this.H=0}this.D=0;b=!0}if(!b){v(this,!1);this.ye(this.ig,a);return}this.X.Je=!0}b=a[0];c=0>a[1];a=a[2];if(d=this.ia.power)d.textContent="Shutdown";this.X.Sb=!0;this.R&&(mv(this,
this.R,b,c,a),this.R.Gd());this.da&&(hv(this,b),b.clear());!c&&this.G&&(this.G.clear(),delete this.G);this.F=0;gb(this.Cd,Fc(this,"autoScript"))};function hv(a,b){if(!a.X.Yd){if(Xa("There may be a problem with your PCx86 machine.\n\nTo help us diagnose it, click OK to send this PCx86 machine state to http://www.pcjs.org.")){var c=a.B||"";b=b.toString();var d={app:"PCx86",ver:"1.36.1"};d.url=a.pa;d.user=c;d.type="bug";d.data=b;wa("http://www.pcjs.org/api/v1/report",d,!0)}return!0}return!1}
function nv(a,b,c){var d,e="none";if(a.F)return null;a.F--;var f=new Me(a,"1.36.1"),g=new Me(a,"1.36.1",cv),h=ra("Y-m-d H:i:s");g.set(ev,h);f.set(ev,h);f.set(ov,"1.36.1");f.set(pv,window?window.location.href:null);f.set(qv,za());a.R&&a.R.Qb&&(d=a.R.Qb(b,c),"object"===typeof d&&f.set(a.R.id,d),c&&(a.R.X.Sb=!1,!1===d&&(e=null)));for(var h=eb(a.id),k=0;k<h.length;k++){var m=h[k];m.X.Sb&&(m.Qb&&(d=m.Qb(b,c),"object"===typeof d&&f.set(m.id,d)),c&&(m.X.Sb=!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.B&&rv(a,
this.R,b,c,a),this.R.Gd());this.da&&(hv(this,b),b.clear());!c&&this.G&&(this.G.clear(),delete this.G);this.F=0;gb(this.Cd,Fc(this,"autoScript"))};function hv(a,b){if(!a.X.Yd){if(Xa("There may be a problem with your PCx86 machine.\n\nTo help us diagnose it, click OK to send this PCx86 machine state to http://www.pcjs.org.")){var c=a.B||"";b=b.toString();var d={app:"PCx86",ver:"1.36.2"};d.url=a.pa;d.user=c;d.type="bug";d.data=b;wa("http://www.pcjs.org/api/v1/report",d,!0)}return!0}return!1}
function nv(a,b,c){var d,e="none";if(a.F)return null;a.F--;var f=new Me(a,"1.36.2"),g=new Me(a,"1.36.2",cv),h=ra("Y-m-d H:i:s");g.set(ev,h);f.set(ev,h);f.set(ov,"1.36.2");f.set(pv,window?window.location.href:null);f.set(qv,za());a.R&&a.R.Qb&&(d=a.R.Qb(b,c),"object"===typeof d&&f.set(a.R.id,d),c&&(a.R.X.Sb=!1,!1===d&&(e=null)));for(var h=eb(a.id),k=0;k<h.length;k++){var m=h[k];m.X.Sb&&(m.Qb&&(d=m.Qb(b,c),"object"===typeof d&&f.set(m.id,d)),c&&(m.X.Sb=!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.B&&rv(a,
a.B,f.toString()),kv(g)&&kv(f)||(e=null,d=h=!0)):a.A&&(d=!0,h=a.A==sv),d&&f.clear(h)):e=f.toString());c&&(a.X.Sb=!1,b=a.ia.power)&&(b.textContent="Power");a.F=0;return e}l.reset=function(){this.oa&&this.oa.reset&&this.oa.reset();for(var a=eb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.oa&&c.reset&&c.reset()}};l.start=function(a,b){for(var c=eb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};
l.stop=function(a,b){for(var c=eb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
l.Ab=function(a,b,c){var d=this;switch(b){case "power":return this.ia[b]=c,c.onclick=function(){d.F||(d.X.Sb?nv(d,!1,!0):d.ye(d.ue))},!0;case "reset":return this.ia[b]=c,c.onclick=function(){if(d.X.Sb&&!d.F)if(d.R&&(d.R.X.Gd=d.R.X.cb),d.A&&!d.L){var a=d.X.Yd||!Xa("Click OK to reset this PCx86 machine and discard all disk modifications.");nv(d,a,!0);!a&&d.Y?window&&window.location.reload():(a||(d.W=!0),d.ue(Wu),d.W=!1)}else d.reset(),d.R&&d.R.Gd()},!0;case "save":if(ma(xa(),"pcjs.org"))c.parentNode.removeChild(c);
else return this.ia[b]=c,c.onclick=function(){var a=Xu(d,!0);if(a){var b=!!(d.A&&!d.L||d.Y),c=nv(d,b);b?rv(d,a,c):d.wa("Resume disabled, machine state not saved")}},!0}return!1};
function Xu(a,b){var c=a.B;c||((c=Ca(lv),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=tv(a,c))||a.wa("The user ID is invalid.")):b&&a.wa("Browser local storage is not available"));return c}
function tv(a,b){a.B=null;b=wa(xa()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Da(lv,b.data),a.B=b.data)}catch(d){q(d.message+" ("+c+")")}return a.B}function av(a){var b=null;a.B&&(b=xa()+"/api/v1/user?req=load&user="+a.B+"&state="+uv(a,"1.36.1"));return b}
function rv(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=uv(a,"1.36.1");d.data=c;b=wa(xa()+"/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.wa("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.wa(c),Da(lv,""),a.B=null)}}
function tv(a,b){a.B=null;b=wa(xa()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Da(lv,b.data),a.B=b.data)}catch(d){q(d.message+" ("+c+")")}return a.B}function av(a){var b=null;a.B&&(b=xa()+"/api/v1/user?req=load&user="+a.B+"&state="+uv(a,"1.36.2"));return b}
function rv(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=uv(a,"1.36.2");d.data=c;b=wa(xa()+"/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.wa("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.wa(c),Da(lv,""),a.B=null)}}
function tb(a,b,c){a=eb(a.id);for(var d=0;d<a.length;d++){var e=a[d];if(c)c==e&&(c=null);else if(e.type==b)return e}return null}function Tc(a,b){if(a.C.length){var c=0,d=0;!b&&window&&(c=window.scrollX,d=window.scrollY);a=a.C[0];a.F&&a.F.focus();!b&&window&&window.scrollTo(c,d)}}
function bd(a,b){if(a.R){var c=a.R;if(c.ji&&(b||!c.X.cb||c.X.ei)){uf(c,"EAX",c.F);uf(c,"EBX",c.G);uf(c,"ECX",c.H);uf(c,"EDX",c.L);uf(c,"ESP",C(c));uf(c,"EBP",c.M);uf(c,"ESI",c.J);uf(c,"EDI",c.I);uf(c,"CS",c.fa.ha);uf(c,"DS",c.Ga.ha);uf(c,"SS",c.W.ha);uf(c,"ES",c.xa.ha);uf(c,"EIP",F(c));var d=wd(c);uf(c,"PS",d);uf(c,"V",d&2048);uf(c,"D",d&1024);uf(c,"I",d&512);uf(c,"T",d&256);uf(c,"S",d&128);uf(c,"Z",d&64);uf(c,"A",d&16);uf(c,"P",d&4);uf(c,"C",d&1);80386==c.ca&&(uf(c,"FS",c.rb.ha),uf(c,"GS",c.vb.ha),
uf(c,"CR0",c.pa),uf(c,"CR2",c.rd),uf(c,"CR3",c.Vc))}if(d=c.ia.speed)d.textContent=c.X.cb&&c.V.hd?c.V.hd.toFixed(2)+"Mhz":"Stopped"}for(c=0;c<a.C.length;c++)lq(a.C[c],b)}var gv="failsafe",cv="validate",ev="timestamp",ov="version",pv="url",qv="browser",lv="user",Oc=-1,Wu=0,fv=1,iv=2,sv=3,$u=2;Ma(function(){for(var a=cb(document,"pcx86-machine"),b=0;b<a.length;b++)for(var c=a[b],d=db(c),c=cb(c,"pcx86","computer"),e=0;e<c.length;e++){var f=c[e],g=db(f),g=new Uu(g,d,!0);bb(g,f);g.U&&g.ye(g.ue)}});
@ -704,10 +704,10 @@ b:""),null)}
function yv(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");wa(e,null,!0,function(f,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(f=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var k=h[0],m,r=/( [a-z]+=)(['"])(.*?)\2/gi;m=r.exec(f);)k=0>k.toLowerCase().indexOf(m[1].toLowerCase())?k.replace(">",m[0]+">"):k.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=k&&(g=g.replace(h[0],k))}else{c(a,"missing <"+d[1]+
"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,"");a=a.replace(d[0],g);yv(a,b,c)}})}else c(a,null)}
function zv(a,b,c,d){function e(a){if(void 0===h){var b=g&&cb(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=na(a))}function f(a){e("Error: "+a);k&&(--vv||Qa(!0));k=!1}var g,h,k=!0;vv++;Wa[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var r=document.head||document.getElementsByTagName("head")[0],y=document.createElement("style");y.type="text/css";y.styleSheet?y.styleSheet.cssText=m:y.appendChild(document.createTextNode(m));r.appendChild(y)}c||
(c="/versions/pcx86/1.36.1/components.xsl");m=function(d,h){h?wv(c,null,null,!1,e,function(d,k){k?(Va(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(k=h.transformNode(k))?(g.outerHTML=k,--vv||Qa(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(k),(k=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(k,g),--vv||Qa(!0)):f("invalid machine element: "+
(c="/versions/pcx86/1.36.2/components.xsl");m=function(d,h){h?wv(c,null,null,!1,e,function(d,k){k?(Va(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(k=h.transformNode(k))?(g.outerHTML=k,--vv||Qa(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(k),(k=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(k,g),--vv||Qa(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?wv(b,a,d,!0,e,m):xv(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(t){f(t.message)}return k}function Av(a,b,c,d){Qa(!1);return zv(a,b,c,d)}window.embedPC=Av;window.embedPCx86=Av;
window.commandMachine=function(a,b,c,d,e,f){if("script"==e)return gb(c,f)?(b&&(a.disabled=!0),!0):!1;if(d){var g=ab(d,c+".machine");if(g){var h=g.exports;if(h&&(h=h[e]))return h.call(g,f)?(b&&(a.disabled=!0),!0):!1}}console.log("unimplemented: commandMachine('"+c+"','"+d+"','"+e+"','"+f+"')");return!1};window.enableEvents=Qa;window.sendEvent=Sa;
function Bv(a,b,c,d){if(!c&&b){d.push(b);a=Wa[d[0]];b=null;for(var e in a)if(ma(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?wa(b,null,!0,function(a,b){Cv(b,d)}):Cv(null,d)}else q("Error ("+c+") requesting "+a)}
function Cv(a,b){var c,d,e,f=b[0],g=b[1];c=b[4];c=c.match(/^(\s*\(function\(\)\{)([\s\S]*)(}\)\(\);\s*)$/);var h=Wa[f],k={},m;for(m in h){var r=h[m],y=la(m);if("xml"==y){for(y=/[ \t]*<disk [^>]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=y.exec(h[m]);){var t=d[2];t&&(h[t]||(r=r.replace(d[0],"")))}d=m=ka(m)}else"xsl"==y&&(e=m=ka(m));k[m]=r}a&&(k[m="css"]=a);b[2]&&(k[m="parms"]=b[2]);b[3]&&(k[m="state"]=b[3]);d&&e?(a=JSON.stringify(k),g+=".js",c=c[1]+"var resources="+a+";"+c[2]+c[3],c=c.replace(/\u00A9/g,
"&#xA9;"),a=Ka(c,"javascript",!1,g),a=a+(', copy it to your web server as "'+g+'", and then add the following to your web page:\n\n')+('<div id="'+f+'"></div>\n')+"...\n",a=a+('<script type="text/javascript" src="'+g+'">\x3c/script>\n')+('<script type="text/javascript">embedPC("'+f+'","'+d+'","'+e+'");\x3c/script>\n\n')+"The machine should appear where the <div> is located.",q(a)):q("Missing XML/XSL resources")}
window.savePC=function(a,b,c){var d=ab("Computer",a),e=ab("Debugger",a);if(d){var f=nv(d,!0),g=d.K?JSON.stringify(d.K):null;b||(b="/versions/pcx86/1.36.1/pcx86"+(e?"-dbg":"")+".js");if(c&&c({state:f,Dj:g}))return!0;wa(b,null,!0,function(c,d,e){Bv(c,d,e,[a,ka(b,!0),g,f])});return!0}q("Unable to identify machine '"+a+"'");return!1};})();//# sourceMappingURL=/versions/pcx86/1.36.1/pcx86.map
function Cv(a,b){var c,d,e,f=b[0],g=b[1];c=b[4];if(c=c.match(/^(\s*\(function\(\)\{)([\s\S]*)(}\)\(\);)/)){var h=Wa[f],k={},m;for(m in h){var r=h[m],y=la(m);if("xml"==y){for(y=/[ \t]*<disk [^>]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=y.exec(h[m]);){var t=d[2];t&&(h[t]||(r=r.replace(d[0],"")))}d=m=ka(m)}else"xsl"==y&&(e=m=ka(m));k[m]=r}a&&(k[m="css"]=a);b[2]&&(k[m="parms"]=b[2]);b[3]&&(k[m="state"]=b[3]);d&&e?(a=JSON.stringify(k),g+=".js",c=c[1]+"var resources="+a+";"+c[2]+c[3],c=c.replace(/\u00A9/g,
"&#xA9;"),a=Ka(c,"javascript",!1,g),a=a+(', copy it to your web server as "'+g+'", and then add the following to your web page:\n\n')+('<div id="'+f+'"></div>\n')+"...\n",a=a+('<script type="text/javascript" src="'+g+'">\x3c/script>\n')+('<script type="text/javascript">embedPC("'+f+'","'+d+'","'+e+'");\x3c/script>\n\n')+"The machine should appear where the <div> is located.",q(a)):q("Missing XML/XSL resources")}else q("Unsupported script")}
window.savePC=function(a,b,c){var d=ab("Computer",a),e=ab("Debugger",a);if(d){var f=nv(d,!0),g=d.K?JSON.stringify(d.K):null;b||(b="/versions/pcx86/1.36.2/pcx86"+(e?"-dbg":"")+".js");if(c&&c({state:f,Dj:g}))return!0;wa(b,null,!0,function(c,d,e){Bv(c,d,e,[a,ka(b,!0),g,f])});return!0}q("Unable to identify machine '"+a+"'");return!1};})();//# sourceMappingURL=/versions/pcx86/1.36.2/pcx86.map