Try to be more consistent when referring to disks vs. drives (eg, Drive Controllers, not Disk Controllers)

This commit is contained in:
Jeff Parsons 2016-05-01 13:47:58 -07:00
commit b04ef7e49f
40 changed files with 5266 additions and 68 deletions

View file

@ -32,8 +32,8 @@ A PCjs machine XML file defines all a machine's components, including:
* [Control Panel](panel/)
* [CPU](cpu/)
* [Debugger](debugger/)
* [Floppy Disk Controller](fdc/)
* [Hard Disk Controller](hdc/)
* [Floppy Drive Controller](fdc/)
* [Hard Drive Controller](hdc/)
* [Keyboard](keyboard/)
* [Mouse](mouse/)
* [RAM](ram/)

View file

@ -13,11 +13,11 @@
<xsl:variable name="CSSCLASS">pcjs</xsl:variable>
<xsl:variable name="APPCLASS">pcjs</xsl:variable>
<xsl:variable name="APPNAME">PCjs</xsl:variable>
<xsl:variable name="APPVERSION">1.21.7</xsl:variable>
<xsl:variable name="APPVERSION">1.22.0</xsl:variable>
<xsl:variable name="SITEHOST">www.pcjs.org</xsl:variable>
<xsl:template name="componentStyles">
<link rel="stylesheet" type="text/css" href="/versions/pcjs/1.21.7/components.css"/>
<link rel="stylesheet" type="text/css" href="/versions/pcjs/1.22.0/components.css"/>
</xsl:template>
<xsl:template name="componentScripts">

View file

