v1.32.0: The New Year Release

This commit is contained in:
Jeff Parsons 2016-12-30 15:56:00 -08:00 committed by Jeff Parsons
commit f87161f5d6
452 changed files with 14307 additions and 542 deletions

View file

@ -78,7 +78,7 @@ or (at your option) any later version.
You are required to include the following copyright notice, with a link to [{{ site.pcjs.domain }}]({{ site.url }}/):
> [PCjs]({{ site.url }}/) © 2012-2016 by [Jeff Parsons](mailto:Jeff@pcjs.org) ([@jeffpar](http://twitter.com/jeffpar))
> [PCjs]({{ site.url }}/) © 2012-2017 by [Jeff Parsons](mailto:Jeff@pcjs.org) ([@jeffpar](http://twitter.com/jeffpar))
in every source code file of every copy or modified version of this work, and to display that notice on every web page
or computer that runs any version of this software.

View file

@ -177,7 +177,7 @@ Step 5: Enjoy!
---
All I ask is that any page that embeds the simulator also includes attribution, such as:
> [PCjs](http://pcjs.org) © 2012-2016 by [Jeff Parsons](mailto:Jeff@pcjs.org) ([@jeffpar](http://twitter.com/jeffpar))
> [PCjs](http://pcjs.org) © 2012-2017 by [Jeff Parsons](mailto:Jeff@pcjs.org) ([@jeffpar](http://twitter.com/jeffpar))
If you use the default [XML stylesheet](/versions/c1pjs/1.21.6/components.xsl), attribution is automatically inserted,
which relieves you from including it yourself.

View file

@ -29,7 +29,7 @@ the "file:" or "http:" protocol.
- [example3b.html](example3b.html) and [example3b.xml](example3b.xml)
+ Feel free to copy/paste additional components from other machine XML files on [pcjs.org](http://www.pcjs.org/).
+ Remember to display the appropriate attribution on anything you share publicly; e.g.:
[PCjs](http://pcjs.org) © 2012-2016 by [Jeff Parsons](mailto:Jeff@pcjs.org) ([@jeffpar](http://twitter.com/jeffpar))
[PCjs](http://pcjs.org) © 2012-2017 by [Jeff Parsons](mailto:Jeff@pcjs.org) ([@jeffpar](http://twitter.com/jeffpar))
+ Stay in sync with the [PCjs Project](https://github.com/jeffpar/pcjs) repository on GitHub, to keep your copy of PCjs
up-to-date.

View file

@ -14,11 +14,11 @@
<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.31.1</xsl:variable>
<xsl:variable name="APPVERSION">1.32.0</xsl:variable>
<xsl:variable name="SITEHOST">www.pcjs.org</xsl:variable>
<xsl:template name="componentStyles">
<link rel="stylesheet" type="text/css" href="/versions/pcx86/1.31.1/components.css"/>
<link rel="stylesheet" type="text/css" href="/versions/pcx86/1.32.0/components.css"/>
</xsl:template>
<xsl:template name="componentScripts">
@ -250,7 +250,7 @@
</xsl:choose>
<xsl:if test="$APPCLASS = 'pcx86'"><div class="{$CSSCLASS}-reference" style="padding-left:8px">[<a href="#" onclick="savePC('{$machine}'); return false;">Save Machine</a>]</div></xsl:if>
<div class="{$CSSCLASS}-copyright">
<a href="http://{$SITEHOST}" target="_blank"><xsl:value-of select="$APPNAME"/></a> v<xsl:value-of select="$APPVERSION"/> © 2012-2016 by <a href="http://twitter.com/jeffpar" target="_blank">@jeffpar</a>
<a href="http://{$SITEHOST}" target="_blank"><xsl:value-of select="$APPNAME"/></a> v<xsl:value-of select="$APPVERSION"/> © 2012-2017 by <a href="http://twitter.com/jeffpar" target="_blank">@jeffpar</a>
</div>
<div style="clear:both"> </div>
</xsl:if>

View file

@ -1,47 +1,47 @@
(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/pcx86/lib/x86.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/interrupts.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/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/pcx86/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/pcx86/lib/defines.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/panel.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/bus.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/memory.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/cpu.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/x86seg.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/x86cpu.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/x86fpu.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/x86func.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/x86help.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/x86mods.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/x86ops.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/x86op0f.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/chipset.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/rom.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/ram.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/keyboard.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/video.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/parallel.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/serial.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/mouse.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/disk.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/fdc.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/hdc.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/computer.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/shared/lib/state.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/shared/lib/save.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/shared/lib/diskapi.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/dumpapi.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/reportapi.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/userapi.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/keys.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/strlib.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/usrlib.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/weblib.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/x86.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/interrupts.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/messages.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/debugger.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/debugger.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/embed.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/defines.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/component.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/defines.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/panel.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/bus.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/memory.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/cpu.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/x86seg.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/x86cpu.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/x86fpu.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/x86func.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/x86help.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/x86mods.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/x86ops.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/x86op0f.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/chipset.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/rom.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/ram.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/keyboard.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/video.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/parallel.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/serial.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/mouse.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/disk.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/fdc.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/hdc.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/computer.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/state.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/save.js (C) Jeff Parsons 2012-2017
*/
var l,aa,ba={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]},p={vo:0,xo:1,yo:2,dl:3,zo:4,Ao:5,Bo:6,Co:7,Do:8,Eo:9,Fo:10,Go:11,Ho:12,Io:13,Jo:14,Ko:15,Lo:16,Mo:17,No:18,Oo:19,Po:20,Qo:21,Ro:22,So:23,To:24,Uo:25,Vo: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,ue:65,Bi:66,Ci:67,Di:68,E:69,Ei:70,Fi:71,Gi:72,Hi:73,Ii:74,Ji:75,Ki:76,Li:77,Mi:78,Ni:79,Oi:80,Q:81,Pi:82,Qi:83,Ri:84,Si:85,Ti:86,Ui:87,Vi:88,Wi:89,og:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,ve:97,ql:98,sl:99,d:100,e:101,Cl:102,Dl:103,El:104,Fl:105,Vm:106,k:107,Wm:108,$m:109,n:110,gn:111,p:112,q:113,r:114,no:115,t:116,qo:117,ro:118,so:119,x:120,y:121,z:122,
@ -829,28 +829,28 @@ g[0]){Lr(a,g[1],!0);break}Mr(a,g);break;case "m":if("mouse"==g[0]){var ti=g[1],v
null;else if("off"==Ma)vc=!1,Ma=null;else{"keys"==Ma&&(Ma="key");"kbd"==Ma&&(Ma="keyboard");for(uc in Bb)if(Ma==uc){rd=Bb[uc];vc=!!(a.wc&rd);break}if(!rd){a.O("unknown message category: "+Ma);break a}}rd&&("on"==g[2]?(a.wc|=rd,vc=!0):"off"==g[2]&&(a.wc&=~rd,vc=!1))}var qs=0,$e="";for(uc in Bb)if(!Ma||Ma==uc){var rs=!!(a.wc&Bb[uc]);if(null===vc||vc==rs)$e&&($e+=","),++qs%10||($e+="\n\t"),"key"==uc&&(uc="keys"),$e+=uc}void 0===Ma&&a.O("message commands:\n\tm [category] [on|off]\tturn categories on/off");
a.O((null!==vc?vc?"messages on: ":"messages off: ":"message categories:\n\t")+($e||"none"));yq(a)}break;case "o":var ui=g[1],ss=g[2];if(ui&&"?"!=ui){var vi=rq(a,ui,"port #"),wi=rq(a,ss);void 0!==vi&&void 0!==wi&&(wc(a.ga,vi,1,wi),a.O(v(vi)+": "+u(wi)))}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]){Nr(a,b.substr(5));break}var Un="pr"==g[0]?1:0,de=1+Un;if(a.U)a.O("step in progress");
else{var wg,Vn=!1,kb=wq(a,M(a.F),a.F.wa.Z);do switch(wg=!1,a.Qa(kb)){case 38:case 46:case 54:case 62:case 100:case 101:case 102:case 103:case 240:fr(a,kb,1);wg=!0;break;case 204:case 206:a.U=de;fr(a,kb,1);break;case 205:case 224:case 225:case 226:a.U=de;fr(a,kb,kb.Rb?4:2);break;case 232:a.U=de;fr(a,kb,kb.Rb?5:3);break;case 154:a.U=de;fr(a,kb,kb.Rb?7:5);break;case 255:var Wn=a.tb(kb)&14591;if(4351==Wn||6399==Wn)a.U=de,yr(a,kb);break;case 243:case 242:fr(a,kb,1);Vn=wg=!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:Vn&&
(a.U=de,fr(a,kb,1))}while(wg);a.U?(a.Rd(a.B,kb,!0),a.Ne()||(a.X&&a.X.wd(),a.U=0)):Pr(a,Un?"tr":"t")}break;case "r":if("reset"==b){a.X&&a.X.reset();break}qr(a,g);break;case "t":Pr(a,g[0],g[1]);break;case "u":rr(a,g[1],g[2],8);break;case "v":if("var"==g[0]){Kr(a,b.substr(3))||(d=!1);break}a.O("PCx86 version 1.31.1 ("+a.F.ja+",RELEASE,NOPREFETCH"+(xb?",TYPEDARRAYS":",LONGARRAYS")+",NOBACKTRACK)");a.O(Ca());break;case "x":a:if(g[1]&&"?"!=g[1])switch(g[1]){case "cs":var af;void 0!==g[3]&&(af=+g[3]);switch(g[2]){case "int":a.F.Y.jf=
(a.U=de,fr(a,kb,1))}while(wg);a.U?(a.Rd(a.B,kb,!0),a.Ne()||(a.X&&a.X.wd(),a.U=0)):Pr(a,Un?"tr":"t")}break;case "r":if("reset"==b){a.X&&a.X.reset();break}qr(a,g);break;case "t":Pr(a,g[0],g[1]);break;case "u":rr(a,g[1],g[2],8);break;case "v":if("var"==g[0]){Kr(a,b.substr(3))||(d=!1);break}a.O("PCx86 version 1.32.0 ("+a.F.ja+",RELEASE,NOPREFETCH"+(xb?",TYPEDARRAYS":",LONGARRAYS")+",NOBACKTRACK)");a.O(Ca());break;case "x":a:if(g[1]&&"?"!=g[1])switch(g[1]){case "cs":var af;void 0!==g[3]&&(af=+g[3]);switch(g[2]){case "int":a.F.Y.jf=
af;break;case "start":a.F.Y.Nf=af;break;case "stop":a.F.Y.lf=af;break;default:a.O("unknown cs option");break a}void 0!==af&&Xc(a.F);a.O("checksums "+(a.F.la.Xe?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&(ad(a.F,+g[2])||a.O("warning: using 1x multiplier, previous target not reached"));a.O("target speed: "+(a.F.Y.He.toFixed(2)+"Mhz")+" ("+a.F.Y.Wd+"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]){Nr(a,b.substr(1));break}var xi="commands:",yi;for(yi in Dq)xi+="\n"+pa(yi,7)+Dq[yi];Yf(a)||(xi+="\nnote: frequency/history disabled if no exec breakpoints");a.O(xi);break;default:a.O("unknown command: "+b),d=!1}}}catch(Xn){a.O("debugger error: "+(Xn.stack||Xn.message)),d=!1}return d}function Aq(a,b,c){b=a.Ng(b,c);for(var d in b)if(!xr(a,b[+d]))return!1;return!0}
Za(function(){for(var a=qb(document,"pcx86","debugger"),b=0;b<a.length;b++){var c=a[b],d=nb(c),d=new vq(d);pb(d,c)}});
function Rr(a,b,c){db.call(this,"Computer",a,Rr,67108864);this.la.ic=!1;Sr(this,b);this.fa=Vc(this,"autoPower",a);this.N=0;this.ra=a.busWidth||a.buswidth;this.A=Tr;this.aa=null;this.V=this.pa=!1;this.ua=Vc(this,"url")||"";this.ya=(Math.random()+.1).toString(36).substr(2,12);this.B=Ur(this);if(this.F=mb("CPU",this.id)){this.ha=mb("Debugger",this.id);this.L=[];for(b=null;b=Gb(this,"Video",b);)this.L.push(b);this.ga=new Ob({id:this.ce+".bus",busWidth:this.ra},this.F,this.ha);var d,e=jb(this.id);if((this.C=
mb("Panel",this.id))&&this.C.Gf)for(b=0;b<e.length;b++)d=e[b],d.Na=this.C.Na,d.O=this.C.O,d.Gf=this.C.Gf;this.O("PCx86 v1.31.1\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");for(b=0;b<e.length;b++)d=e[b],d.Jc&&d.Jc(this,this.ga,this.F,this.ha);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.W=d:this.A=parseInt(d,10));var f;if(a=Vc(this,"state")||(f=!0,a.state))b=this.ia=a,f||(this.V=!0,this.A=Tr),this.A&&(this.ea=new nf(this,
"1.31.1"),this.ea.load()?b=null:delete this.ea);!b&&this.A&&(b=Vr(this))&&(this.V=!0);if(b){var g=this;Aa(b,null,!0,function(a,b,c){c?(g.W=null,g.V=!1,g.Na("Unable to load machine state from server (error "+c+(b?": "+qa(b):"")+")")):(g.aa=b,g.pa=!0);ub(g)})}else ub(this);this.qa.power||(this.fa=!0);!c&&this.fa&&Wr(this,this.dg)}else w("Unable to find CPU component")}gb(Rr);var Tr=0;l=Rr.prototype;l.gf=function(){return this.ya};
mb("Panel",this.id))&&this.C.Gf)for(b=0;b<e.length;b++)d=e[b],d.Na=this.C.Na,d.O=this.C.O,d.Gf=this.C.Gf;this.O("PCx86 v1.32.0\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<e.length;b++)d=e[b],d.Jc&&d.Jc(this,this.ga,this.F,this.ha);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.W=d:this.A=parseInt(d,10));var f;if(a=Vc(this,"state")||(f=!0,a.state))b=this.ia=a,f||(this.V=!0,this.A=Tr),this.A&&(this.ea=new nf(this,
"1.32.0"),this.ea.load()?b=null:delete this.ea);!b&&this.A&&(b=Vr(this))&&(this.V=!0);if(b){var g=this;Aa(b,null,!0,function(a,b,c){c?(g.W=null,g.V=!1,g.Na("Unable to load machine state from server (error "+c+(b?": "+qa(b):"")+")")):(g.aa=b,g.pa=!0);ub(g)})}else ub(this);this.qa.power||(this.fa=!0);!c&&this.fa&&Wr(this,this.dg)}else w("Unable to find CPU component")}gb(Rr);var Tr=0;l=Rr.prototype;l.gf=function(){return this.ya};
function Sr(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){w(d.message+" ("+c+")")}}a.U=b}function Vc(a,b,c){var d=b.toLowerCase(),d=Na(b)||Na(d);void 0===d&&a.U&&(d=a.U[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}l.ie=function(){return this.B||""};function Wr(a,b,c){for(var d=jb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!vb(f)){vb(f,function(){Wr(a,b,c)});return}}b.call(a,c)}
function Xr(a,b){var c=new nf(a,"1.31.1","validate");if(c.load()&&Yr(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.Na("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}
l.dg=function(a){void 0===a&&(a=this.A||(this.aa?1:Tr));if(!this.N){this.N++;var b=!1,c=!1;this.ka=!1;var d=this.ea||new nf(this,"1.31.1");if(-1==a)b=!0;else if(a>Tr){if(d.load(this.aa)){this.X=new nf(this,"1.31.1","failsafe");this.X.load()&&(Zr(this,d),a=2,$r(this.X));this.X.set("timestamp",ua());as(this.X);var e=this.A&&!this.V;if(1==a||Ea("Click OK to restore the previous PCx86 machine state, or CANCEL to reset the machine.")){if(c=Yr(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?d.load(g):
function Xr(a,b){var c=new nf(a,"1.32.0","validate");if(c.load()&&Yr(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.Na("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}
l.dg=function(a){void 0===a&&(a=this.A||(this.aa?1:Tr));if(!this.N){this.N++;var b=!1,c=!1;this.ka=!1;var d=this.ea||new nf(this,"1.32.0");if(-1==a)b=!0;else if(a>Tr){if(d.load(this.aa)){this.X=new nf(this,"1.32.0","failsafe");this.X.load()&&(Zr(this,d),a=2,$r(this.X));this.X.set("timestamp",ua());as(this.X);var e=this.A&&!this.V;if(1==a||Ea("Click OK to restore the previous PCx86 machine state, or CANCEL to reset the machine.")){if(c=Yr(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?d.load(g):
("error"==f&&"no machine state"!=g?(this.Na("Error: "+g),"unable to verify user"==g&&(Ia("user",""),this.B=null)):this.O(f+": "+g),$r(d),d.load()?(c=Yr(d),e=!0):c=!1))}e&&Xr(this,c?d:null)}else 2==a&&d.clear()}else Xr(this);delete this.aa;delete this.ea}e=jb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.F&&(c=bs(this,g,d,b,c));b=[d,a,c];-1!=a?Wr(this,this.qj,b):this.qj(b)}};
function bs(a,b,c,d,e){if(!b.la.ic){b.la.ic=!0;if(b.hc){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.hc(f,d)&&f&&(w("Unable to restore state for "+b.type),a.ia&&!a.pa?(c.clear(),a.A=Tr,window&&window.location.reload()):a.ka=!0,b.hc(null),e=!1)}if(!d&&b.al)for(a=b.al.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
l.qj=function(a){var b=a[0],c=0>a[1];a=a[2];this.va=!0;this.la.ic=!0;var d=this.qa.power;d&&(d.textContent="Shutdown");this.F&&(bs(this,this.F,b,c,a),this.F.Cf());this.ka&&(Zr(this,b),b.clear());!c&&this.X&&(this.X.clear(),delete this.X);this.N=0};
function Zr(a,b){if(Ea("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.ie();b=b.toString();var d={app:"PCx86",ver:"1.31.1"};d.url=a.ua;d.user=c;d.type="bug";d.data=b;Aa("http://www.pcjs.org/api/v1/report",d,!0)}}
function Qr(a,b,c){var d,e="none";if(a.N)return null;a.N--;var f=new nf(a,"1.31.1"),g=new nf(a,"1.31.1","validate"),h=ua();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.31.1");f.set("url",window?window.location.href:null);f.set("browser",Ca());a.F&&a.F.gc&&(c&&a.F.Wb(),d=a.F.gc(b,c),"object"===typeof d&&f.set(a.F.id,d),c&&(a.F.la.ic=!1,!1===d&&(e=null)));for(var h=jb(a.id),k=0;k<h.length;k++){var m=h[k];m.la.ic&&(m.gc&&(d=m.gc(b,c),"object"===typeof d&&f.set(m.id,d)),c&&(m.la.ic=!1,
function Zr(a,b){if(Ea("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.ie();b=b.toString();var d={app:"PCx86",ver:"1.32.0"};d.url=a.ua;d.user=c;d.type="bug";d.data=b;Aa("http://www.pcjs.org/api/v1/report",d,!0)}}
function Qr(a,b,c){var d,e="none";if(a.N)return null;a.N--;var f=new nf(a,"1.32.0"),g=new nf(a,"1.32.0","validate"),h=ua();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.32.0");f.set("url",window?window.location.href:null);f.set("browser",Ca());a.F&&a.F.gc&&(c&&a.F.Wb(),d=a.F.gc(b,c),"object"===typeof d&&f.set(a.F.id,d),c&&(a.F.la.ic=!1,!1===d&&(e=null)));for(var h=jb(a.id),k=0;k<h.length;k++){var m=h[k];m.la.ic&&(m.gc&&(d=m.gc(b,c),"object"===typeof d&&f.set(m.id,d)),c&&(m.la.ic=!1,
!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.B&&cs(a,a.B,f.toString()),as(g)&&as(f)||(e=null,d=h=!0)):a.A&&(d=!0,h=3==a.A),d&&f.clear(h)):e=f.toString());c&&(a.la.ic=!1,b=a.qa.power)&&(b.textContent="Power");a.N=0;return e}l.reset=function(){this.ga&&this.ga.reset&&(y(this,"Resetting "+this.ga.type),this.ga.reset());for(var a=jb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.ga&&c.reset&&(y(this,"Resetting "+c.type),c.reset())}};
l.start=function(a,b){for(var c=jb(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=jb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
l.Pb=function(a,b,c){var d=this;switch(b){case "power":return this.qa[b]=c,c.onclick=function(){d.N||(d.la.ic?Qr(d,!1,!0):Wr(d,d.dg))},!0;case "reset":return this.qa[b]=c,c.onclick=function(){if(d.la.ic&&!d.N)if(d.A&&!d.W){var a=Ea("Click OK to save changes to this PCx86 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Qr(d,a,!0);!a&&d.ia?window&&window.location.reload():(a||(d.lh=!0),d.dg(Tr),d.lh=!1)}else d.reset(),d.F&&d.F.Cf()},!0;case "save":if(ma(Ba(),"pcjs.org"))c.parentNode.removeChild(c);
else return this.qa[b]=c,c.onclick=function(){var a=Ur(d,!0);if(a){var b=!!(d.A&&!d.W||d.ia),c=Qr(d,b);b?cs(d,a,c):d.Na("Resume disabled, machine state not saved")}},!0}return!1};
function Ur(a,b){var c=a.B;c||((c=Ha("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=ds(a,c))||a.Na("The user ID is invalid.")):b&&a.Na("Browser local storage is not available"));return c}
function ds(a,b){a.B=null;b=Aa(Ba()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Ia("user",b.data),a.B=b.data)}catch(d){w(d.message+" ("+c+")")}return a.B}function Vr(a){var b=null;a.B&&(b=Ba()+"/api/v1/user?req=load&user="+a.B+"&state="+es(a,"1.31.1"));return b}
function cs(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=es(a,"1.31.1");d.data=c;b=Aa(Ba()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.Na("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.Na(c),Ia("user",""),a.B=null)}}
function ds(a,b){a.B=null;b=Aa(Ba()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Ia("user",b.data),a.B=b.data)}catch(d){w(d.message+" ("+c+")")}return a.B}function Vr(a){var b=null;a.B&&(b=Ba()+"/api/v1/user?req=load&user="+a.B+"&state="+es(a,"1.32.0"));return b}
function cs(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=es(a,"1.32.0");d.data=c;b=Aa(Ba()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.Na("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.Na(c),Ia("user",""),a.B=null)}}
function Gb(a,b,c){a=jb(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.wd=function(a){if(this.L.length){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);var d=this.L[0];d.X&&d.X.focus();!a&&window&&window.scrollTo(b,c)}};l.Cc=function(a){this.F&&this.F.Cc(a);this.C&&this.C.Cc(a)};
function gd(a,b){for(var c=0;c<a.L.length;c++)rn(a.L[c],b);if(a.C&&(a=a.C,a.Ja)){Kb(a,18,a.aa,a.Ga);if(a.gb){b=a.ga;var c=a.A,d,e;null==d&&(d=0);null==e&&(e=b.W-d|0);c||(c={ih:0,Td:0,Yg:[]});var f=d>>>b.La;d=d+e-1>>>b.La;c.ih=0;for(c.Td=0;f<=d;)e=b.sa[f],c.ih+=e.size,e.size&&(c.Yg.push(wa(Jb,f,0,0,e.type)),c.Td++),f++;a.A=c;a.ya=a.A.Td*a.ga.Sb/691200;d=0;a.A.fj=0;a.A.Bf||(a.A.Bf=[]);e=-1;b=0;for(var g=-1,c=0;c<a.A.Td;c++){var h=a.A.Yg[c],f=xa(Jb.type,h),h=xa(Jb.Hk,h);if(f!=e||h!=g+1)(g=c-b)&&(d+=
Nb(a,b,g,e)),e=f,b=c;g=h}d+=Nb(a,b,c-b,e);e=a.A.wl!=d;a.A.wl=d;if(e){e=new Eb(0,0,a.aa.width,a.aa.height);a.A.Se=[];b=a.A.Td;for(d=0;d<a.A.fj;d++)c=a.A.Bf[d].Td,a.A.Se.push(Fb(e,c,b,!d)),b-=c;for(d=0;d<a.A.Se.length;d++)e=a.A.Bf[d],b=c=a.A.Se[d],f=a.Ga,(g=Cc[e.type])||(g=new Db),f.strokeStyle="black",f.strokeRect(b.x,b.y,b.bd,b.A),f.fillStyle="string"==typeof g?g:g.toString(),f.fillRect(b.x,b.y,b.bd,b.A),b=a,f=c,b.fa=b.ua,b.W=b.va,c=f.x+(f.bd>>1),g=f.y+(f.A>>1),h=f.A,f.bd<f.A&&(h=f.bd,b.ra=!0,b.N.save(),
@ -865,9 +865,9 @@ a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pcx86$2")
function ts(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");Aa(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,n=/( [a-z]+=)(['"])(.*?)\2/g;m=n.exec(f);)k=0>k.indexOf(m[1])?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);ts(a,b,c)}})}else c(a,null)}
function us(a,b,c,d){function e(a){if(void 0===h){var b=g&&qb(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=oa(a))}function f(a){e("Error: "+a);k&&(--fs||bb(!0));k=!1}var g,h,k=!0;fs++;hb[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var n=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));n.appendChild(t)}c||
(c="/versions/pcx86/1.31.1/components.xsl");m=function(d,h){h?gs(c,null,null,!1,e,function(d,k){k?(ib(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(k=h.transformNode(k))?(g.outerHTML=k,--fs||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),--fs||bb(!0)):f("invalid machine element: "+
(c="/versions/pcx86/1.32.0/components.xsl");m=function(d,h){h?gs(c,null,null,!1,e,function(d,k){k?(ib(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(k=h.transformNode(k))?(g.outerHTML=k,--fs||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),--fs||bb(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?gs(b,a,d,!0,e,m):hs(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(q){f(q.message)}return k}function vs(a,b,c,d){bb(!1);return us(a,b,c,d)}window.embedPC=vs;window.embedPCx86=vs;window.enableEvents=bb;window.sendEvent=cb;
function ws(a,b,c,d){if(!c&&b){d.push(b);a=hb[d[0]];b=null;for(var e in a)if(ma(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?Aa(b,null,!0,function(a,b){xs(b,d)}):xs(null,d)}else w("Error ("+c+") requesting "+a)}
function xs(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=hb[f],k={},m;for(m in h){var n=h[m],t=ka(m);if("xml"==t){for(t=/[ \t]*<disk [^>]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=t.exec(h[m]);){var q=d[2];q&&(h[q]||(n=n.replace(d[0],"")))}d=m=ja(m)}else"xsl"==t&&(e=m=ja(m));k[m]=n}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=Qa(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.",w(a)):w("Missing XML/XSL resources")}
window.savePC=function(a,b,c){var d=mb("Computer",a),e=mb("Debugger",a);if(d){var f=Qr(d,!0),g=d.U?JSON.stringify(d.U):null;b||(b="/versions/pcx86/1.31.1/pcx86"+(e?"-dbg":"")+".js");if(c&&c({state:f,Ok:g}))return!0;Aa(b,null,!0,function(c,d,e){ws(c,d,e,[a,ja(b,!0),g,f])});return!0}w("Unable to identify machine '"+a+"'");return!1};})();
window.savePC=function(a,b,c){var d=mb("Computer",a),e=mb("Debugger",a);if(d){var f=Qr(d,!0),g=d.U?JSON.stringify(d.U):null;b||(b="/versions/pcx86/1.32.0/pcx86"+(e?"-dbg":"")+".js");if(c&&c({state:f,Ok:g}))return!0;Aa(b,null,!0,function(c,d,e){ws(c,d,e,[a,ja(b,!0),g,f])});return!0}w("Unable to identify machine '"+a+"'");return!1};})();

View file

@ -1,47 +1,47 @@
(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/pcx86/lib/x86.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/interrupts.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/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/pcx86/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/pcx86/lib/defines.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/panel.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/bus.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/memory.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/cpu.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/x86seg.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/x86cpu.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/x86fpu.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/x86func.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/x86help.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/x86mods.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/x86ops.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/x86op0f.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/chipset.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/rom.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/ram.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/keyboard.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/video.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/parallel.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/serial.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/mouse.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/disk.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/fdc.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/hdc.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/pcx86/lib/computer.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/shared/lib/state.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/shared/lib/save.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/shared/lib/diskapi.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/dumpapi.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/reportapi.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/userapi.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/keys.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/strlib.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/usrlib.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/weblib.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/x86.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/interrupts.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/messages.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/debugger.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/debugger.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/embed.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/defines.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/component.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/defines.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/panel.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/bus.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/memory.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/cpu.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/x86seg.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/x86cpu.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/x86fpu.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/x86func.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/x86help.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/x86mods.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/x86ops.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/x86op0f.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/chipset.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/rom.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/ram.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/keyboard.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/video.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/parallel.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/serial.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/mouse.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/disk.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/fdc.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/hdc.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/pcx86/lib/computer.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/state.js (C) Jeff Parsons 2012-2017
http://pcjs.org/modules/shared/lib/save.js (C) Jeff Parsons 2012-2017
*/
var l,ba,ca={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={Um:0,Wm:1,Xm:2,Sj:3,Ym:4,Zm:5,$m:6,an:7,bn:8,cn:9,dn:10,en:11,fn:12,gn:13,hn:14,jn:15,kn:16,ln:17,mn:18,nn:19,on:20,pn:21,qn:22,rn:23,sn:24,tn:25,un: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,Kd:65,wh:66,xh:67,yh:68,E:69,zh:70,Ah:71,Bh:72,Ch:73,Dh:74,Eh:75,Fh:76,Gh:77,Ih:78,Kh:79,Mh:80,Q:81,Ph:82,Rh:83,Th:84,Vh:85,Xh:86,Zh:87,ai:88,ci:89,vf:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,Md:97,dk:98,ek:99,d:100,e:101,pk:102,qk:103,rk:104,sk:105,Dl:106,k:107,El:108,Hl:109,n:110,Ml:111,p:112,q:113,r:114,Om:115,t:116,Rm:117,Sm:118,Tm:119,x:120,y:121,z:122,
@ -652,23 +652,23 @@ function an(a,b){if(a.errorCode)return-1;do{if(a.Wa&&a.ua.write(a.Wa,a.Ua++,b))b
var Qm={800:Z.prototype.yl,801:Z.prototype.zl,802:Z.prototype.xl},Pm={496:Z.prototype.Xj,497:Z.prototype.Fk,498:Z.prototype.Hk,499:Z.prototype.Ik,500:Z.prototype.Dk,501:Z.prototype.Ck,502:Z.prototype.Ek,503:Z.prototype.Jk},Sm={800:Z.prototype.Km,801:Z.prototype.Nm,802:Z.prototype.Mm,803:Z.prototype.Lm,807:Z.prototype.nh,811:Z.prototype.nh,815:Z.prototype.nh},Rm={496:Z.prototype.Vl,497:Z.prototype.$l,498:Z.prototype.Yl,499:Z.prototype.Zl,500:Z.prototype.Ul,501:Z.prototype.Tl,502:Z.prototype.Wl,503:Z.prototype.Sl,
1014:Z.prototype.Xl};Ia(function(){for(var a=Za(document,"pcx86","hdc"),b=0;b<a.length;b++){var c=a[b],d=Wa(c),d=new Z(d);Ya(d,c)}});
function nn(a,b,c){Ma.call(this,"Computer",a,nn);this.ea.Vb=!1;on(this,b);this.ba=kc(this,"autoPower",a);this.G=0;this.da=a.busWidth||a.buswidth;this.B=pn;this.R=null;this.K=this.Z=!1;this.ga=kc(this,"url")||"";this.ma=(Math.random()+.1).toString(36).substr(2,12);this.C=qn(this);if(this.A=Va("CPU",this.id)){this.Ia=Va("Debugger",this.id);this.I=[];for(b=null;b=jb(this,"Video",b);)this.I.push(b);this.ia=new rb({id:this.Fe+".bus",busWidth:this.da},this.A,this.Ia);var d,e=Ta(this.id);if((this.D=Va("Panel",
this.id))&&this.D.ng)for(b=0;b<e.length;b++)d=e[b],d.Ba=this.D.Ba,d.rc=this.D.rc,d.ng=this.D.ng;this.rc("PCx86 v1.31.1\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");for(b=0;b<e.length;b++)d=e[b],d.pc&&d.pc(this,this.ia,this.A,this.Ia);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.S=d:this.B=parseInt(d,10));var f;if(a=kc(this,"state")||(f=!0,a.state))b=this.W=a,f||(this.K=!0,this.B=pn),this.B&&(this.P=new ae(this,"1.31.1"),
this.id))&&this.D.ng)for(b=0;b<e.length;b++)d=e[b],d.Ba=this.D.Ba,d.rc=this.D.rc,d.ng=this.D.ng;this.rc("PCx86 v1.32.0\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<e.length;b++)d=e[b],d.pc&&d.pc(this,this.ia,this.A,this.Ia);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.S=d:this.B=parseInt(d,10));var f;if(a=kc(this,"state")||(f=!0,a.state))b=this.W=a,f||(this.K=!0,this.B=pn),this.B&&(this.P=new ae(this,"1.32.0"),
this.P.load()?b=null:delete this.P);!b&&this.B&&(b=rn(this))&&(this.K=!0);if(b){var g=this;sa(b,null,!0,function(a,b,c){c?(g.S=null,g.K=!1,g.Ba("Unable to load machine state from server (error "+c+(b?": "+la(b):"")+")")):(g.R=b,g.Z=!0);t(g)})}else t(this);this.la.power||(this.ba=!0);!c&&this.ba&&sn(this,this.gf)}else r("Unable to find CPU component")}Pa(nn);var pn=0;l=nn.prototype;l.ue=function(){return this.ma};
function on(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){r(d.message+" ("+c+")")}}a.L=b}function kc(a,b,c){var d=b.toLowerCase(),d=Aa(b)||Aa(d);void 0===d&&a.L&&(d=a.L[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}l.zd=function(){return this.C||""};function sn(a,b,c){for(var d=Ta(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!ab(f)){ab(f,function(){sn(a,b,c)});return}}b.call(a,c)}
function tn(a,b){var c=new ae(a,"1.31.1","validate");if(c.load()&&un(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.Ba("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}
l.gf=function(a){void 0===a&&(a=this.B||(this.R?1:pn));if(!this.G){this.G++;var b=!1,c=!1;this.Y=!1;var d=this.P||new ae(this,"1.31.1");if(-1==a)b=!0;else if(a>pn){if(d.load(this.R)){this.H=new ae(this,"1.31.1","failsafe");this.H.load()&&(vn(this,d),a=2,wn(this.H));this.H.set("timestamp",oa());xn(this.H);var e=this.B&&!this.K;if(1==a||ua("Click OK to restore the previous PCx86 machine state, or CANCEL to reset the machine.")){if(c=un(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?d.load(g):("error"==
function tn(a,b){var c=new ae(a,"1.32.0","validate");if(c.load()&&un(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.Ba("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}
l.gf=function(a){void 0===a&&(a=this.B||(this.R?1:pn));if(!this.G){this.G++;var b=!1,c=!1;this.Y=!1;var d=this.P||new ae(this,"1.32.0");if(-1==a)b=!0;else if(a>pn){if(d.load(this.R)){this.H=new ae(this,"1.32.0","failsafe");this.H.load()&&(vn(this,d),a=2,wn(this.H));this.H.set("timestamp",oa());xn(this.H);var e=this.B&&!this.K;if(1==a||ua("Click OK to restore the previous PCx86 machine state, or CANCEL to reset the machine.")){if(c=un(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?d.load(g):("error"==
f&&"no machine state"!=g?(this.Ba("Error: "+g),"unable to verify user"==g&&(ya("user",""),this.C=null)):this.rc(f+": "+g),wn(d),d.load()?(c=un(d),e=!0):c=!1))}e&&tn(this,c?d:null)}else 2==a&&d.clear()}else tn(this);delete this.R;delete this.P}e=Ta(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.A&&(c=yn(this,g,d,b,c));b=[d,a,c];-1!=a?sn(this,this.pi,b):this.pi(b)}};
function yn(a,b,c,d,e){if(!b.ea.Vb){b.ea.Vb=!0;if(b.Ub){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.Ub(f,d)&&f&&(r("Unable to restore state for "+b.type),a.W&&!a.Z?(c.clear(),a.B=pn,window&&window.location.reload()):a.Y=!0,b.Ub(null),e=!1)}if(!d&&b.Yh)for(a=b.Yh.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
l.pi=function(a){var b=a[0],c=0>a[1];a=a[2];this.ka=!0;this.ea.Vb=!0;var d=this.la.power;d&&(d.textContent="Shutdown");this.A&&(yn(this,this.A,b,c,a),this.A.Le());this.Y&&(vn(this,b),b.clear());!c&&this.H&&(this.H.clear(),delete this.H);this.G=0};
function vn(a,b){if(ua("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.zd();b=b.toString();var d={app:"PCx86",ver:"1.31.1"};d.url=a.ga;d.user=c;d.type="bug";d.data=b;sa("http://www.pcjs.org/api/v1/report",d,!0)}}
function zn(a,b,c){var d,e="none";if(a.G)return null;a.G--;var f=new ae(a,"1.31.1"),g=new ae(a,"1.31.1","validate"),h=oa();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.31.1");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.A&&a.A.Tb&&(c&&oc(a.A),d=a.A.Tb(b,c),"object"===typeof d&&f.set(a.A.id,d),c&&(a.A.ea.Vb=!1,!1===d&&(e=null)));for(var h=Ta(a.id),k=0;k<h.length;k++){var m=h[k];m.ea.Vb&&(m.Tb&&(d=m.Tb(b,c),"object"===typeof d&&
function vn(a,b){if(ua("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.zd();b=b.toString();var d={app:"PCx86",ver:"1.32.0"};d.url=a.ga;d.user=c;d.type="bug";d.data=b;sa("http://www.pcjs.org/api/v1/report",d,!0)}}
function zn(a,b,c){var d,e="none";if(a.G)return null;a.G--;var f=new ae(a,"1.32.0"),g=new ae(a,"1.32.0","validate"),h=oa();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.32.0");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.A&&a.A.Tb&&(c&&oc(a.A),d=a.A.Tb(b,c),"object"===typeof d&&f.set(a.A.id,d),c&&(a.A.ea.Vb=!1,!1===d&&(e=null)));for(var h=Ta(a.id),k=0;k<h.length;k++){var m=h[k];m.ea.Vb&&(m.Tb&&(d=m.Tb(b,c),"object"===typeof d&&
f.set(m.id,d)),c&&(m.ea.Vb=!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.C&&An(a,a.C,f.toString()),xn(g)&&xn(f)||(e=null,d=h=!0)):a.B&&(d=!0,h=3==a.B),d&&f.clear(h)):e=f.toString());c&&(a.ea.Vb=!1,b=a.la.power)&&(b.textContent="Power");a.G=0;return e}l.reset=function(){this.ia&&this.ia.reset&&this.ia.reset();for(var a=Ta(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.ia&&c.reset&&c.reset()}};
l.start=function(a,b){for(var c=Ta(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=Ta(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
l.zb=function(a,b,c){var d=this;switch(b){case "power":return this.la[b]=c,c.onclick=function(){d.G||(d.ea.Vb?zn(d,!1,!0):sn(d,d.gf))},!0;case "reset":return this.la[b]=c,c.onclick=function(){if(d.ea.Vb&&!d.G)if(d.B&&!d.S){var a=ua("Click OK to save changes to this PCx86 machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");zn(d,a,!0);!a&&d.W?window&&window.location.reload():(a||(d.pg=!0),d.gf(pn),d.pg=!1)}else d.reset(),d.A&&d.A.Le()},!0;case "save":if(ia(ta(),"pcjs.org"))c.parentNode.removeChild(c);
else return this.la[b]=c,c.onclick=function(){var a=qn(d,!0);if(a){var b=!!(d.B&&!d.S||d.W),c=zn(d,b);b?An(d,a,c):d.Ba("Resume disabled, machine state not saved")}},!0}return!1};
function qn(a,b){var c=a.C;c||((c=xa("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=Bn(a,c))||a.Ba("The user ID is invalid.")):b&&a.Ba("Browser local storage is not available"));return c}
function Bn(a,b){a.C=null;b=sa(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&&(ya("user",b.data),a.C=b.data)}catch(d){r(d.message+" ("+c+")")}return a.C}function rn(a){var b=null;a.C&&(b=ta()+"/api/v1/user?req=load&user="+a.C+"&state="+Cn(a,"1.31.1"));return b}
function An(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Cn(a,"1.31.1");d.data=c;b=sa(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.Ba("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.Ba(c),ya("user",""),a.C=null)}}
function Bn(a,b){a.C=null;b=sa(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&&(ya("user",b.data),a.C=b.data)}catch(d){r(d.message+" ("+c+")")}return a.C}function rn(a){var b=null;a.C&&(b=ta()+"/api/v1/user?req=load&user="+a.C+"&state="+Cn(a,"1.32.0"));return b}
function An(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Cn(a,"1.32.0");d.data=c;b=sa(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.Ba("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.Ba(c),ya("user",""),a.C=null)}}
function jb(a,b,c){a=Ta(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 uc(a,b){if(a.I.length){var c=0,d=0;!b&&window&&(c=window.scrollX,d=window.scrollY);a=a.I[0];a.G&&a.G.focus();!b&&window&&window.scrollTo(c,d)}}l.Rc=function(a){this.A&&this.A.Rc(a);this.D&&this.D.Rc(a)};
function xc(a,b){for(var c=0;c<a.I.length;c++)kl(a.I[c],b);if(a.D&&(a=a.D,a.sa)){ob(a,18,a.S,a.ra);if(a.Ga){b=a.ia;var c=a.B,d,e;null==d&&(d=0);null==e&&(e=b.L-d|0);c||(c={mg:0,gd:0,fg:[]});var f=d>>>b.da;d=d+e-1>>>b.da;c.mg=0;for(c.gd=0;f<=d;)e=b.R[f],c.mg+=e.size,e.size&&(c.fg.push(qa(mb,f,0,0,e.type)),c.gd++),f++;a.B=c;a.ma=a.B.gd*a.ia.xb/691200;d=0;a.B.ii=0;a.B.Ke||(a.B.Ke=[]);e=-1;b=0;for(var g=-1,c=0;c<a.B.gd;c++){var h=a.B.fg[c],f=ra(mb.type,h),h=ra(mb.Cj,h);if(f!=e||h!=g+1)(g=c-b)&&(d+=qb(a,
b,g,e)),e=f,b=c;g=h}d+=qb(a,b,c-b,e);e=a.B.hk!=d;a.B.hk=d;if(e){e=new hb(0,0,a.S.width,a.S.height);a.B.ee=[];b=a.B.gd;for(d=0;d<a.B.ii;d++)c=a.B.Ke[d].gd,a.B.ee.push(ib(e,c,b,!d)),b-=c;for(d=0;d<a.B.ee.length;d++)e=a.B.Ke[d],b=c=a.B.ee[d],f=a.ra,(g=Xb[e.type])||(g=new gb),f.strokeStyle="black",f.strokeRect(b.x,b.y,b.Fc,b.A),f.fillStyle="string"==typeof g?g:g.toString(),f.fillRect(b.x,b.y,b.Fc,b.A),b=a,f=c,b.P=b.ga,b.L=b.ka,c=f.x+(f.Fc>>1),g=f.y+(f.A>>1),h=f.A,f.Fc<f.A&&(h=f.Fc,b.da=!0,b.G.save(),
@ -683,9 +683,9 @@ a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pcx86$2")
function Gn(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");sa(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,q=/( [a-z]+=)(['"])(.*?)\2/g;m=q.exec(f);)k=0>k.indexOf(m[1])?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);Gn(a,b,c)}})}else c(a,null)}
function Hn(a,b,c,d){function e(a){if(void 0===h){var b=g&&Za(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ka(a))}function f(a){e("Error: "+a);k&&(--Dn||Ka(!0));k=!1}var g,h,k=!0;Dn++;Qa[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var q=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));q.appendChild(y)}c||
(c="/versions/pcx86/1.31.1/components.xsl");m=function(d,h){h?En(c,null,null,!1,e,function(d,k){k?(Ra(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(k=h.transformNode(k))?(g.outerHTML=k,--Dn||Ka(!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),--Dn||Ka(!0)):f("invalid machine element: "+
(c="/versions/pcx86/1.32.0/components.xsl");m=function(d,h){h?En(c,null,null,!1,e,function(d,k){k?(Ra(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(k=h.transformNode(k))?(g.outerHTML=k,--Dn||Ka(!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),--Dn||Ka(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?En(b,a,d,!0,e,m):Fn(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(w){f(w.message)}return k}function In(a,b,c,d){Ka(!1);return Hn(a,b,c,d)}window.embedPC=In;window.embedPCx86=In;window.enableEvents=Ka;window.sendEvent=La;
function Jn(a,b,c,d){if(!c&&b){d.push(b);a=Qa[d[0]];b=null;for(var e in a)if(ia(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?sa(b,null,!0,function(a,b){Kn(b,d)}):Kn(null,d)}else r("Error ("+c+") requesting "+a)}
function Kn(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=Qa[f],k={},m;for(m in h){var q=h[m],y=ha(m);if("xml"==y){for(y=/[ \t]*<disk [^>]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=y.exec(h[m]);){var w=d[2];w&&(h[w]||(q=q.replace(d[0],"")))}d=m=ga(m)}else"xsl"==y&&(e=m=ga(m));k[m]=q}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=Ca(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.",r(a)):r("Missing XML/XSL resources")}
window.savePC=function(a,b,c){var d=Va("Computer",a),e=Va("Debugger",a);if(d){var f=zn(d,!0),g=d.L?JSON.stringify(d.L):null;b||(b="/versions/pcx86/1.31.1/pcx86"+(e?"-dbg":"")+".js");if(c&&c({state:f,Gj:g}))return!0;sa(b,null,!0,function(c,d,e){Jn(c,d,e,[a,ga(b,!0),g,f])});return!0}r("Unable to identify machine '"+a+"'");return!1};})();
window.savePC=function(a,b,c){var d=Va("Computer",a),e=Va("Debugger",a);if(d){var f=zn(d,!0),g=d.L?JSON.stringify(d.L):null;b||(b="/versions/pcx86/1.32.0/pcx86"+(e?"-dbg":"")+".js");if(c&&c({state:f,Gj:g}))return!0;sa(b,null,!0,function(c,d,e){Jn(c,d,e,[a,ga(b,!0),g,f])});return!0}r("Unable to identify machine '"+a+"'");return!1};})();