@ -774,7 +774,7 @@ g[1],!0);break}Jr(a,g);break;case "m":if("mouse"==g[0]){var yi=g[1],Ag=g[2];if(a
Oa)wc=!1,Oa=null;else{"keys"==Oa&&(Oa="key");"kbd"==Oa&&(Oa="keyboard");for(vc in wq)if(Oa==vc){ud=wq[vc];wc=!!(a.wc&ud);break}if(!ud){a.O("unknown message category: "+Oa);break a}}ud&&("on"==g[2]?(a.wc|=ud,wc=!0):"off"==g[2]&&(a.wc&=~ud,wc=!1))}var os=0,Uc="";for(vc in wq)if(!Oa||Oa==vc){var ps=!!(a.wc&wq[vc]);if(null===wc||wc==ps)Uc&&(Uc+=","),++os%10||(Uc+="\n\t"),"key"==vc&&(vc="keys"),Uc+=vc}void 0===Oa&&a.O("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.O((null!==wc?
wc?"messages on: ":"messages off: ":"message categories:\n\t")+(Uc||"none"));kq(a)}break;case "o":var zi=g[1],qs=g[2];if(zi&&"?"!=zi){var Ai=Eq(a,zi,"port #"),Bi=Eq(a,qs);void 0!==Ai&&void 0!==Bi&&(mc(a.ea,Ai,1,Bi),a.O(u(Ai)+": "+t(Bi)))}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]){Kr(a,b.substr(5));break}var Yn="pr"==g[0]?1:0,fe=1+Yn;if(a.N)a.O("step in progress");else{var Bg,
Zn=!1,lb=iq(a,K(a.F),a.F.va.Z);do switch(Bg=!1,a.Qa(lb)){case 38:case 46:case 54:case 62:case 100:case 101:case 102:case 103:case 240:Uq(a,lb,1);Bg=!0;break;case 204:case 206:a.N=fe;Uq(a,lb,1);break;case 205:case 224:case 225:case 226:a.N=fe;Uq(a,lb,lb.Rb?4:2);break;case 232:a.N=fe;Uq(a,lb,lb.Rb?5:3);break;case 154:a.N=fe;Uq(a,lb,lb.Rb?7:5);break;case 255:var $n=a.tb(lb)&14591;if(4351==$n||6399==$n)a.N=fe,rr(a,lb);break;case 243:case 242:Uq(a,lb,1);Zn=Bg=!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:Zn&&
(a.N=fe,Uq(a,lb,1))}while(Bg);a.N?(a.Sd(a.A,lb,!0),a.Ke()||(a.V&&a.V.yd(),a.N=0)):Mr(a,Yn?"tr":"t")}break;case "r":if("reset"==b){a.V&&a.V.reset();break}jr(a,g);break;case "t":Mr(a,g[0],g[1]);break;case "u":kr(a,g[1],g[2],8);break;case "v":if("var"==g[0]){Hr(a,b.substr(3))||(d=!1);break}a.O("PCjs version 1.21.7 ("+a.F.ia+",RELEASE,NOPREFETCH"+(vb?",TYPEDARRAYS":",LONGARRAYS")+",NOBACKTRACK)");a.O(ya());break;case "x":a:if(g[1]&&"?"!=g[1])switch(g[1]){case "cs":var bf;void 0!==g[3]&&(bf=+g[3]);switch(g[2]){case "int":a.F.Y.jf=
(a.N=fe,Uq(a,lb,1))}while(Bg);a.N?(a.Sd(a.A,lb,!0),a.Ke()||(a.V&&a.V.yd(),a.N=0)):Mr(a,Yn?"tr":"t")}break;case "r":if("reset"==b){a.V&&a.V.reset();break}jr(a,g);break;case "t":Mr(a,g[0],g[1]);break;case "u":kr(a,g[1],g[2],8);break;case "v":if("var"==g[0]){Hr(a,b.substr(3))||(d=!1);break}a.O("PCjs version 1.22.0 ("+a.F.ia+",RELEASE,NOPREFETCH"+(vb?",TYPEDARRAYS":",LONGARRAYS")+",NOBACKTRACK)");a.O(ya());break;case "x":a:if(g[1]&&"?"!=g[1])switch(g[1]){case "cs":var bf;void 0!==g[3]&&(bf=+g[3]);switch(g[2]){case "int":a.F.Y.jf=
bf;break;case "start":a.F.Y.Jf=bf;break;case "stop":a.F.Y.lf=bf;break;default:a.O("unknown cs option");break a}void 0!==bf&&Pc(a.F);a.O("checksums "+(a.F.la.Ye?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&(Xc(a.F,+g[2])||a.O("warning: using 1x multiplier, previous target not reached"));a.O("target speed: "+(a.F.Y.Fe.toFixed(2)+"Mhz")+" ("+a.F.Y.Yd+"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]){Kr(a,b.substr(1));break}var cf="commands:",Ci;for(Ci in pq)cf+="\n"+ma(Ci,7)+pq[Ci];Tf(a)||(cf+="\nnote: frequency/history disabled if no exec breakpoints");a.O(cf);break;default:a.O("unknown command: "+b),d=!1}}}catch(ao){a.O("debugger error: "+(ao.stack||ao.message)),d=!1}return d}function mq(a,b,c){b=cr(a,b,c);for(var d in b)if(!qr(a,b[d]))return!1;return!0}
Qa(function(){for(var a=nb(document,"pcjs","debugger"),b=0;b<a.length;b++){var c=a[b],d=jb(c),d=new hq(d);mb(d,c)}});function hf(a,b,c){this.id=a.id;this.key=Or(a,b,c);this.ha=a.ha;Pr(this,a.gk)}function Or(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
@ -782,7 +782,7 @@ hf.prototype={constructor:hf,value:function(){return this[this.id]},data:functio
this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,1);c=0}}};function Pr(a,b){a[a.id]={};b&&N(a,"parms",b);a.A=!1}function Qr(a){var b=!0;if(Ca()){var c=JSON.stringify(a[a.id]);Fa(a.key,c)||(w("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Rr(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){w(c.message||c),b=!1}return b}function Sr(a,b){return a[a.id][b]||null}function N(a,b,c){try{a[a.id][b]=c}catch(d){}}
function Tr(a,b,c){Ua.call(this,"Computer",a,Tr,67108864);this.la.cc=!1;Ur(this,b);this.ga=Nc(this,"autoPower",a);this.N=0;this.ua=a.busWidth||a.buswidth;this.A=Vr;this.aa=null;this.W=this.ra=!1;this.wa=Nc(this,"url")||"";this.ya=(Math.random()+.1).toString(36).substr(2,12);this.B=Wr(this);if(this.F=ib("CPU",this.id)){this.ha=ib("Debugger",this.id);this.L=[];for(b=null;b=Eb(this,"Video",b);)this.L.push(b);this.ea=new Lb({id:this.ve+".bus",busWidth:this.ua},this.F,this.ha);var d,e=gb(this.id);if((this.C=
ib("Panel",this.id))&&this.C.Df)for(b=0;b<e.length;b++)d=e[b],d.Na=this.C.Na,d.O=this.C.O,d.Df=this.C.Df;for(b=0;b<e.length;b++)d=e[b],d.Ic&&d.Ic(this,this.ea,this.F,this.ha);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.X=d:this.A=parseInt(d,10));var f;if(a=Nc(this,"state")||(f=!0,a.state))b=this.ja=a,f||(this.W=!0,this.A=Vr),this.A&&(this.fa=new hf(this,Xr),this.fa.load()?b=null:delete this.fa);!b&&this.A&&(b=Yr(this))&&(this.W=!0);if(b){var g=this;va(b,null,!0,function(a,b,c){c?(g.X=null,g.W=
!1,g.Na("Unable to load machine state from server (error "+c+(b?": "+na(b):"")+")")):(g.aa=b,g.ra=!0);rb(g)})}else rb(this);this.qa.power||(this.ga=!0);!c&&this.ga&&Zr(this,this.$f)}else w("Unable to find CPU component")}db(Tr);var Xr="1.21.7",Vr=0;m=Tr.prototype;m.ff=function(){return this.ya};function Ur(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}
!1,g.Na("Unable to load machine state from server (error "+c+(b?": "+na(b):"")+")")):(g.aa=b,g.ra=!0);rb(g)})}else rb(this);this.qa.power||(this.ga=!0);!c&&this.ga&&Zr(this,this.$f)}else w("Unable to find CPU component")}db(Tr);var Xr="1.22.0",Vr=0;m=Tr.prototype;m.ff=function(){return this.ya};function Ur(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 Nc(a,b,c){var d=b.toLowerCase(),d=Ya[b]||Ya[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}m.ke=function(){return this.B||""};function Zr(a,b,c){for(var d=gb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!sb(f)){sb(f,function(){Zr(a,b,c)});return}}b.call(a,c)}
function $r(a,b){var c=new hf(a,Xr,"validate");if(c.load()&&Rr(c)){var d=Sr(c,"timestamp"),e=b?Sr(b,"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())}}
m.$f=function(a){void 0===a&&(a=this.A||(this.aa?1:Vr));if(!this.N){this.N++;var b=!1,c=!1;this.pa=!1;var d=this.fa||new hf(this,Xr);if(-1==a)b=!0;else if(a>Vr){if(d.load(this.aa)){this.V=new hf(this,Xr,"failsafe");this.V.load()&&(as(this,d),a=2,Pr(this.V));N(this.V,"timestamp",qa());Qr(this.V);var e=this.A&&!this.W;if(1==a||za("Click OK to restore the previous PCjs machine state, or CANCEL to reset the machine.")){if(c=Rr(d)){var f=Sr(d,"code"),g=Sr(d,"data");f&&("ok"==f?d.load(g):("error"==f&&"no machine state"!=
@ -790,7 +790,7 @@ g?(this.Na("Error: "+g),"unable to verify user"==g&&(Fa("user",""),this.B=null))
function bs(a,b,c,d,e){if(!b.la.cc){b.la.cc=!0;if(b.ic){var f=null;e&&((f=Sr(c,b.id))||(f=Sr(c,b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.ic(f,d)&&f&&(w("Unable to restore state for "+b.type),a.ja&&!a.ra?(c.clear(),a.A=Vr,window&&window.location.reload()):a.pa=!0,b.ic(null),e=!1)}if(!d&&b.tk)for(a=b.tk.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
m.Ii=function(a){var b=a[0],c=0>a[1];a=a[2];this.la.cc=!0;var d=this.qa.power;d&&(d.textContent="Shutdown");this.ka||(this.O("PCjs v"+Xr+"\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>"),this.ka=!0);this.F&&(bs(this,this.F,b,c,a),Sc(this.F));this.pa&&(as(this,b),b.clear());!c&&this.V&&(this.V.clear(),delete this.V);this.N=0};
function as(a,b){if(za("There may be a problem with your PCjs machine.\n\nTo help us diagnose it, click OK to send this PCjs machine state to http://www.pcjs.org.")){var c=a.wa,d=a.ke(),e=b.toString(),f={app:"PCjs"};f.ver=Xr;f.url=c;f.user=d;f.type="bug";f.data=e;va("http://www.pcjs.org/api/v1/report",f,!0)}}
function Nr(a,b,c){var d,e="none";if(a.N)return null;a.N--;var f=new hf(a,Xr),g=new hf(a,Xr,"validate"),h=qa();N(g,"timestamp",h);N(f,"timestamp",h);N(f,"version","1.21.7");N(f,"url",window?window.location.href:null);N(f,"browser",ya());a.F&&a.F.hc&&(c&&a.F.Wb(),d=a.F.hc(b,c),"object"===typeof d&&N(f,a.F.id,d),c&&(a.F.la.cc=!1,!1===d&&(e=null)));for(var h=gb(a.id),k=0;k<h.length;k++){var l=h[k];l.la.cc&&(l.hc&&(d=l.hc(b,c),"object"===typeof d&&N(f,l.id,d)),c&&(l.la.cc=!1,!1===d&&(e=null)))}e&&(c?
function Nr(a,b,c){var d,e="none";if(a.N)return null;a.N--;var f=new hf(a,Xr),g=new hf(a,Xr,"validate"),h=qa();N(g,"timestamp",h);N(f,"timestamp",h);N(f,"version","1.22.0");N(f,"url",window?window.location.href:null);N(f,"browser",ya());a.F&&a.F.hc&&(c&&a.F.Wb(),d=a.F.hc(b,c),"object"===typeof d&&N(f,a.F.id,d),c&&(a.F.la.cc=!1,!1===d&&(e=null)));for(var h=gb(a.id),k=0;k<h.length;k++){var l=h[k];l.la.cc&&(l.hc&&(d=l.hc(b,c),"object"===typeof d&&N(f,l.id,d)),c&&(l.la.cc=!1,!1===d&&(e=null)))}e&&(c?
(h=d=!1,b?(a.B&&cs(a,a.B,f.toString()),Qr(g)&&Qr(f)||(e=null,d=h=!0)):a.A&&(d=!0,h=3==a.A),d&&f.clear(h)):e=f.toString());c&&(a.la.cc=!1,b=a.qa.power)&&(b.textContent="Power");a.N=0;return e}m.reset=function(){this.ea&&this.ea.reset&&(y(this,"Resetting "+this.ea.type),this.ea.reset());for(var a=gb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.ea&&c.reset&&(y(this,"Resetting "+c.type),c.reset())}};
m.start=function(a,b){for(var c=gb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};m.stop=function(a,b){for(var c=gb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
m.Pb=function(a,b,c){var d=this;switch(b){case "power":return this.qa[b]=c,c.onclick=function(){d.N||(d.la.cc?Nr(d,!1,!0):Zr(d,d.$f))},!0;case "reset":return this.qa[b]=c,c.onclick=function(){if(d.la.cc&&!d.N)if(d.A&&!d.X){var a=za("Click OK to save changes to this PCjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Nr(d,a,!0);!a&&d.ja?window&&window.location.reload():(a||(d.dh=!0),d.$f(Vr),d.dh=!1)}else d.reset(),d.F&&Sc(d.F)},!0;case "save":if(ha(xa(),"pcjs.org")){c.parentNode.removeChild(c);
@ -809,9 +809,9 @@ h=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,""))
function ss(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");va(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],l,n=/( [a-z]+=)(['"])(.*?)\2/g;l=n.exec(f);)k=0>k.indexOf(l[1])?k.replace(">",l[0]+">"):k.replace(new RegExp(l[1]+"(['\"])(.*?)\\1"),l[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);ss(a,b,c)}})}else c(a,null)}
function ts(a,b,c,d){function e(a){if(void 0===h){var b=g&&nb(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=la(a))}function f(a){e("Error: "+a);k&&(--es||Sa(!0));k=!1}var g,h,k=!0;es++;eb[a]={};try{if(g=document.getElementById(a)){var l;if("object"==typeof resources&&(l=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.styleSheet.cssText=l:q.appendChild(document.createTextNode(l));n.appendChild(q)}c||
(c="/versions/pcjs/1.21.7/components.xsl");l=function(d,h){h?fs(c,null,null,!1,e,function(d,k){if(k)if(fb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=h.transformNode(k);l?(g.outerHTML=l,--es||Sa(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(l=new XSLTProcessor,l.importStylesheet(k),(l=l.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--es||Sa(!0)):f("invalid machine element: "+
(c="/versions/pcjs/1.22.0/components.xsl");l=function(d,h){h?fs(c,null,null,!1,e,function(d,k){if(k)if(fb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var l=h.transformNode(k);l?(g.outerHTML=l,--es||Sa(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(l=new XSLTProcessor,l.importStylesheet(k),(l=l.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--es||Sa(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?fs(b,a,d,!0,e,l):rs(b,null,a,d,!1,e,l)}else f("missing machine element: "+a)}catch(p){f(p.message)}return k}window.embedPC=function(a,b,c,d){Sa(!1);return ts(a,b,c,d)};window.enableEvents=Sa;window.sendEvent=Ta;
function us(a,b,c,d){if(!c&&b){d.push(b);a=eb[d[0]];b=null;for(var e in a)if(ha(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?va(b,null,!0,function(a,b){vs(b,d)}):vs(null,d)}else w("Error ("+c+") requesting "+a)}
function vs(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=eb[f],k={},l;for(l in h){var n=h[l],q=ga(l);if("xml"==q){for(q=/[ \t]*<disk [^>]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=q.exec(h[l]);){var p=d[2];p&&(h[p]||(n=n.replace(d[0],"")))}d=l=fa(l)}else"xsl"==q&&(e=l=fa(l));k[l]=n}a&&(k[l="css"]=a);b[2]&&(k[l="parms"]=b[2]);b[3]&&(k[l="state"]=b[3]);d&&e?(l=JSON.stringify(k),g+=".js",c=c[1]+"var resources="+l+";"+c[2]+c[3],c=c.replace(/\u00A9/g,
"&#xA9;"),c=Ia(c,"javascript",!1,g),c=c+(', copy it to your web server as "'+g+'", and then add the following to your web page:\n\n')+('<div id="'+f+'"></div>\n'),c+="...\n",c+='<script type="text/javascript" src="'+g+'">\x3c/script>\n',c+='<script type="text/javascript">embedPC("'+f+'","'+d+'","'+e+'");\x3c/script>\n\n',c+="The machine should appear where the <div> is located.",w(c)):w("Missing XML/XSL resources")}
window.savePC=function(a,b,c){var d=ib("Computer",a),e=ib("Debugger",a);if(d){var f=Nr(d,!0),g=d.U?JSON.stringify(d.U):null;b||(b="/versions/pcjs/1.21.7/pc"+(e?"-dbg":"")+".js");if(c&&c({state:f,gk:g}))return!0;va(b,null,!0,function(c,d,e){us(c,d,e,[a,fa(b,!0),g,f])});return!0}w("Unable to identify machine '"+a+"'");return!1};})();
window.savePC=function(a,b,c){var d=ib("Computer",a),e=ib("Debugger",a);if(d){var f=Nr(d,!0),g=d.U?JSON.stringify(d.U):null;b||(b="/versions/pcjs/1.22.0/pc"+(e?"-dbg":"")+".js");if(c&&c({state:f,gk:g}))return!0;va(b,null,!0,function(c,d,e){us(c,d,e,[a,fa(b,!0),g,f])});return!0}w("Unable to identify machine '"+a+"'");return!1};})();

View file

@ -600,7 +600,7 @@ be.prototype={constructor:be,value:function(){return this[this.id]},data:functio
this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,1);c=0}}};function ln(a,b){a[a.id]={};b&&C(a,"parms",b);a.A=!1}function mn(a){var b=!0;if(ta()){var c=JSON.stringify(a[a.id]);xa(a.key,c)||(n("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function nn(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){n(c.message||c),b=!1}return b}function on(a,b){return a[a.id][b]||null}function C(a,b,c){try{a[a.id][b]=c}catch(d){}}
function pn(a,b,c){Ia.call(this,"Computer",a,pn);this.ea.Rb=!1;qn(this,b);this.ba=jc(this,"autoPower",a);this.G=0;this.ia=a.busWidth||a.buswidth;this.B=rn;this.S=null;this.K=this.da=!1;this.la=jc(this,"url")||"";this.ma=(Math.random()+.1).toString(36).substr(2,12);this.C=sn(this);if(this.A=Va("CPU",this.id)){this.Ia=Va("Debugger",this.id);this.I=[];for(b=null;b=kb(this,"Video",b);)this.I.push(b);this.ha=new rb({id:this.lf+".bus",busWidth:this.ia},this.A,this.Ia);var d,e=Ta(this.id);if((this.D=Va("Panel",
this.id))&&this.D.gg)for(b=0;b<e.length;b++)d=e[b],d.Ba=this.D.Ba,d.rc=this.D.rc,d.gg=this.D.gg;for(b=0;b<e.length;b++)d=e[b],d.pc&&d.pc(this,this.ha,this.A,this.Ia);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.P=d:this.B=parseInt(d,10));var f;if(a=jc(this,"state")||(f=!0,a.state))b=this.W=a,f||(this.K=!0,this.B=rn),this.B&&(this.R=new be(this,tn),this.R.load()?b=null:delete this.R);!b&&this.B&&(b=un(this))&&(this.K=!0);if(b){var g=this;pa(b,null,!0,function(a,b,c){c?(g.P=null,g.K=!1,g.Ba("Unable to load machine state from server (error "+
c+(b?": "+(String.prototype.trim?b.trim():b.replace(/^\s+|\s+$/g,"")):"")+")")):(g.S=b,g.da=!0);ab(g)})}else ab(this);this.ka.power||(this.ba=!0);!c&&this.ba&&vn(this,this.df)}else n("Unable to find CPU component")}Qa(pn);var tn="1.21.7",rn=0;l=pn.prototype;l.se=function(){return this.ma};function qn(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){n(d.message+" ("+c+")")}}a.L=b}
c+(b?": "+(String.prototype.trim?b.trim():b.replace(/^\s+|\s+$/g,"")):"")+")")):(g.S=b,g.da=!0);ab(g)})}else ab(this);this.ka.power||(this.ba=!0);!c&&this.ba&&vn(this,this.df)}else n("Unable to find CPU component")}Qa(pn);var tn="1.22.0",rn=0;l=pn.prototype;l.se=function(){return this.ma};function qn(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){n(d.message+" ("+c+")")}}a.L=b}
function jc(a,b,c){var d=b.toLowerCase(),d=La[b]||La[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.Ad=function(){return this.C||""};function vn(a,b,c){for(var d=Ta(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!bb(f)){bb(f,function(){vn(a,b,c)});return}}b.call(a,c)}
function wn(a,b){var c=new be(a,tn,"validate");if(c.load()&&nn(c)){var d=on(c,"timestamp"),e=b?on(b,"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.df=function(a){void 0===a&&(a=this.B||(this.S?1:rn));if(!this.G){this.G++;var b=!1,c=!1;this.Z=!1;var d=this.R||new be(this,tn);if(-1==a)b=!0;else if(a>rn){if(d.load(this.S)){this.H=new be(this,tn,"failsafe");this.H.load()&&(xn(this,d),a=2,ln(this.H));C(this.H,"timestamp",la());mn(this.H);var e=this.B&&!this.K;if(1==a||ra("Click OK to restore the previous PCjs machine state, or CANCEL to reset the machine.")){if(c=nn(d)){var f=on(d,"code"),g=on(d,"data");f&&("ok"==f?d.load(g):("error"==f&&"no machine state"!=
@ -608,7 +608,7 @@ g?(this.Ba("Error: "+g),"unable to verify user"==g&&(xa("user",""),this.C=null))
function yn(a,b,c,d,e){if(!b.ea.Rb){b.ea.Rb=!0;if(b.Vb){var f=null;e&&((f=on(c,b.id))||(f=on(c,b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.Vb(f,d)&&f&&(n("Unable to restore state for "+b.type),a.W&&!a.da?(c.clear(),a.B=rn,window&&window.location.reload()):a.Z=!0,b.Vb(null),e=!1)}if(!d&&b.zh)for(a=b.zh.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
l.Nh=function(a){var b=a[0],c=0>a[1];a=a[2];this.ea.Rb=!0;var d=this.ka.power;d&&(d.textContent="Shutdown");this.Y||(this.rc("PCjs v"+tn+"\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>"),this.Y=!0);this.A&&(yn(this,this.A,b,c,a),nc(this.A));this.Z&&(xn(this,b),b.clear());!c&&this.H&&(this.H.clear(),delete this.H);this.G=0};
function xn(a,b){if(ra("There may be a problem with your PCjs machine.\n\nTo help us diagnose it, click OK to send this PCjs machine state to http://www.pcjs.org.")){var c=a.la,d=a.Ad(),e=b.toString(),f={app:"PCjs"};f.ver=tn;f.url=c;f.user=d;f.type="bug";f.data=e;pa("http://www.pcjs.org/api/v1/report",f,!0)}}
function zn(a,b,c){var d,e="none";if(a.G)return null;a.G--;var f=new be(a,tn),g=new be(a,tn,"validate"),h=la();C(g,"timestamp",h);C(f,"timestamp",h);C(f,"version","1.21.7");C(f,"url",window?window.location.href:null);C(f,"browser",window?window.navigator.userAgent:"");a.A&&a.A.Ub&&(c&&oc(a.A),d=a.A.Ub(b,c),"object"===typeof d&&C(f,a.A.id,d),c&&(a.A.ea.Rb=!1,!1===d&&(e=null)));for(var h=Ta(a.id),k=0;k<h.length;k++){var m=h[k];m.ea.Rb&&(m.Ub&&(d=m.Ub(b,c),"object"===typeof d&&C(f,m.id,d)),c&&(m.ea.Rb=
function zn(a,b,c){var d,e="none";if(a.G)return null;a.G--;var f=new be(a,tn),g=new be(a,tn,"validate"),h=la();C(g,"timestamp",h);C(f,"timestamp",h);C(f,"version","1.22.0");C(f,"url",window?window.location.href:null);C(f,"browser",window?window.navigator.userAgent:"");a.A&&a.A.Ub&&(c&&oc(a.A),d=a.A.Ub(b,c),"object"===typeof d&&C(f,a.A.id,d),c&&(a.A.ea.Rb=!1,!1===d&&(e=null)));for(var h=Ta(a.id),k=0;k<h.length;k++){var m=h[k];m.ea.Rb&&(m.Ub&&(d=m.Ub(b,c),"object"===typeof d&&C(f,m.id,d)),c&&(m.ea.Rb=
!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.C&&An(a,a.C,f.toString()),mn(g)&&mn(f)||(e=null,d=h=!0)):a.B&&(d=!0,h=3==a.B),d&&f.clear(h)):e=f.toString());c&&(a.ea.Rb=!1,b=a.ka.power)&&(b.textContent="Power");a.G=0;return e}l.reset=function(){this.ha&&this.ha.reset&&this.ha.reset();for(var a=Ta(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.ha&&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.ka[b]=c,c.onclick=function(){d.G||(d.ea.Rb?zn(d,!1,!0):vn(d,d.df))},!0;case "reset":return this.ka[b]=c,c.onclick=function(){if(d.ea.Rb&&!d.G)if(d.B&&!d.P){var a=ra("Click OK to save changes to this PCjs 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.jg=!0),d.df(rn),d.jg=!1)}else d.reset(),d.A&&nc(d.A)},!0;case "save":if(ha(qa(),"pcjs.org")){c.parentNode.removeChild(c);
@ -627,9 +627,9 @@ h=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,""))
function Fn(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");pa(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/g;m=p.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);Fn(a,b,c)}})}else c(a,null)}
function Gn(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=ja(a))}function f(a){e("Error: "+a);k&&(--Cn||Ga(!0));k=!1}var g,h,k=!0;Cn++;Ra[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],x=document.createElement("style");x.type="text/css";x.styleSheet?x.styleSheet.cssText=m:x.appendChild(document.createTextNode(m));p.appendChild(x)}c||
(c="/versions/pcjs/1.21.7/components.xsl");m=function(d,h){h?Dn(c,null,null,!1,e,function(d,k){if(k)if(Sa(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var m=h.transformNode(k);m?(g.outerHTML=m,--Cn||Ga(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(m=new XSLTProcessor,m.importStylesheet(k),(m=m.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(m,g),--Cn||Ga(!0)):f("invalid machine element: "+
(c="/versions/pcjs/1.22.0/components.xsl");m=function(d,h){h?Dn(c,null,null,!1,e,function(d,k){if(k)if(Sa(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var m=h.transformNode(k);m?(g.outerHTML=m,--Cn||Ga(!0)):f("transformNodeToObject failed")}else document.implementation&&document.implementation.createDocument?(m=new XSLTProcessor,m.importStylesheet(k),(m=m.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(m,g),--Cn||Ga(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f(d)}):f(d)};"<"!=b.charAt(0)?Dn(b,a,d,!0,e,m):En(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(r){f(r.message)}return k}window.embedPC=function(a,b,c,d){Ga(!1);return Gn(a,b,c,d)};window.enableEvents=Ga;window.sendEvent=Ha;
function Hn(a,b,c,d){if(!c&&b){d.push(b);a=Ra[d[0]];b=null;for(var e in a)if(ha(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?pa(b,null,!0,function(a,b){In(b,d)}):In(null,d)}else n("Error ("+c+") requesting "+a)}
function In(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=Ra[f],k={},m;for(m in h){var p=h[m],x=ga(m);if("xml"==x){for(x=/[ \t]*<disk [^>]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=x.exec(h[m]);){var r=d[2];r&&(h[r]||(p=p.replace(d[0],"")))}d=m=fa(m)}else"xsl"==x&&(e=m=fa(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?(m=JSON.stringify(k),g+=".js",c=c[1]+"var resources="+m+";"+c[2]+c[3],c=c.replace(/\u00A9/g,
"&#xA9;"),c=za(c,"javascript",!1,g),c=c+(', copy it to your web server as "'+g+'", and then add the following to your web page:\n\n')+('<div id="'+f+'"></div>\n'),c+="...\n",c+='<script type="text/javascript" src="'+g+'">\x3c/script>\n',c+='<script type="text/javascript">embedPC("'+f+'","'+d+'","'+e+'");\x3c/script>\n\n',c+="The machine should appear where the <div> is located.",n(c)):n("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/pcjs/1.21.7/pc"+(e?"-dbg":"")+".js");if(c&&c({state:f,fj:g}))return!0;pa(b,null,!0,function(c,d,e){Hn(c,d,e,[a,fa(b,!0),g,f])});return!0}n("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/pcjs/1.22.0/pc"+(e?"-dbg":"")+".js");if(c&&c({state:f,fj:g}))return!0;pa(b,null,!0,function(c,d,e){Hn(c,d,e,[a,fa(b,!0),g,f])});return!0}n("Unable to identify machine '"+a+"'");return!1};})();

View file

@ -4,7 +4,7 @@ title: PCjs &lt;fdc&gt; Element
permalink: /docs/pcjs/fdc/
---
PCjs Floppy Disk Controller (FDC) Component
PCjs Floppy Drive Controller (FDC) Component
---
Format
@ -13,7 +13,7 @@ Format
Purpose
---
Creates an instance of the Floppy Disk Controller (FDC) component. The FDC is responsible for:
Creates an instance of the Floppy Drive Controller (FDC) component. The FDC is responsible for:
- Automatically loading diskette image files at boot;
- Simulating the appropriate controller hardware ports;

View file

@ -4,7 +4,7 @@ title: PCjs &lt;hdc&gt; Element
permalink: /docs/pcjs/hdc/
---
PCjs Hard Disk Controller (HDC) Component
PCjs Hard Drive Controller (HDC) Component
---
Format
@ -13,7 +13,7 @@ Format
Purpose
---
Creates an instance of the Hard Disk Controller (HDC) component. The HDC is responsible for:
Creates an instance of the Hard Drive Controller (HDC) component. The HDC is responsible for:
- Automatically loading fixed disk image files at boot;
- Simulating the appropriate controller hardware ports;
@ -30,7 +30,7 @@ Attributes
This is an array definition, with one array entry per fixed disk. Each entry is a drive object definition,
each of which may contain 'name', 'path' and 'type' properties. For example:
[{name:'10Mb Hard Disk',path:'10mb.json',type:3}]
[{name:'10Mb Hard Drive',path:'10mb.json',type:3}]
The 'path' property is optional; if omitted, an empty disk matching the specified drive type will be created
(10mb in the case of drive type 3).
@ -62,7 +62,7 @@ This component has no bindings. Fixed disks cannot be loaded or unloaded once th
Example
---
<hdc id="hdcXT" drives="[{name:'10Mb Hard Disk',type:3}]"/>
<hdc id="hdcXT" drives="[{name:'10Mb Hard Drive',type:3}]"/>
Output
---