diff --git a/_includes/build.html b/_includes/build.html index c264b1518..15a1e8bf6 100644 --- a/_includes/build.html +++ b/_includes/build.html @@ -1 +1 @@ -
+
diff --git a/_includes/machine-engines.html b/_includes/machine-engines.html index 8c273a720..4b86c82c1 100644 --- a/_includes/machine-engines.html +++ b/_includes/machine-engines.html @@ -64,7 +64,7 @@ here and in markout.js. Examples include 'autopower' ('autoPower') and 'automou {% endif %} {% if page.build %} - + {% endif %} {% endfor %} diff --git a/_posts/2015-06-01-debugging-the-ibm-vga-rom.md b/_posts/2015-06-01-debugging-the-ibm-vga-rom.md index b7db6fdb5..2f2b8b7b1 100644 --- a/_posts/2015-06-01-debugging-the-ibm-vga-rom.md +++ b/_posts/2015-06-01-debugging-the-ibm-vga-rom.md @@ -21,7 +21,7 @@ could only be used in PC, XT, and AT-compatible systems. I'll refer to it here The VGA ROM used here is assumed to have come from an original IBM VGA. It's unknown if IBM ever made any revisions to the VGA ROM. With the introduction of the PS/2 family and the VGA, IBM decided to no longer publish the source code for its ROMs, so I've created some assemblable source code from the IBM VGA ROM -[here](/devices/pc/video/ibm/vga/ibm-vga.nasm). +[here](/devices/pc/video/ibm/vga/). I've finally started debugging a machine configuration that uses the IBM VGA ROM. Since the VGA and the 80386 are contemporaries, I'm using an [80386 machine configuration](/devices/pc/machine/compaq/deskpro386/vga/2048kb/machine.xml). diff --git a/docs/pcjs/demos/pc-dbg.js b/docs/pcjs/demos/pc-dbg.js index 56ce9fcc0..c15db53b2 100644 --- a/docs/pcjs/demos/pc-dbg.js +++ b/docs/pcjs/demos/pc-dbg.js @@ -14,8 +14,8 @@ function Ta(a){if(Qa)try{for(var b=0;bMath.abs(a.Y-b)?1:2),1==a.ka?b=a.Y:2==a.ka&&(d=a.O));a.O=d;a.Y=b;if(0<=d&&1280>d&&0<=b&&720>b){a:{c=d;if(960>c&&a.A&&a.A.Ne)for(f=0;fd&&(f=d);c=f;break a}c=-1}if(-1!==c&&(c&=-16,c!=a.Ja)){b=c;if(a.context&&a.qa&&a.ta){e=a.qa.width;a.ta.fillStyle="black";a.ta.fillRect(0,360,e,360);Lb(a,378,a.qa,a.ta);a.wa=a.Ma.width/24|0;if(null==b)Mb(a,"Mouse over memory to dump");else for(Mb(a,"0x"+l(b),null,0,1),f=1;16>=f;f++){d="";for(g=1;8>=g;g++){var k;k=a.ja;var q=b++;k=k.xa[(q&k.Lb)>>>k.Pa].pe(q&k.A,q);Mb(a,l(k,2),null,1);d+=32<=k&&128>k?String.fromCharCode(k):"."}Mb(a,d,null,0,1)}a.context.drawImage(a.qa,0,360,e,360,a.xb,a.Ib,a.cb,a.Yb)}a.Ja= c}}}h.qd=function(){};function Nb(a,b,c,d){a.A.xf[a.A.Ci++]={Xk:b,Qd:c,type:d};return wa(Kb,b,c,0,d)}function Lb(a,b,c,d){var e,f=null.style.color,g=a.Ua=10;a.C=g;a.W=b;a.X=a.Da=18;e||(e=a.Ba||a.Da+"px Monaco, Lucida Console, Courier New");a.la=a.Ba=e;c&&(a.Ma=c);d&&(a.R=d,a.Oa=f||"white")} -function Mb(a,b,c,d,e){a.R.font=a.la;a.R.fillStyle=a.Oa;a.R.fillText(b,a.C,a.W);a.C+=a.wa;null!=c&&(16!=a.rb?b=c.toString():(b=8>a.Ta?"0x":"",b+=l(c,a.Ta)),a.R.fillText(b,a.C,a.W),a.C+=a.wa);d&&(a.C+=a.wa*d);e&&(a.C=a.Ua,a.W+=(a.X+2)*(e||1))}function Ib(){for(var a=!1,b=ob(window.document,"pcjs","panel"),c=0;ca.Ta?"0x":"",b+=l(c,a.Ta)),a.R.fillText(b,a.C,a.W),a.C+=a.wa);d&&(a.C+=a.wa*d);e&&(a.C=a.Ua,a.W+=(a.X+2)*(e||1))}function Ib(){for(var a=!1,b=ob(document,"pcjs","panel"),c=0;c=this.P?12:24>=this.P?14:15;this.Rb=1<>2;this.A=this.Rb-1;this.W=this.X/this.Rb|0;this.O=this.W-1;this.C=[];this.R=[];this.ia=this.Y=!1;this.da=[];this.ka=[];a=new Pb;Qb(a,this.ma);this.xa=Array(this.W);for(b=0;b>>a.Pa;0a.Rb?a.Rb:c;if(g&&g.size){if(g.type==d&&g.controller==e){if(b+c<=g.Ia)return g.Le+=g.Ia-b,g.Ia=b,!0;if(b>=g.Ia+g.Le){q=g.size-(b-k);q>c&&(q=c);g.Le=b-g.Ia+q;c-=q;b=k+a.Rb;continue}}return Yb(a,1,b,c)}g=a.xa[f];b=new Pb(b,q,a.Rb,d,e);Qb(b,a.ma,g);a.xa[f++]=b;b=k+a.Rb;c-=q}return 0>=c?(Zb(a.M),!0):Yb(a,2,b,c)} @@ -134,8 +134,7 @@ function Lf(a,b,c){var d=4;1==b.length&&(d=1,c=c?1:0);if(80386>a.na)2this.na?0:1,e=0;2>e;e++){switch(d){case 0:if(this.za&1&&this.ea&512){var f=Nf(this.R);if(-1<=f&&(this.za&=-2,0<=f)){this.za&=-5;Of.call(this, -f);d=!0;break a}}break;case 1:if(this.za&2){this.za&=-3;80386<=this.na&&(this.Ma[6]|=16384);Of.call(this,1);d=!0;break a}}d=1-d}d=!1}if(d&&!a){this.S("interrupt dispatched");this.V=0;break}if(this.za&4){this.V=this.A=0;break}}if(b){if(Pf(this.ma,this.Na,c)){this.bc();break}c=1}this.V=0;this.W[this.ca()].call(this)}while(0>11;Uf(this);Vf(this,a[b++]);for(c=0;c=Wf&&Xf(a,13))}function Uf(a){a.sa&=-129;a.sa&~a.mc&63&&(a.sa|=128);if(a.sa&128&&!(a.mc&128))return a=a.R,a.na>=Wf?Yf(a,13):a.Ma&0||Of.call(a.M,2),!0;a=a.R;a.na>=Wf&&Xf(a,13);return!1}function Zf(a,b){80387<=a.na||(b&=-65);a.sa|=b;return Uf(a)} @@ -162,9 +161,9 @@ og(this),T(this,0)))},48:function(){W(this,this.A,ag(this,T(this,this.A),T(this, this.nk()},3:function(){ig(this)&&(this.nk(),Dg(this))},4:Wg,6:Xg,7:bh,48:Sg,49:eh,50:function(){W(this,this.A,T(this,0))},51:Zg},222:{0:function(){W(this,0,ag(this,T(this,0),lg(this)))},1:function(){W(this,0,cg(this,T(this,0),lg(this)))},2:function(){eg(this,T(this,0),lg(this))},3:function(){eg(this,T(this,0),lg(this))&&Dg(this)},4:function(){W(this,0,bg(this,T(this,0),lg(this)))},5:function(){W(this,0,bg(this,lg(this),T(this,0)))},6:function(){W(this,0,dg(this,T(this,0),lg(this)))},7:function(){W(this, 0,dg(this,lg(this),T(this,0)))},48:function(){W(this,this.A,ag(this,T(this,this.A),T(this,0)))&&Dg(this)},49:function(){W(this,this.A,cg(this,T(this,this.A),T(this,0)))&&Dg(this)},50:Qg,51:function(){eg(this,T(this,0),T(this,1))&&null!=Dg(this)&&Dg(this)},52:function(){W(this,this.A,bg(this,T(this,0),T(this,this.A)))&&Dg(this)},53:function(){W(this,this.A,bg(this,T(this,this.A),T(this,0)))&&Dg(this)},54:function(){W(this,this.A,dg(this,T(this,0),T(this,this.A)))&&Dg(this)},55:function(){W(this,this.A, dg(this,T(this,this.A),T(this,0)))&&Dg(this)}},223:{0:function(){Eg(this,lg(this))},2:function(){null!=fg(this,T(this,0),32768)&&this.M.pb(this.M.Z,this.ia[0])},3:function(){null!=fg(this,T(this,0),32768)&&(this.M.pb(this.M.Z,this.ia[0]),Dg(this))},4:function(){var a=pg(this),b=Bg(a[0],8)+1E8*Bg(a[1],8)+1E16*Bg(a[2],2);a[2]&32768&&(b=-b);Eg(this,b)},5:function(){var a;a=this.M.ua(this.M.Z);a=4294967296*this.M.ua(this.M.Z+4)+(a>>>0);Eg(this,a)},6:function(){var a=fg(this,Dg(this));null!=a&&(this.O[0]= -Cg(a,8),this.O[1]=Cg(a/1E8,8),this.O[2]=Cg(a/1E16,2),0>a&&(this.O[2]|=32768),zg(this))},7:function(){null!=fg(this,T(this,0),Mg)&&(this.mk(),Dg(this))},48:function(){Sg.call(this);Dg(this)},49:eh,50:$g,51:$g,52:ch}},gh=[Ng,Tg,Ug,Vg,Wg,Xg,ah,Yg,bh,ch];Sa(function(){for(var a=ob(window.document,"pcjs","fpu"),b=0;ba&&(this.O[2]|=32768),zg(this))},7:function(){null!=fg(this,T(this,0),Mg)&&(this.mk(),Dg(this))},48:function(){Sg.call(this);Dg(this)},49:eh,50:$g,51:$g,52:ch}},gh=[Ng,Tg,Ug,Vg,Wg,Xg,ah,Yg,bh,ch];Sa(function(){for(var a=ob(document,"pcjs","fpu"),b=0;b>16,c=c<<16>>16,d=d<<16>>16);this.A-=this.C.cj;(bd)&&p.call(this,5);this.V|=2;return a}function ph(a,b){var c=0;if(b){zf(this);for(var d=1;d&this.B;){if(b&d){a=c;break}d<<=1;c++}}else Bf(this);this.A-=11+3*c;return a}function qh(a,b){var c=0;if(b){zf(this);for(var d=2==this.fa?15:31,e=1<>>=1;c++;d--}}else Bf(this);this.A-=11+3*c;return a} function rh(a,b){a&1<<(b&(2==this.fa?15:31))?sf(this):tf(this);this.A-=-1===this.Z?3:6;this.V|=2;return a}function sh(a,b){var c=1<<(b&(2==this.fa?15:31));a&c?sf(this):tf(this);this.A-=-1===this.Z?6:8;return a^c}function th(a,b){var c=1<<(b&(2==this.fa?15:31));a&c?sf(this):tf(this);this.A-=-1===this.Z?6:8;return a&~c}function uh(a,b){var c=1<<(b&(2==this.fa?15:31));a&c?sf(this):tf(this);this.A-=-1===this.Z?6:8;return a|c} function vh(a,b){if(-1===this.Z)return rh.call(this,a,b);var c=this.fa<<3;if(b>=c||b<-c)a=Gf(this,this.pd,this.rb+(b>>(2==this.fa?4:5))*this.fa);b=1<<(b&(2==this.fa?15:31));a&b?sf(this):tf(this);this.A-=6;this.V|=2;return a}function wh(a,b){if(-1===this.Z)return sh.call(this,a,b);var c=this.fa<<3;if(b>=c||b<-c)a=Gf(this,this.pd,this.rb+(b>>(2==this.fa?4:5))*this.fa);b=1<<(b&(2==this.fa?15:31));a&b?sf(this):tf(this);this.A-=8;return a^b} @@ -855,18 +854,18 @@ b){return fl(this,1,a,b)},66:function(a,b){return fl(this,2,a,b)},67:Xj.prototyp 32:function(a,b,c){bl(this,0,b,c)},33:function(a,b,c){el(this,0,b,c)},64:function(a,b,c){hl(this,0,a,b,c)},65:function(a,b,c){hl(this,1,a,b,c)},66:function(a,b,c){hl(this,2,a,b,c)},67:Xj.prototype.gn,129:function(a,b,c){Vk(this,0,2,a,b,c)},130:function(a,b,c){Vk(this,0,3,a,b,c)},131:function(a,b,c){Vk(this,0,1,a,b,c)},135:function(a,b,c){Vk(this,0,0,a,b,c)}},lk={96:Xj.prototype.hn,97:Xj.prototype.jn,98:Xj.prototype.kn,99:Xj.prototype.mn,160:Xj.prototype.fn},nk={96:Xj.prototype.tm,97:Xj.prototype.um, 100:Xj.prototype.sm,112:Xj.prototype.Im,113:Xj.prototype.Jm,128:function(a,b,c){Xk(this,7,a,b,c)},132:function(a,b,c){Xk(this,0,a,b,c)},133:function(a,b,c){Xk(this,1,a,b,c)},134:function(a,b,c){Xk(this,2,a,b,c)},136:function(a,b,c){Xk(this,3,a,b,c)},137:function(a,b,c){Vk(this,1,2,a,b,c)},138:function(a,b,c){Vk(this,1,3,a,b,c)},139:function(a,b,c){Vk(this,1,1,a,b,c)},140:function(a,b,c){Xk(this,4,a,b,c)},141:function(a,b,c){Xk(this,5,a,b,c)},142:function(a,b,c){Xk(this,6,a,b,c)},143:function(a,b, c){Vk(this,1,0,a,b,c)},160:function(a,b,c){bl(this,1,b,c)},161:function(a,b,c){el(this,1,b,c)},192:function(a,b,c){Lk(this,1,0,a,b,c)},194:function(a,b,c){Nk(this,1,0,a,b,c)},196:function(a,b,c){Lk(this,1,1,a,b,c)},198:function(a,b,c){Nk(this,1,1,a,b,c)},200:function(a,b,c){Lk(this,1,2,a,b,c)},202:function(a,b,c){Nk(this,1,2,a,b,c)},204:function(a,b,c){Lk(this,1,3,a,b,c)},206:function(a,b,c){Nk(this,1,3,a,b,c)},208:function(a,b,c){n(this,768)&&m(this,a,b,c,"DMA1.CMD",null,!0);this.R[1].Zg=b},210:function(a, -b,c){Pk(this,1,a,b,c)},212:function(a,b,c){Qk(this,1,a,b,c)},214:function(a,b,c){Sk(this,1,a,b,c)},216:function(a,b,c){n(this,768)&&m(this,a,b,c,"DMA1.RESET_FF",null,!0);this.R[1].Pb=0},218:function(a,b,c){Tk(this,1,a,b,c)},240:Xj.prototype.Tm,241:Xj.prototype.Um};Sa(function(){for(var a=ob(window.document,"pcjs","chipset"),b=0;b>>4,0,this.ia,this.R,this.Nd),delete this.Nd);return!0};tl.prototype.kc=function(){return!0}; tl.prototype.W=function(a,b,c){if(c)this.Va("Unable to load system ROM (error "+c+": "+a+")");else{if("["==b.charAt(0)||"{"==b.charAt(0))try{var d=eval("("+b+")"),e=d.bytes,f=d.data;if(e)this.A=e;else if(f)for(this.A=Array(4*f.length),c=b=0;b>8&255,this.A[c++]=f[b]>>16&255,this.A[c++]=f[b]>>24&255;else this.A=d;this.Nd=d.symbols;if(!this.A.length){Ba("Empty ROM: "+a);return}if(1==this.A.length){Ba(this.A[0]);return}}catch(g){this.Va("ROM data error: "+ g.message);return}else for(a=b.replace(/\n/gm," ").replace(/ +$/,"").split(" "),this.A=Array(a.length),d=0;d>>d.Pa].tf(e&d.A,a.A[c]&255,e)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.P?b.push(a.P):null!=a.P&&a.P.length&&(b=a.P);for(c=0;cthis.C?21:23,c=a.A[b]|a.A[b+1]<<8,c=c+(this.A>>10);a.A[b]=c&255;a.A[b+ 1]=c>>8;Ak(a)}}else Ba("No RAM allocated")};h.save=function(){var a=new bf(this);this.controller&&cf(a,0,this.controller.save());return a.data()};h.restore=function(a){return this.controller?this.controller.restore(a[0]):!0};function zl(a){this.P=a;this.ma=Bl;this.R=Cl;this.C=Dl;this.A=null}var Al=-2134900736,Bl=65535,Cl=2575,Dl=2,El=[null,0],Fl=[function(a){return this.controller.Wa(a)},null,null,function(a,b){this.controller.tc(a,b)},null,null];h=zl.prototype;h.save=function(){return[this.ma,this.C]}; h.restore=function(a){this.tc(0,a[0]&255);this.tc(2,a[1]&255);return!0};h.Wa=function(a){var b=255;2>a?b=a&1?this.R>>8:this.R&255:4>a&&(b=a&1?this.C>>8:this.C&255);return b};h.tc=function(a,b){if(a)2==a&&(this.C=this.C&-256|b);else if(b!=(this.ma&255)){var c=this.P.ja;if(b&1)this.A&&($b(c,917504,131072,this.A),this.A=null);else{this.A||(this.A=ac(c,917504,131072));var d=ac(c,16646144,131072);$b(c,917504,131072,d,b&2?1:dc)}this.ma=this.ma&-256|b}};h.Si=function(){return El};h.jh=function(){return Fl}; -Sa(function(){for(var a=ob(window.document,"pcjs","ram"),b=0;b":62,"?":63,"@":64,xn:65,yn:66,zn:67,En:68,E:69,Fn:70,In:71,Jn:72,Kn:73,Ln:74,Mn:75,Nn:76,On:77,Pn:78,Qn:79,Rn:80,Q:81,Sn:82,Wn:83,ao:84,fo:85,ho:86,io:87,ko:88,lo:89,mo:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,no:97,oo:98,qo:99,d:100,e:101,ro:102,so:103,to:104, uo:105,vo:106,k:107,wo:108,xo:109,n:110,zo:111,p:112,q:113,r:114,Ao:115,t:116,Co:117,Do:118,Eo:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126},Jl={};Jl[186]=X[";"];Jl[187]=X["="];Jl[188]=X[","];Jl[189]=X["-"];Jl[190]=X["."];Jl[191]=X["/"];Jl[192]=X["`"];Jl[219]=X["["];Jl[220]=X["\\"];Jl[221]=X["]"];Jl[222]=X["'"];Jl[173]=X["-"];var Kl={};Kl[X["1"]]=X["!"];Kl[X["2"]]=X["@"];Kl[X["3"]]=X["#"];Kl[X["4"]]=X.$;Kl[X["5"]]=X["%"];Kl[X["6"]]=X["^"];Kl[X["7"]]=X["&"];Kl[X["8"]]=X["*"];Kl[X["9"]]=X["("]; Kl[X["0"]]=X[")"];Kl[186]=X[":"];Kl[187]=X["+"];Kl[188]=X["<"];Kl[189]=X._;Kl[190]=X[">"];Kl[191]=X["?"];Kl[192]=X["~"];Kl[219]=X["{"];Kl[220]=X["|"];Kl[221]=X["}"];Kl[222]=X['"'];Kl[173]=X._;Kl[61]=X["+"];Kl[59]=X[":"]; @@ -888,7 +887,7 @@ function Sl(a,b,c){if(!Z[b]||!(c||a.M&&a.M.ra.Ob))return!1;for(var d=!1,e=0;e=b)!(a.xc&515)==c&&(d=b+32);else if(97<=b&&122>=b)!!(a.xc&515)==c&&(d=b-32);else if(!!(a.xc&3)==c){if(a=Kl[b])d=a}else if(a=Jl[b])d=a;return d}h.Gg=function(a){a||(this.xc&=-256)}; function Pl(a,b,c){var d=!0,e=!1,f=!1,g=b.keyCode,k=Yl(a,g,!0);a.fh&&k==X["`"]&&(g=k=27);if(Z[g+1E3])if(k+=1E3,2==b.location&&(k+=2E3),Rl(a,k,!1,c)){if(20==g||144==g||145==g)a.qa||(c=e=!0);if(!(c||91!=g&&93!=g))for(var q=0;q=b||97<=b&&122>=b;e>>>=8;){var g=0,k=e&255;224==f||225==f?d.push(f|(c?0:128)):(42==k?a.P&3||a.P&512&&b||(g=k):29==k?a.P&12||(g=k):56==k?a.P&48||(g=k):d.push(f|(c?0:128)),g&&(c?d.unshift(g):d.push(g|128)))}for(c=0;ce.A.length?(n(e)&&qb(e,"scan code "+ga(f)+" buffered"),e.A.push(f), -1==e.A.length&&e.R&&rl(e.R,f)):(20==e.A.length&&e.A.push(255),qb(e,"scan code buffer overflow")));d=!0}return d}Sa(function(){for(var a=ob(window.document,"pcjs","keyboard"),b=0;bf;f++)g=d[f]||0,k=g<<2&252,q=g>>4&252,g=g>>10&252,a.Ja[f]=[k,q,g,255];else{var r=d&&d[255];e=null!=c.Uc[15]?c.Uc:mm;for(f=0;16>f;f++)g=e[f]&63,r?(g|= (c.Uc[20]&12)<<4,c.Uc[16]&128&&(g&=-49,g|=(c.Uc[20]&3)<<4),g=d[g],k=g<<2&252,q=g>>4&252,g=g>>10&252):(k=(g&4?170:0)|(g&32?85:0),q=(g&2?170:0)|(g&16?85:0),g=(g&1?170:0)|(g&8?85:0)),a.Ja[f]=[k,q,g,255]}a.xb=!0}return a.Ja}function wl(a,b,c,d){a.Lc=b;a.sd=c;a.rb=d} function Om(a,b){var c=!1;if(window&&a.Lc&&(!b||a.W)){var d=0,e=a.rb?a.rb:8,f=Sm(a);Tm(a,3,a.sd[0],d,e,8,a.Lc,f)&&(c=!0);d=a.rb?0:2048;e=a.rb?a.rb:9;Tm(a,1,a.sd[1],d,e,14,a.Lc,hm,im)&&(c=!0);a.rb&&Tm(a,a.nb,a.sd[1],0,a.rb,14,a.Lc,f)&&(c=!0)}return c}function Tm(a,b,c,d,e,f,g,k,q){var r=!1;null!=c&&(Um(a,b,c,d,e,f,g,k,q)&&(r=!0),a.Qg&&Um(a,b<<1,c,d,e,f,g,k,q)&&(r=!0));return r} -function Um(a,b,c,d,e,f,g,k,q){var r=!1,x=b&1?0:1,B=a.Ua[b],y=16>k.length?k.length:16;B||(B={Rc:e<ha||!V?ha:8,Da=pa.createImageData(r.Rc,r.Sc),Oa=0;256>Oa;Oa++){for(Ja= +function Um(a,b,c,d,e,f,g,k,q){var r=!1,x=b&1?0:1,B=a.Ua[b],y=16>k.length?k.length:16;B||(B={Rc:e<ha||!V?ha:8,Da=pa.createImageData(r.Rc,r.Sc),Oa=0;256>Oa;Oa++){for(Ja= 0;Ja=ha-2,Tc=da[Ja>(8<=$a&&192<=Oa&&223>=Oa?7:$a)?J:eb;Vm(Da,Fe,Wd,Ge);F&&Vm(Da,Fe+1,Wd,Ge)}pa.putImageData(Da,(Oa&15)*r.Rc,(Oa>>4)*r.Sc)}r.Me[U]="#"+l(J[0],2)+l(J[1],2)+l(J[2],2);r.vi[U]=J;r.Ug[U]=ua;r=!0}}a.Ua[b]=B;return r}function Wm(a){0a.Yb&&(a.Yb=0):a.Yb=-1} function Rm(a){if(a.W){for(var b=10;15>=b;b++)if(null==a.C.zb[b])return;var c=a.C.zb[10],b=c&31,d=a.C.zb[11]&31,e=a.C.zb[9]&31,f=!1;a.C===a.A&&(f=!0,7!=e||4!=b||d||(d=7));if(c&32||b>d&&!f||b>e)Xm(a);else{c=a.C.zb[15]+((a.C.zb[14]&63)<<8);a.ta!=c&&(Xm(a),a.ta=c);d=d-b+1;if(a.fg!=b||a.ye!=d)a.fg=b,a.ye=d;a.ib=e+1;Wm(a)}}} function Xm(a){if(0<=a.ta){if(void 0!==a.ka){var b=a.ka[a.ta];if(b&131072){var b=b&-131073,c=a.ta%a.O,d=a.ta/a.O|0;a.W&&a.Ua[a.W]&&(a.qb&&Ym(a,c,d,b,a.qb),Ym(a,c,d,b));a.ka[a.ta]=b}}a.ta=-1}} @@ -942,8 +941,8 @@ function $m(a,b){var c=a.C;return c&&null!=b&&b!=c.vg?(c.Ng(b),a.ja.Ng(c.sb,c.gc function Qm(a,b){var c,d=a.Qa,e=a.C;if(e)if(e.nb==am)d=cm;else if(5<=e.nb){var d=null,f=e.Ed>>2,g=32768f?d=c?7-d:6: e.Zd[5]&64?d=g&31?143>=e.zb[18]?19:20:21:g&128||350>f?d=c?13:14:480<=f&&(d=3==a.Ha?17:18):d-=c?2:0);c=Zm(a)}}else e.fd&8&&(e.fd&2?(d=e.fd&16?6:5,e.fd&4||--d):(d=e.fd&1?3:1,e.fd&4&&--d));else a.Qa=null,null==d&&(d=a.Da);if(!Pm(a,d,b))return!1;$m(a,c);return!0} function Pm(a,b,c){if(null!=b&&(b!=a.Qa||c)){a.Og=0;a.Qa=b;a.xb=!1;b=a.C||(b==cm?a.za:a.da);if(b!=a.C||b.sb!=a.sb||b.gc!=a.gc){Xm(a);if(a.sb){if(!cc(a.ja,a.sb,a.gc))return!1;a.C&&(a.C.Ic=!1)}a.C=b;b.Ic=!0;a.sb=b.sb;a.gc=b.gc;if(!Xb(a.ja,b.sb,b.gc,3,b===a.A?b:null))return!1}a.W=0;a.O=a.jd;a.X=a.je;a.Ib=a.O;a.hd=bm[cm][2];b=0;if(c=bm[a.Qa])a.O=c[0],a.X=c[1],a.hd=c[2],b=c[3],a.W=c[4],4!=a.Ha&&7!=a.Ha||a.C!==a.A||3!=a.W||(7==a.A.zb[9]?a.X=43:a.W=a.nb);a.Xf=a.O*a.X|0;a.of=a.Xf/a.hd|0;a.Vb=a.of;a.ud=0; -void 0!==b&&(a.Vb=(a.Vb<<1)+b|0,a.ud=a.Vb+b>>1);a.Ua.length&&(a.Ra=a.Ba/a.O|0,a.Ta=a.Ma/a.X|0,a.W?(b=a.Ua[a.W],c=a.Ua[a.W<<1],a.Rg&&80==a.O?c&&a.Ra>=3*c.Rc>>2&&(a.W<<=1,b=c):(c&&a.Ra>=c.Rc&&(a.W<<=1,b=c),b&&(a.Ra=b.Rc,a.Ta=b.Sc)),a.Zb=a.cc=0,b&&(a.Zb=a.O*b.Rc,a.cc=a.X*b.Sc)):(a.Ra=a.Ta=1,a.Zb=a.O,a.cc=a.X),a.Hb=a.qa.createImageData(a.Zb,a.cc),a.lb=window.document.createElement("canvas"),a.lb.width=a.Zb,a.lb.height=a.cc,a.qb=a.lb.getContext("2d"),a.le=a.me=0,a.vd=a.Ba,a.Gd=a.Ma,b=a.Ba-a.O*a.Ra,c=a.Ma- -a.X*a.Ta,0>1,a.vd-=b),0>1,a.Gd-=c),b||c)&&(a.qa.fillStyle=a.wa.style.backgroundColor,a.qa.fillRect(0,0,a.Ba,a.Ma));wn(a,!0);ad(a)}return!0}function Vm(a,b,c,d){b=(b+c*a.width)*d.length;a.data[b]=d[0];a.data[b+1]=d[1];a.data[b+2]=d[2];a.data[b+3]=d[3]}function xn(a){a.cb=-1;a.Oa=!1;var b=a.of;if(void 0===a.ka||a.ka.length!=b)a.ka=Array(b)}function wn(a,b){b||(a.xb=!1);xn(a)} +void 0!==b&&(a.Vb=(a.Vb<<1)+b|0,a.ud=a.Vb+b>>1);a.Ua.length&&(a.Ra=a.Ba/a.O|0,a.Ta=a.Ma/a.X|0,a.W?(b=a.Ua[a.W],c=a.Ua[a.W<<1],a.Rg&&80==a.O?c&&a.Ra>=3*c.Rc>>2&&(a.W<<=1,b=c):(c&&a.Ra>=c.Rc&&(a.W<<=1,b=c),b&&(a.Ra=b.Rc,a.Ta=b.Sc)),a.Zb=a.cc=0,b&&(a.Zb=a.O*b.Rc,a.cc=a.X*b.Sc)):(a.Ra=a.Ta=1,a.Zb=a.O,a.cc=a.X),a.Hb=a.qa.createImageData(a.Zb,a.cc),a.lb=document.createElement("canvas"),a.lb.width=a.Zb,a.lb.height=a.cc,a.qb=a.lb.getContext("2d"),a.le=a.me=0,a.vd=a.Ba,a.Gd=a.Ma,b=a.Ba-a.O*a.Ra,c=a.Ma-a.X* +a.Ta,0>1,a.vd-=b),0>1,a.Gd-=c),b||c)&&(a.qa.fillStyle=a.wa.style.backgroundColor,a.qa.fillRect(0,0,a.Ba,a.Ma));wn(a,!0);ad(a)}return!0}function Vm(a,b,c,d){b=(b+c*a.width)*d.length;a.data[b]=d[0];a.data[b+1]=d[1];a.data[b+2]=d[2];a.data[b+3]=d[3]}function xn(a){a.cb=-1;a.Oa=!1;var b=a.of;if(void 0===a.ka||a.ka.length!=b)a.ka=Array(b)}function wn(a,b){b||(a.xb=!1);xn(a)} function Ym(a,b,c,d,e){var f=d&255,g=d>>8;d=g&15;var k=a.Ua[a.W];k.wf&&(d=k.wf[d]);var q=g>>4&15;k.wf&&(q=k.wf[q]);e?(b*=k.Rc,c*=k.Sc,e.fillStyle=k.Me[q],e.fillRect(b,c,k.Rc,k.Sc)):(b=b*a.Ra+a.le,c=c*a.Ta+a.me,a.qa.fillStyle=k.Me[q],a.qa.fillRect(b,c,a.Ra,a.Ta));g&256&&(q=(f&15)*k.Rc,f=(f>>4)*k.Sc,e?e.drawImage(k.Ug[d],q,f,k.Rc,k.Sc,b,c,k.Rc,k.Sc):a.qa.drawImage(k.Ug[d],q,f,k.Rc,k.Sc,b,c,a.Ra,a.Ta));g&512&&(f=a.fg,g=a.ye,e?(a.ib&&a.ib!==k.Sc&&(f=f*k.Sc/a.ib|0,g=g*k.Sc/a.ib|0),e.fillStyle=k.Me[d], e.fillRect(b,c+f,k.Rc,g)):(a.ib&&a.ib!==a.Ta&&(f=f*a.Ta/a.ib|0,g=g*a.Ta/a.ib|0),a.qa.fillStyle=k.Me[d],a.qa.fillRect(b,c+f,a.Ra,g)))} function ad(a,b){if(a.ra.hc){var c=!1,d=a.C;d&&(d!==a.A?d.fd&8&&(c=!0):d.Ld&32&&(c=!0));if(c||b){if(b)xn(a);else if(void 0===a.ka)return;var e=!1;!(b||++a.Og&15)&&0<=a.Yb&&(a.Yb++,e=!0);var f=0,g=a.Xf,k=a.sb,c=k,q=c+a.gc;19<=a.Qa&&(k=c=655360,q=c+65536);if(yn(a,d)&8||d.mf&&d.mfq&&(r=q-c, @@ -965,13 +964,13 @@ h.Em=function(a,b,c){c&&!n(this)||m(this,a,b,c,this.da.type+".COLOR");this.da.pf function Bn(a,b,c,d,e){if(b.AcMissing <canvas> support. Please try a newer web browser.";break}e.setAttribute("class","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.style.backgroundColor=d.screenColor;e.style.height="auto";0<=(window?window.navigator.userAgent:"").indexOf("MSIE")&&(c.onresize= -function(a,b,c,d){return function(){b.style.height=(a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight),c.onresize());c.appendChild(e);var f=window.document.createElement("textarea");Ia("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var g=e.getContext("2d"),d=new Zl(d,e,g,f,c);mb(d,c)}}); +Sa(function(){for(var a=ob(document,"pcjs","video"),b=0;bMissing <canvas> support. Please try a newer web browser.";break}e.setAttribute("class","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.style.backgroundColor=d.screenColor;e.style.height="auto";0<=(window?window.navigator.userAgent:"").indexOf("MSIE")&&(c.onresize=function(a, +b,c,d){return function(){b.style.height=(a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight),c.onresize());c.appendChild(e);var f=document.createElement("textarea");Ia("iOS")&&(f.setAttribute("autocapitalize","off"),f.setAttribute("autocorrect","off"));c.appendChild(f);var g=e.getContext("2d"),d=new Zl(d,e,g,f,c);mb(d,c)}}); function En(a){this.Y=a.adapter;switch(this.Y){case 1:this.O=956;this.P=7;break;case 2:this.O=888;this.P=7;break;case 3:this.O=632;this.P=5;break;default:Ba("Unrecognized parallel adapter #"+this.Y);return}this.A=this.C=null;Xa.call(this,"ParallelPort",a,En,4194304);a=a.binding;"console"==a?this.C="":lb(this,a,Fn)}gb(En);var Fn="buffer";h=En.prototype;h.Ub=function(a,b,c){switch(b){case Fn:return this.ya[b]=this.A=c,!0}return!1}; h.Jc=function(a,b,c,d){this.ja=b;this.M=c;this.ma=d;this.R=Hb(a,"ChipSet");lc(b,this,Gn,this.O);pc(b,this,Hn,this.O);vb(this)};h.lc=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};h.kc=function(a){return a?this.save():!0};h.reset=function(){In(this)};h.save=function(){var a=new bf(this),b=0,c=[];c[b++]=this.ia;c[b++]=this.ec;c[b]=this.yf;cf(a,0,c);return a.data()};h.restore=function(a){return In(this,a[0])}; function In(a,b){var c=0;void 0===b&&(b=[0,0,0]);a.ia=b[c++];a.ec=b[c++];a.yf=b[c];return!0}h.xl=function(a,b){var c=this.ia;m(this,a,null,b,"DATA",c);return c};h.Vl=function(a,b){var c=this.ec;m(this,a,null,b,"STAT",c);return c};h.tl=function(a,b){var c=this.yf;m(this,a,null,b,"CTRL",c);return c}; h.Pm=function(a,b,c){m(this,a,b,c,"DATA");this.ia=b;this.ec|=64;if(this.A)8==b?this.A.value=this.A.value.slice(0,-1):(this.A.value+=String.fromCharCode(b),this.A.scrollTop=this.A.scrollHeight),a=!0;else if(null!=this.C){if(10==b||1024<=this.C.length)this.S(this.C),this.C="";10!=b&&(this.C+=String.fromCharCode(b));a=!0}else a=!1;a&&(this.ec&=-65);Jn(this)};h.Km=function(a,b,c){m(this,a,b,c,"CTRL");this.yf=b;Jn(this)};function Jn(a){a.R&&a.P&&(a.yf&16&&!(a.ec&64)?Yf(a.R,a.P):Xf(a.R,a.P))} -var Gn={0:En.prototype.xl,1:En.prototype.Vl,2:En.prototype.tl},Hn={0:En.prototype.Pm,2:En.prototype.Km};Sa(function(){for(var a=ob(window.document,"pcjs","parallel"),b=0;b=b)a.preventDefault&&a.preventDefault(),64a.O||0>a.Y)a.O=b.clientX,a.Y=b.clientY;a.la?(c=b.movementX||b.mozMovementX||b.webkitMovementX||0,d=b.movementY||b.mozMovementY||b.webkitMovementY||0):(c=b.clientX-a.O,d=b.clientY-a.Y);a.O=b.clientX;a.Y=b.clientY;a.Ef(c,d,a.O,a.Y)}} h.he=function(a,b){if(this.Ic&&this.M&&this.M.ra.Ob){var c="mouse button"+a+" "+(b?"dn":"up");switch(a){case Mm:this.da!=b&&(this.da=b,Xn(this,c));break;case 2:this.ka!=b&&(this.ka=b,Xn(this,c))}}};h.Ef=function(a,b,c,d){this.Ic&&this.M&&this.M.ra.Ob&&(a||b)&&(this.W=a,this.X=b,Xn(this,null,c,d))}; -function Xn(a,b,c,d){var e=64|(a.da?32:0)|(a.ka?16:0)|(a.X&192)>>4|(a.W&192)>>6,f=a.W&63,g=a.X&63;n(a,8388608)&&qb(a,(b?b+": ":"")+(void 0!==d?"mouse ("+c+","+d+"): ":"")+"serial packet ["+ga(e)+","+ga(f)+","+ga(g)+"]",0,!0);Mn(a.R,[e,f,g]);a.W=a.X=0}Sa(function(){for(var a=ob(window.document,"pcjs","mouse"),b=0;b>4|(a.W&192)>>6,f=a.W&63,g=a.X&63;n(a,8388608)&&qb(a,(b?b+": ":"")+(void 0!==d?"mouse ("+c+","+d+"): ":"")+"serial packet ["+ga(e)+","+ga(f)+","+ga(g)+"]",0,!0);Mn(a.R,[e,f,g]);a.W=a.X=0}Sa(function(){for(var a=ob(document,"pcjs","mouse"),b=0;b>9]);if(f){if(e+c<=f.length)return qo(a.Ga,f,e,c);for(e=d=0;c--;)d|=oo(a,b++,1)<=e.ii&&a<=e.bk){d=a-=e.ii;var f,g;for(g in e.se){var k=e.se[g],q=a-k[0];if(!q){c=this.cg+"!"+k[1];break}b&&0'+b+"");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.ya[b]=c,c.onchange=function(){var a=ca(c.value,10);null!=a&&Ho(d,a)},!0; case "loadDrive":return this.ya[b]=c,c.onclick=function(){var a=d.ya.listDisks;a&&Io(d,a.options[a.selectedIndex].text,a.value)},!0;case "mountDrive":return this.qa?(this.ya[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Io(d,ja(b,!0),b,a)}return!1}):c.parentNode.removeChild(c),!0}return!1}; h.Jc=function(a,b,c,d){this.ja=b;this.M=c;this.ma=d;this.ia=a;this.R=Hb(a,"ChipSet");if((this.W=Jo(this.ia,"autoMount")||this.W)&&"string"==typeof this.W)try{this.W=eval("("+this.W+")")}catch(e){Ba("FDC auto-mount error: "+e.message+" ("+this.W+")"),this.W=null}Ko(this);lc(b,this,Lo);pc(b,this,Mo);this.qa&&No(this,"Local Disk","?");No(this,"Remote Disk","??");Oo(this)||vb(this)}; -h.lc=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.ia.gh){this.C=[];for(var c=0;ca.Nb||f[1]>a.yb)&&(this.Va('Diskette "'+c+'" too large for drive '+String.fromCharCode(65+a.kb)),b=null);b?(a.Ga=b,a.jk=c,a.Je=d,So(this,c,d,b),f=b.info(),this.X|=128,this.Va('Mounted diskette "'+c+'" in drive '+String.fromCharCode(65+a.kb),a.we||e),a.yg=f[0],a.Kf=f[1],a.Lf=f[2]):a.Ye=!1;a.we&&(a.we=!1,--this.ka||vb(this));Ho(this,a.kb)}; -function No(a,b,c){if((a=a.ya.listDisks)&&a.options){for(var d=0;d=this.P&&(this.sa&=-81,this.O=this.P=0);return c}; @@ -1045,7 +1044,7 @@ d.mb=c>>2&1,c=To(this),d.Wb+=c-d.ee,0>d.Wb&&(d.Wb=0),d.Wb>=d.Nb&&(d.Wb=d.Nb-1),d function Wo(a,b,c,d,e,f,g,k){Uo(a);Vo(a,b.kb|b.mb<<2|b.Gb&255);Vo(a,(b.Gb&65280)>>>8);Vo(a,(b.Gb&16711680)>>>16);var q=0;if(e!=b.Wb||f!=b.mb)q=g=1;c&128&&(f^=q,d||(q=0));Vo(a,e+q);Vo(a,f);Vo(a,g);Vo(a,k)}function To(a){var b=a.Y[a.O];a.O++;return b}function Uo(a){a.O=a.P=0}function Vo(a,b){a.Y[a.P++]=b} h.zk=function(a,b,c){if(void 0===b||0>b){b=-1;var d=null,e=0;if(!a.Gb&&a.Ga){do{if(a.tb&&(e=a.jb,0<=(b=a.Ga.read(a.tb,a.jb++)))){d=a.tb;break}a.tb=a.Ga.seek(a.Wb,a.mb,a.Cb);if(!a.tb){a.Gb=1088;break}a.jb=0;Xo(a)}while(1)}c(b,!1,d,e)}else c(-1,!1)};h.Ak=function(a,b){return void 0!==b&&0<=b?Yo(a,b):-1}; h.Qk=function(a,b){var c;if(void 0!==b&&0<=b)a:if(c=b,a.Gb)c=-1;else{a.ld[a.Te++]=c;if(a.Te==a.ld.length){a.Wb=a.ld[0];a.mb=a.ld[1];a.Cb=a.ld[2];a.Mb=128<Yo(a,a.Ai)){c=-1;break a}a.mg++}a.mg>=a.fe&&(c=-1)}else c=-1;return c};function Yo(a,b){if(a.Gb||!a.Ga)return-1;do{if(a.tb&&a.Ga.write(a.tb,a.jb++,b))break;a.tb=a.Ga.seek(a.Wb,a.mb,a.Cb);if(!a.tb){a.Gb=8256;b=-1;break}a.jb=0;Xo(a)}while(1);return b} -function Xo(a){a.Cb++;a.Cb>=a.Lf+1&&(a.Cb=1,a.mb++,a.mb>=a.Kf&&(a.mb=0,a.Wb++))}var Lo={1012:Fo.prototype.Al,1013:Fo.prototype.yl,1015:Fo.prototype.zl},Mo={1010:Fo.prototype.Sm,1013:Fo.prototype.Rm,1015:Fo.prototype.Qm};Sa(function(){for(var a=ob(window.document,"pcjs","fdc"),b=0;b=a.Lf+1&&(a.Cb=1,a.mb++,a.mb>=a.Kf&&(a.mb=0,a.Wb++))}var Lo={1012:Fo.prototype.Al,1013:Fo.prototype.yl,1015:Fo.prototype.zl},Mo={1010:Fo.prototype.Sm,1013:Fo.prototype.Rm,1015:Fo.prototype.Qm};Sa(function(){for(var a=ob(document,"pcjs","fdc"),b=0;b=a.ob+b&&(a.Cb=b,a.mb++,a.mb>=a.yb&&(a.mb=0,a.be++))}h.cm=function(){var a=this.M.H&255;!(this.M.F>>8)&&128>8||!this.R)||(a=!(this.R.vc[0].Cd&64));return a?!0:!1}; var cp={800:Zo.prototype.am,801:Zo.prototype.bm,802:Zo.prototype.$l},bp={496:Zo.prototype.Ek,497:Zo.prototype.hl,498:Zo.prototype.jl,499:Zo.prototype.kl,500:Zo.prototype.fl,501:Zo.prototype.el,502:Zo.prototype.gl,503:Zo.prototype.ll},ep={800:Zo.prototype.rn,801:Zo.prototype.un,802:Zo.prototype.tn,803:Zo.prototype.sn,807:Zo.prototype.ji,811:Zo.prototype.ji,815:Zo.prototype.ji},dp={496:Zo.prototype.ym,497:Zo.prototype.Dm,498:Zo.prototype.Bm,499:Zo.prototype.Cm,500:Zo.prototype.xm,501:Zo.prototype.wm, -502:Zo.prototype.zm,503:Zo.prototype.vm,1014:Zo.prototype.Am};Sa(function(){for(var a=ob(window.document,"pcjs","hdc"),b=0;bk.indexOf("/")&&(k=window.location.pathname+k);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(k?' url="'+k+'"':""))}k=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(k=new window.ActiveXObject("Microsoft.XMLDOM"), k.async=!1,k.loadXML(a)):k=(new window.DOMParser).parseFromString(a,"text/xml")}catch(B){k=null,a=B.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");za(e,!0,null,null,function(f,g,k){if(k||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+k+")");else{if(f=d[3])if(k=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var q=k[0],r,x=/( [a-z]+=)(['"])(.*?)\2/g;r=x.exec(f);)q=0>q.indexOf(r[1])?q.replace(">",r[0]+">"):q.replace(new RegExp(r[1]+"(['\"])(.*?)\\1"),r[0]);k[0]!=q&&(g=g.replace(k[0],q))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/, "");a=a.replace(d[0],g);Dr(a,b,c)}})}else c(a,null)} -function Er(a,b,c,d){function e(a){if(void 0===k){var b=g&&ob(g,"machine-warning");k=b&&b[0]||g}k&&(k.innerHTML=na(a))}function f(a){e("Error: "+a);q&&(--rr||Ua(!0));q=!1}var g,k,q=!0;rr++;try{if(g=window.document.getElementById(a)){c||(c="/versions/pcjs/1.20.9/components.xsl");var r=function(d,k){if(k){var q=function(d,q){if(q)if(q)if(e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var r=k.transformNode(q);r?(g.outerHTML=r,--rr||Ua(!0)):f("transformNodeToObject failed")}else window.document.implementation&& -window.document.implementation.createDocument?(r=new XSLTProcessor,r.importStylesheet(q),(r=r.transformToFragment(k,window.document))?g.parentNode?(g.parentNode.replaceChild(r,g),--rr||Ua(!0)):f("invalid machine element: "+a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f("failed to load XSL file: "+c);else f(d)};k?sr(c,null,null,!1,e,q):f("failed to load XML file: "+b)}else f(d)};"<"!=b.charAt(0)?sr(b,a,d,!0,e,r):tr(b,null,a,d,!1,e,r)}else f("missing machine element: "+ +function Er(a,b,c,d){function e(a){if(void 0===k){var b=g&&ob(g,"machine-warning");k=b&&b[0]||g}k&&(k.innerHTML=na(a))}function f(a){e("Error: "+a);q&&(--rr||Ua(!0));q=!1}var g,k,q=!0;rr++;try{if(g=document.getElementById(a)){c||(c="/versions/pcjs/1.20.9/components.xsl");var r=function(d,k){if(k){var q=function(d,q){if(q)if(q)if(e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var r=k.transformNode(q);r?(g.outerHTML=r,--rr||Ua(!0)):f("transformNodeToObject failed")}else document.implementation&& +document.implementation.createDocument?(r=new XSLTProcessor,r.importStylesheet(q),(r=r.transformToFragment(k,document))?g.parentNode?(g.parentNode.replaceChild(r,g),--rr||Ua(!0)):f("invalid machine element: "+a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f("failed to load XSL file: "+c);else f(d)};k?sr(c,null,null,!1,e,q):f("failed to load XML file: "+b)}else f(d)};"<"!=b.charAt(0)?sr(b,a,d,!0,e,r):tr(b,null,a,d,!1,e,r)}else f("missing machine element: "+ a)}catch(x){f(x.message)}return q}window.embedPC=function(a,b,c,d){Ua(!1);return Er(a,b,c,d)};window.enableEvents=Ua;window.sendEvent=Wa;})(); diff --git a/docs/pcjs/demos/pc.js b/docs/pcjs/demos/pc.js index 234ef1893..1a706aa81 100644 --- a/docs/pcjs/demos/pc.js +++ b/docs/pcjs/demos/pc.js @@ -11,8 +11,8 @@ function Fa(a){if(Aa)try{for(var b=0;bMath.abs(a.K-b)?1:2),1==a.S?b=a.K:2==a.S&&(d=a.J));a.J=d;a.K=b;if(0<=d&&1280>d&&0<=b&&720>b){a:{c=d;if(960>c&&a.B&&a.B.be)for(k=0;kd&& (k=d);c=k;break a}c=-1}if(-1!==c&&(c&=-16,c!=a.ta)){b=c;if(a.context&&a.Z&&a.da){e=a.Z.width;a.da.fillStyle="black";a.da.fillRect(0,360,e,360);mb(a,378,a.Z,a.da);a.ha=a.va.width/24|0;if(null==b)nb(a,"Mouse over memory to dump");else for(nb(a,"0x"+da(b),null,0,1),k=1;16>=k;k++){d="";for(l=1;8>=l;l++){var p;p=a.na;var q=b++;p=p.W[(q&p.La)>>>p.ha].Cd(q&p.B,q);nb(a,da(p,2),null,1);d+=32<=p&&128>p?String.fromCharCode(p):"."}nb(a,d,null,0,1)}a.context.drawImage(a.Z,0,360,e,360,a.Va,a.ab,a.Ia,a.La)}a.ta= c}}}f.Wd=function(){};function ob(a,b,c,d){a.B.Fe[a.B.Lh++]={Pj:b,cd:c,type:d};return na(lb,b,c,0,d)}function mb(a,b,c,d){var e,k=null.style.color,l=a.Fa=10;a.F=l;a.N=b;a.T=a.pa=18;e||(e=a.oa||a.pa+"px Monaco, Lucida Console, Courier New");a.W=a.oa=e;c&&(a.va=c);d&&(a.H=d,a.xa=k||"white")} -function nb(a,b,c,d,e){a.H.font=a.W;a.H.fillStyle=a.xa;a.H.fillText(b,a.F,a.N);a.F+=a.ha;null!=c&&(16!=a.Qa?b=c.toString():(b=8>a.Da?"0x":"",b+=da(c,a.Da)),a.H.fillText(b,a.F,a.N),a.F+=a.ha);d&&(a.F+=a.ha*d);e&&(a.F=a.Fa,a.N+=(a.T+2)*(e||1))}function jb(){for(var a=!1,b=Xa(window.document,"pcjs","panel"),c=0;ca.Da?"0x":"",b+=da(c,a.Da)),a.H.fillText(b,a.F,a.N),a.F+=a.ha);d&&(a.F+=a.ha*d);e&&(a.F=a.Fa,a.N+=(a.T+2)*(e||1))}function jb(){for(var a=!1,b=Xa(document,"pcjs","panel"),c=0;c=this.F?12:24>=this.F?14:15;this.yb=1<>2;this.B=this.yb-1;this.J=this.T/this.yb|0;this.D=this.J-1;this.K=[];this.N=[];this.O=[];this.S=[];a=new g;qb(a,this.Ta);this.W=Array(this.J);for(b=0;b>>a.ha;0a.yb?a.yb:c;if(l&&l.size){if(l.type==d&&l.controller==e){if(b+c<=l.ee)return l.Be+=l.ee-b,l.ee=b,!0;if(b>=l.ee+l.Be){q=l.size-(b-p);q>c&&(q=c);l.Be=b-l.ee+q;c-=q;b=p+a.yb;continue}}return xb(a,1,b,c)}l=a.W[k];b=new g(b,q,a.yb,d,e);qb(b,a.Ta,l);a.W[k++]=b;b=p+a.yb;c-=q}return 0>=c?(a=a.A,a.Ua&-2147483648&&yb(a),!0):xb(a,2,b,c)} @@ -117,7 +117,7 @@ function ze(a,b,c){var d=4;1==b.length&&(d=1,c=c?1:0);if(80386>a.ia)2this.ia?0:1;for(var b=0;2>b;b++){switch(a){case 0:if(this.Ja&1&&this.ca&512){var c=Ae(this.T);if(-1<=c&&(this.Ja&=-2,0<=c)){this.Ja&=-5;Be.call(this,c);break a}}break;case 1:if(this.Ja&2){this.Ja&=-3;80386<=this.ia&& -(this.fb[6]|=16384);Be.call(this,1);break a}}a=1-a}}if(this.Ja&4){this.N=this.A=0;break}}this.N=0;this.pa[this.X()].call(this)}while(0>11;Fe(this);Ge(this,a[b++]);for(c=0;c=He&&Ie(a,13))}function Fe(a){a.ga&=-129;a.ga&~a.J&63&&(a.ga|=128);if(a.ga&128&&!(a.J&128))return a=a.T,a.ia>=He?Je(a,13):a.va&0||Be.call(a.A,2),!0;a=a.T;a.ia>=He&&Ie(a,13);return!1}function Ke(a,b){80387<=a.ia||(b&=-65);a.ga|=b;return Fe(a)} @@ -144,9 +144,9 @@ Ze(this),T(this,0)))},48:function(){U(this,this.B,Me(this,T(this,this.B),T(this, this.mj()},3:function(){Ue(this)&&(this.mj(),ef(this))},4:yf,6:zf,7:Ef,48:uf,49:Hf,50:function(){U(this,this.B,T(this,0))},51:Bf},222:{0:function(){U(this,0,Me(this,T(this,0),We(this)))},1:function(){U(this,0,Oe(this,T(this,0),We(this)))},2:function(){Qe(this,T(this,0),We(this))},3:function(){Qe(this,T(this,0),We(this))&&ef(this)},4:function(){U(this,0,Ne(this,T(this,0),We(this)))},5:function(){U(this,0,Ne(this,We(this),T(this,0)))},6:function(){U(this,0,Pe(this,T(this,0),We(this)))},7:function(){U(this, 0,Pe(this,We(this),T(this,0)))},48:function(){U(this,this.B,Me(this,T(this,this.B),T(this,0)))&&ef(this)},49:function(){U(this,this.B,Oe(this,T(this,this.B),T(this,0)))&&ef(this)},50:sf,51:function(){Qe(this,T(this,0),T(this,1))&&null!=ef(this)&&ef(this)},52:function(){U(this,this.B,Ne(this,T(this,0),T(this,this.B)))&&ef(this)},53:function(){U(this,this.B,Ne(this,T(this,this.B),T(this,0)))&&ef(this)},54:function(){U(this,this.B,Pe(this,T(this,0),T(this,this.B)))&&ef(this)},55:function(){U(this,this.B, Pe(this,T(this,this.B),T(this,0)))&&ef(this)}},223:{0:function(){ff(this,We(this))},2:function(){null!=Re(this,T(this,0),32768)&&this.A.gb(this.A.U,this.K[0])},3:function(){null!=Re(this,T(this,0),32768)&&(this.A.gb(this.A.U,this.K[0]),ef(this))},4:function(){var a=$e(this),b=cf(a[0],8)+1E8*cf(a[1],8)+1E16*cf(a[2],2);a[2]&32768&&(b=-b);ff(this,b)},5:function(){var a;a=this.A.ka(this.A.U);a=4294967296*this.A.ka(this.A.U+4)+(a>>>0);ff(this,a)},6:function(){var a=Re(this,ef(this));null!=a&&(this.H[0]= -df(a,8),this.H[1]=df(a/1E8,8),this.H[2]=df(a/1E16,2),0>a&&(this.H[2]|=32768),af(this))},7:function(){null!=Re(this,T(this,0),of)&&(this.lj(),ef(this))},48:function(){uf.call(this);ef(this)},49:Hf,50:Cf,51:Cf,52:Ff}},Jf=[pf,vf,wf,xf,yf,zf,Df,Af,Ef,Ff];Ea(function(){for(var a=Xa(window.document,"pcjs","fpu"),b=0;ba&&(this.H[2]|=32768),af(this))},7:function(){null!=Re(this,T(this,0),of)&&(this.lj(),ef(this))},48:function(){uf.call(this);ef(this)},49:Hf,50:Cf,51:Cf,52:Ff}},Jf=[pf,vf,wf,xf,yf,zf,Df,Af,Ef,Ff];Ea(function(){for(var a=Xa(document,"pcjs","fpu"),b=0;b>16,c=c<<16>>16,d=d<<16>>16);this.A-=this.D.fi;(bd)&&h.call(this,5);this.N|=2;return a}function Uf(a,b){var c=0;if(b){le(this);for(var d=1;d&this.C;){if(b&d){a=c;break}d<<=1;c++}}else ne(this);this.A-=11+3*c;return a}function Vf(a,b){var c=0;if(b){le(this);for(var d=2==this.ba?15:31,e=1<>>=1;c++;d--}}else ne(this);this.A-=11+3*c;return a} function Wf(a,b){a&1<<(b&(2==this.ba?15:31))?ee(this):fe(this);this.A-=-1===this.U?3:6;this.N|=2;return a}function Xf(a,b){var c=1<<(b&(2==this.ba?15:31));a&c?ee(this):fe(this);this.A-=-1===this.U?6:8;return a^c}function Yf(a,b){var c=1<<(b&(2==this.ba?15:31));a&c?ee(this):fe(this);this.A-=-1===this.U?6:8;return a&~c}function Zf(a,b){var c=1<<(b&(2==this.ba?15:31));a&c?ee(this):fe(this);this.A-=-1===this.U?6:8;return a|c} function $f(a,b){if(-1===this.U)return Wf.call(this,a,b);var c=this.ba<<3;if(b>=c||b<-c)a=se(this,this.Pc,this.mc+(b>>(2==this.ba?4:5))*this.ba);b=1<<(b&(2==this.ba?15:31));a&b?ee(this):fe(this);this.A-=6;this.N|=2;return a}function ag(a,b){if(-1===this.U)return Xf.call(this,a,b);var c=this.ba<<3;if(b>=c||b<-c)a=se(this,this.Pc,this.mc+(b>>(2==this.ba?4:5))*this.ba);b=1<<(b&(2==this.ba?15:31));a&b?ee(this):fe(this);this.A-=8;return a^b} @@ -827,18 +827,18 @@ var ti={0:function(){return Si(this,0,0)},1:function(){return Ui(this,0,0)},2:fu b){kj(this,0,b)},33:function(a,b){mj(this,0,b)},64:function(a,b){qj(this,0,b)},65:function(a,b){qj(this,1,b)},66:function(a,b){qj(this,2,b)},67:ii.prototype.Rl,129:function(a,b){fj(this,0,2,b)},130:function(a,b){fj(this,0,3,b)},131:function(a,b){fj(this,0,1,b)},135:function(a,b){fj(this,0,0,b)}},wi={96:ii.prototype.Sl,97:ii.prototype.Tl,98:ii.prototype.Ul,99:ii.prototype.Vl,160:ii.prototype.Ql},yi={96:ii.prototype.dl,97:ii.prototype.el,100:ii.prototype.cl,112:ii.prototype.sl,113:ii.prototype.tl,128:function(a, b){this.J[7]=b},132:function(a,b){this.J[0]=b},133:function(a,b){this.J[1]=b},134:function(a,b){this.J[2]=b},136:function(a,b){this.J[3]=b},137:function(a,b){fj(this,1,2,b)},138:function(a,b){fj(this,1,3,b)},139:function(a,b){fj(this,1,1,b)},140:function(a,b){this.J[4]=b},141:function(a,b){this.J[5]=b},142:function(a,b){this.J[6]=b},143:function(a,b){fj(this,1,0,b)},160:function(a,b){kj(this,1,b)},161:function(a,b){mj(this,1,b)},192:function(a,b){Ti(this,1,0,b)},194:function(a,b){Vi(this,1,0,b)}, 196:function(a,b){Ti(this,1,1,b)},198:function(a,b){Vi(this,1,1,b)},200:function(a,b){Ti(this,1,2,b)},202:function(a,b){Vi(this,1,2,b)},204:function(a,b){Ti(this,1,3,b)},206:function(a,b){Vi(this,1,3,b)},208:function(a,b){this.H[1].eg=b},210:function(a,b){Xi(this,1,b)},212:function(a,b){Yi(this,1,b)},214:function(a,b){this.H[1].Wb[b&3].mode=b},216:function(){this.H[1].Kb=0},218:function(){dj(this,1)},240:ii.prototype.Dl,241:ii.prototype.El}; -Ea(function(){for(var a=Xa(window.document,"pcjs","chipset"),b=0;b>>4,0,this.K,this.F,this.N),delete this.N);return!0};Cj.prototype.Sb=function(){return!0}; Cj.prototype.O=function(a,b,c){if(c)this.Ka("Unable to load system ROM (error "+c+": "+a+")");else{if("["==b.charAt(0)||"{"==b.charAt(0))try{var d=eval("("+b+")"),e=d.bytes,k=d.data;if(e)this.B=e;else if(k)for(this.B=Array(4*k.length),c=b=0;b>8&255,this.B[c++]=k[b]>>16&255,this.B[c++]=k[b]>>24&255;else this.B=d;this.N=d.symbols;if(!this.B.length){ra("Empty ROM: "+a);return}if(1==this.B.length){ra(this.B[0]);return}}catch(l){this.Ka("ROM data error: "+ l.message);return}else for(a=b.replace(/\n/gm," ").replace(/ +$/,"").split(" "),this.B=Array(a.length),d=0;d>>d.ha].jf(e&d.B,a.B[c]&255,e)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.H?b.push(a.H):null!=a.H&&a.H.length&&(b=a.H);for(c=0;cthis.D?21:23,c=a.B[b]|a.B[b+1]<<8,c=c+(this.B>>10);a.B[b]=c&255;a.B[b+ 1]=c>>8;Ii(a)}}else ra("No RAM allocated")};f.save=function(){var a=new Rd(this);this.controller&&D(a,0,this.controller.save());return a.data()};f.restore=function(a){return this.controller?this.controller.restore(a[0]):!0};function Hj(a){this.H=a;this.D=Jj;this.F=Kj;this.B=Lj;this.A=null}var Ij=-2134900736,Jj=65535,Kj=2575,Lj=2,Mj=[null,0],Nj=[function(a){return this.controller.Lb(a)},null,null,function(a,b){this.controller.Lc(a,b)},null,null];f=Hj.prototype;f.save=function(){return[this.D,this.B]}; f.restore=function(a){this.Lc(0,a[0]&255);this.Lc(2,a[1]&255);return!0};f.Lb=function(a){var b=255;2>a?b=a&1?this.F>>8:this.F&255:4>a&&(b=a&1?this.B>>8:this.B&255);return b};f.Lc=function(a,b){if(a)2==a&&(this.B=this.B&-256|b);else if(b!=(this.D&255)){var c=this.H.na;if(b&1)this.A&&(zb(c,917504,131072,this.A),this.A=null);else{this.A||(this.A=Ab(c,917504,131072));var d=Ab(c,16646144,131072);zb(c,917504,131072,d,b&2?1:Eb)}this.D=this.D&-256|b}};f.Xh=function(){return Mj};f.og=function(){return Nj}; -Ea(function(){for(var a=Xa(window.document,"pcjs","ram"),b=0;b":62,"?":63,"@":64,fm:65,gm:66,hm:67,mm:68,E:69,nm:70,qm:71,rm:72,sm:73,tm:74,um:75,vm:76,wm:77,xm:78,ym:79,zm:80,Q:81,Am:82,Em:83,Jm:84,Nm:85,Om:86,Pm:87,Rm:88,Sm:89,Tm:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,Um:97,Vm:98,Xm:99,d:100,e:101,Ym:102,Zm:103,$m:104, an:105,bn:106,k:107,cn:108,dn:109,n:110,fn:111,p:112,q:113,r:114,gn:115,t:116,hn:117,jn:118,kn:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126},Rj={};Rj[186]=W[";"];Rj[187]=W["="];Rj[188]=W[","];Rj[189]=W["-"];Rj[190]=W["."];Rj[191]=W["/"];Rj[192]=W["`"];Rj[219]=W["["];Rj[220]=W["\\"];Rj[221]=W["]"];Rj[222]=W["'"];Rj[173]=W["-"];var Sj={};Sj[W["1"]]=W["!"];Sj[W["2"]]=W["@"];Sj[W["3"]]=W["#"];Sj[W["4"]]=W.$;Sj[W["5"]]=W["%"];Sj[W["6"]]=W["^"];Sj[W["7"]]=W["&"];Sj[W["8"]]=W["*"];Sj[W["9"]]=W["("]; Sj[W["0"]]=W[")"];Sj[186]=W[":"];Sj[187]=W["+"];Sj[188]=W["<"];Sj[189]=W._;Sj[190]=W[">"];Sj[191]=W["?"];Sj[192]=W["~"];Sj[219]=W["{"];Sj[220]=W["|"];Sj[221]=W["}"];Sj[222]=W['"'];Sj[173]=W._;Sj[61]=W["+"];Sj[59]=W[":"]; @@ -860,7 +860,7 @@ function ak(a,b,c){if(!Y[b]||!(c||a.A&&a.A.ja.Rb))return!1;for(var d=!1,e=0;e=b)!(a.Zb&515)==c&&(d=b+32);else if(97<=b&&122>=b)!!(a.Zb&515)==c&&(d=b-32);else if(!!(a.Zb&3)==c){if(a=Sj[b])d=a}else if(a=Rj[b])d=a;return d}f.Qf=function(a){a||(this.Zb&=-256)}; function Xj(a,b,c){var d=!0,e=!1,k=!1,l=b.keyCode,p=gk(a,l,!0);a.lg&&p==W["`"]&&(l=p=27);if(Y[l+1E3])if(p+=1E3,2==b.location&&(p+=2E3),Zj(a,p,!1,c)){if(20==l||144==l||145==l)a.W||(c=e=!0);if(!(c||91!=l&&93!=l))for(var q=0;q=b||97<=b&&122>=b;e>>>=8;){var l=0,p=e&255;224==k||225==k?d.push(k|(c?0:128)):(42==p?a.D&3||a.D&512&&b||(l=p):29==p?a.D&12||(l=p):56==p?a.D&48||(l=p):d.push(k|(c?0:128)),l&&(c?d.unshift(l):d.push(l|128)))}for(c=0;ce.Xb.length?(e.Xb.push(k),1==e.Xb.length&&e.T&&Aj(e.T,k)):20==e.Xb.length&& -e.Xb.push(255));d=!0}return d}Ea(function(){for(var a=Xa(window.document,"pcjs","keyboard"),b=0;bk;k++)l=d[k]||0,p=l<<2&252,q=l>>4&252,l=l>>10&252,a.ta[k]=[p,q,l,255];else{var w=d&&d[255];e=null!=c.Jc[15]?c.Jc:uk;for(k=0;16>k;k++)l=e[k]&63,w?(l|= (c.Jc[20]&12)<<4,c.Jc[16]&128&&(l&=-49,l|=(c.Jc[20]&3)<<4),l=d[l],p=l<<2&252,q=l>>4&252,l=l>>10&252):(p=(l&4?170:0)|(l&32?85:0),q=(l&2?170:0)|(l&16?85:0),l=(l&1?170:0)|(l&8?85:0)),a.ta[k]=[p,q,l,255]}a.Va=!0}return a.ta}function Ej(a,b,c,d){a.Fb=b;a.lc=c;a.Qa=d} function Qk(a,b){var c=!1;if(window&&a.Fb&&(!b||a.K)){var d=0,e=a.Qa?a.Qa:8,k=Uk(a);Vk(a,3,a.lc[0],d,e,8,a.Fb,k)&&(c=!0);d=a.Qa?0:2048;e=a.Qa?a.Qa:9;Vk(a,1,a.lc[1],d,e,14,a.Fb,pk,qk)&&(c=!0);a.Qa&&Vk(a,a.mb,a.lc[1],0,a.Qa,14,a.Fb,k)&&(c=!0)}return c}function Vk(a,b,c,d,e,k,l,p,q){var w=!1;null!=c&&(Wk(a,b,c,d,e,k,l,p,q)&&(w=!0),a.Yd&&Wk(a,b<<1,c,d,e,k,l,p,q)&&(w=!0));return w} -function Wk(a,b,c,d,e,k,l,p,q){var w=!1,B=b&1?0:1,G=a.Fa[b],C=16>p.length?p.length:16;G||(G={sc:e<Ca||!ka?Ca:8,Kf=Zi.createImageData(w.sc,w.tc),Bb=0;256>Bb;Bb++){for(ac= +function Wk(a,b,c,d,e,k,l,p,q){var w=!1,B=b&1?0:1,G=a.Fa[b],C=16>p.length?p.length:16;G||(G={sc:e<Ca||!ka?Ca:8,Kf=Zi.createImageData(w.sc,w.tc),Bb=0;256>Bb;Bb++){for(ac= 0;ac=Ca-2,Em=pd[ac>(8<=Oc&&192<=Bb&&223>=Bb?7:Oc)?J:Cm;Xk(Kf,$i,aj,bj);X&&Xk(Kf,$i+1,aj,bj)}Zi.putImageData(Kf,(Bb&15)*w.sc,(Bb>>4)*w.tc)}w.ae[V]="#"+da(J[0],2)+da(J[1],2)+da(J[2],2);w.Fh[V]=J;w.dg[V]=te;w=!0}}a.Fa[b]=G;return w}function Yk(a){0a.La&&(a.La=0):a.La=-1} function Tk(a){if(a.K){for(var b=10;15>=b;b++)if(null==a.F.ib[b])return;var c=a.F.ib[10],b=c&31,d=a.F.ib[11]&31,e=a.F.ib[9]&31,k=!1;a.F===a.B&&(k=!0,7!=e||4!=b||d||(d=7));if(c&32||b>d&&!k||b>e)Zk(a);else{c=a.F.ib[15]+((a.F.ib[14]&63)<<8);a.ha!=c&&(Zk(a),a.ha=c);d=d-b+1;if(a.rd!=b||a.Zc!=d)a.rd=b,a.Zc=d;a.Ja=e+1;Yk(a)}}} function Zk(a){if(0<=a.ha){if(void 0!==a.W){var b=a.W[a.ha];if(b&131072){var b=b&-131073,c=a.ha%a.H,d=a.ha/a.H|0;a.K&&a.Fa[a.K]&&(a.Na&&$k(a,c,d,b,a.Na),$k(a,c,d,b));a.W[a.ha]=b}}a.ha=-1}} @@ -908,8 +908,8 @@ function bl(a,b){var c=a.F;return c&&null!=b&&b!=c.rg?(c.Xf(b),a.na.Xf(c.hb,c.Hb function Sk(a,b){var c,d=a.Da,e=a.F;if(e)if(e.mb==ik)d=kk;else if(5<=e.mb){var d=null,k=e.Wc>>2,l=32768k?d=c?7-d:6: e.Dd[5]&64?d=l&31?143>=e.ib[18]?19:20:21:l&128||350>k?d=c?13:14:480<=k&&(d=3==a.sa?17:18):d-=c?2:0);c=al(a)}}else e.Kc&8&&(e.Kc&2?(d=e.Kc&16?6:5,e.Kc&4||--d):(d=e.Kc&1?3:1,e.Kc&4&&--d));else a.Da=null,null==d&&(d=a.pa);if(!Rk(a,d,b))return!1;bl(a,c);return!0} function Rk(a,b,c){if(null!=b&&(b!=a.Da||c)){a.Ed=0;a.Da=b;a.Va=!1;b=a.F||(b==kk?a.la:a.S);if(b!=a.F||b.hb!=a.hb||b.Hb!=a.Hb){Zk(a);if(a.hb){if(!Db(a.na,a.hb,a.Hb))return!1;a.F&&(a.F.$b=!1)}a.F=b;b.$b=!0;a.hb=b.hb;a.Hb=b.Hb;if(!wb(a.na,b.hb,b.Hb,3,b===a.B?b:null))return!1}a.K=0;a.H=a.Vb;a.O=a.yc;a.ab=a.H;a.Pb=jk[kk][2];b=0;if(c=jk[a.Da])a.H=c[0],a.O=c[1],a.Pb=c[2],b=c[3],a.K=c[4],4!=a.sa&&7!=a.sa||a.F!==a.B||3!=a.K||(7==a.B.ib[9]?a.O=43:a.K=a.mb);a.nd=a.H*a.O|0;a.ld=a.nd/a.Pb|0;a.fb=a.ld;a.mc=0;void 0!== -b&&(a.fb=(a.fb<<1)+b|0,a.mc=a.fb+b>>1);a.Fa.length&&(a.ya=a.oa/a.H|0,a.Ca=a.va/a.O|0,a.K?(b=a.Fa[a.K],c=a.Fa[a.K<<1],a.Zd&&80==a.H?c&&a.ya>=3*c.sc>>2&&(a.K<<=1,b=c):(c&&a.ya>=c.sc&&(a.K<<=1,b=c),b&&(a.ya=b.sc,a.Ca=b.tc)),a.jb=a.ub=0,b&&(a.jb=a.H*b.sc,a.ub=a.O*b.tc)):(a.ya=a.Ca=1,a.jb=a.H,a.ub=a.O),a.Wa=a.da.createImageData(a.jb,a.ub),a.Ma=window.document.createElement("canvas"),a.Ma.width=a.jb,a.Ma.height=a.ub,a.Na=a.Ma.getContext("2d"),a.Gc=a.Hc=0,a.nc=a.oa,a.vc=a.va,b=a.oa-a.H*a.ya,c=a.va-a.O*a.Ca, -0>1,a.nc-=b),0>1,a.vc-=c),b||c)&&(a.da.fillStyle=a.ua.style.backgroundColor,a.da.fillRect(0,0,a.oa,a.va));cl(a,!0);mc(a)}return!0}function Xk(a,b,c,d){b=(b+c*a.width)*d.length;a.data[b]=d[0];a.data[b+1]=d[1];a.data[b+2]=d[2];a.data[b+3]=d[3]}function dl(a){a.Ia=-1;a.xa=!1;var b=a.ld;if(void 0===a.W||a.W.length!=b)a.W=Array(b)}function cl(a,b){b||(a.Va=!1);dl(a)} +b&&(a.fb=(a.fb<<1)+b|0,a.mc=a.fb+b>>1);a.Fa.length&&(a.ya=a.oa/a.H|0,a.Ca=a.va/a.O|0,a.K?(b=a.Fa[a.K],c=a.Fa[a.K<<1],a.Zd&&80==a.H?c&&a.ya>=3*c.sc>>2&&(a.K<<=1,b=c):(c&&a.ya>=c.sc&&(a.K<<=1,b=c),b&&(a.ya=b.sc,a.Ca=b.tc)),a.jb=a.ub=0,b&&(a.jb=a.H*b.sc,a.ub=a.O*b.tc)):(a.ya=a.Ca=1,a.jb=a.H,a.ub=a.O),a.Wa=a.da.createImageData(a.jb,a.ub),a.Ma=document.createElement("canvas"),a.Ma.width=a.jb,a.Ma.height=a.ub,a.Na=a.Ma.getContext("2d"),a.Gc=a.Hc=0,a.nc=a.oa,a.vc=a.va,b=a.oa-a.H*a.ya,c=a.va-a.O*a.Ca,0>1,a.nc-=b),0>1,a.vc-=c),b||c)&&(a.da.fillStyle=a.ua.style.backgroundColor,a.da.fillRect(0,0,a.oa,a.va));cl(a,!0);mc(a)}return!0}function Xk(a,b,c,d){b=(b+c*a.width)*d.length;a.data[b]=d[0];a.data[b+1]=d[1];a.data[b+2]=d[2];a.data[b+3]=d[3]}function dl(a){a.Ia=-1;a.xa=!1;var b=a.ld;if(void 0===a.W||a.W.length!=b)a.W=Array(b)}function cl(a,b){b||(a.Va=!1);dl(a)} function $k(a,b,c,d,e){var k=d&255,l=d>>8;d=l&15;var p=a.Fa[a.K];p.Ee&&(d=p.Ee[d]);var q=l>>4&15;p.Ee&&(q=p.Ee[q]);e?(b*=p.sc,c*=p.tc,e.fillStyle=p.ae[q],e.fillRect(b,c,p.sc,p.tc)):(b=b*a.ya+a.Gc,c=c*a.Ca+a.Hc,a.da.fillStyle=p.ae[q],a.da.fillRect(b,c,a.ya,a.Ca));l&256&&(q=(k&15)*p.sc,k=(k>>4)*p.tc,e?e.drawImage(p.dg[d],q,k,p.sc,p.tc,b,c,p.sc,p.tc):a.da.drawImage(p.dg[d],q,k,p.sc,p.tc,b,c,a.ya,a.Ca));l&512&&(k=a.rd,l=a.Zc,e?(a.Ja&&a.Ja!==p.tc&&(k=k*p.tc/a.Ja|0,l=l*p.tc/a.Ja|0),e.fillStyle=p.ae[d], e.fillRect(b,c+k,p.sc,l)):(a.Ja&&a.Ja!==a.Ca&&(k=k*a.Ca/a.Ja|0,l=l*a.Ca/a.Ja|0),a.da.fillStyle=p.ae[d],a.da.fillRect(b,c+k,a.ya,l)))} function mc(a,b){if(a.ja.Qb){var c=!1,d=a.F;d&&(d!==a.B?d.Kc&8&&(c=!0):d.Td&32&&(c=!0));if(c||b){if(b)dl(a);else if(void 0===a.W)return;var e=!1;!(b||++a.Ed&15)&&0<=a.La&&(a.La++,e=!0);var k=0,l=a.nd,p=a.hb,c=p,q=c+a.Hb;19<=a.Da&&(p=c=655360,q=c+65536);if(el(a,d)&8||d.we&&d.weq&&(w=q-c,0> @@ -926,13 +926,13 @@ f.ek=function(){var a=this.S,b;a.$b&&(b=a.qc);return b};f.ql=function(a,b){var c function gl(a,b,c){if(b.qcMissing <canvas> support. Please try a newer web browser.";break}e.setAttribute("class","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.style.backgroundColor=d.screenColor;e.style.height="auto";0<=(window?window.navigator.userAgent:"").indexOf("MSIE")&&(c.onresize= -function(a,b,c,d){return function(){b.style.height=(a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight),c.onresize());c.appendChild(e);var k=window.document.createElement("textarea");xa("iOS")&&(k.setAttribute("autocapitalize","off"),k.setAttribute("autocorrect","off"));c.appendChild(k);var l=e.getContext("2d"),d=new Z(d,e,l,k,c);Wa(d,c)}}); +Ea(function(){for(var a=Xa(document,"pcjs","video"),b=0;bMissing <canvas> support. Please try a newer web browser.";break}e.setAttribute("class","pcjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.style.backgroundColor=d.screenColor;e.style.height="auto";0<=(window?window.navigator.userAgent:"").indexOf("MSIE")&&(c.onresize=function(a, +b,c,d){return function(){b.style.height=(a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight),c.onresize());c.appendChild(e);var k=document.createElement("textarea");xa("iOS")&&(k.setAttribute("autocapitalize","off"),k.setAttribute("autocorrect","off"));c.appendChild(k);var l=e.getContext("2d"),d=new Z(d,e,l,k,c);Wa(d,c)}}); function il(a){this.K=a.adapter;switch(this.K){case 1:this.H=956;this.F=7;break;case 2:this.H=888;this.F=7;break;case 3:this.H=632;this.F=5;break;default:ra("Unrecognized parallel adapter #"+this.K);return}this.B=this.D=null;Ia.call(this,"ParallelPort",a,il);a=a.binding;"console"==a?this.D="":Va(this,a,jl)}Qa(il);var jl="buffer";f=il.prototype;f.Eb=function(a,b,c){switch(b){case jl:return this.qa[b]=this.B=c,!0}return!1}; f.oc=function(a,b,c,d){this.na=b;this.A=c;this.Ta=d;this.T=ib(a,"ChipSet");Lb(b,this,kl,this.H);Nb(b,this,ll,this.H);Za(this)};f.Tb=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};f.Sb=function(a){return a?this.save():!0};f.reset=function(){ml(this)};f.save=function(){var a=new Rd(this),b=0,c=[];c[b++]=this.J;c[b++]=this.Gb;c[b]=this.Ge;D(a,0,c);return a.data()};f.restore=function(a){return ml(this,a[0])}; function ml(a,b){var c=0;void 0===b&&(b=[0,0,0]);a.J=b[c++];a.Gb=b[c++];a.Ge=b[c];return!0}f.nk=function(){return this.J};f.Mk=function(){return this.Gb};f.jk=function(){return this.Ge}; f.zl=function(a,b){this.J=b;this.Gb|=64;var c;if(this.B)8==b?this.B.value=this.B.value.slice(0,-1):(this.B.value+=String.fromCharCode(b),this.B.scrollTop=this.B.scrollHeight),c=!0;else if(null!=this.D){if(10==b||1024<=this.D.length)this.cc(this.D),this.D="";10!=b&&(this.D+=String.fromCharCode(b));c=!0}else c=!1;c&&(this.Gb&=-65);nl(this)};f.ul=function(a,b){this.Ge=b;nl(this)};function nl(a){a.T&&a.F&&(a.Ge&16&&!(a.Gb&64)?Je(a.T,a.F):Ie(a.T,a.F))} -var kl={0:il.prototype.nk,1:il.prototype.Mk,2:il.prototype.jk},ll={0:il.prototype.zl,2:il.prototype.ul};Ea(function(){for(var a=Xa(window.document,"pcjs","parallel"),b=0;b=b)a.preventDefault&&a.preventDefault(),64>8:this.da};f.vk=function(){return this.H};f.wk=function(){return this.K};f.yk=function(){return this.D};f.xk=function(){return this.B};f.Dk=function(){return this.oa}; f.Yl=function(a,b){if(this.K&128)this.S=this.S&-256|b;else{this.pa=b;this.B&=-97;var c;if(this.F){if(13==b)this.O=0;else if(8==b)this.F.value=this.F.value.slice(0,-1),0a.J||0>a.K)a.J=b.clientX,a.K=b.clientY;a.W?(c=b.movementX||b.mozMovementX||b.webkitMovementX||0,d=b.movementY||b.mozMovementY||b.webkitMovementY||0):(c=b.clientX-a.J,d=b.clientY-a.K);a.J=b.clientX;a.K=b.clientY;a.qg(c,d,a.J,a.K)}} -f.ie=function(a,b){if(this.$b&&this.A&&this.A.ja.Rb)switch(a){case Ok:this.O!=b&&(this.O=b,Bl(this));break;case 2:this.S!=b&&(this.S=b,Bl(this))}};f.qg=function(a,b){this.$b&&this.A&&this.A.ja.Rb&&(a||b)&&(this.N=a,this.T=b,Bl(this))};function Bl(a){ql(a.H,[64|(a.O?32:0)|(a.S?16:0)|(a.T&192)>>4|(a.N&192)>>6,a.N&63,a.T&63]);a.N=a.T=0}Ea(function(){for(var a=Xa(window.document,"pcjs","mouse"),b=0;b>4|(a.N&192)>>6,a.N&63,a.T&63]);a.N=a.T=0}Ea(function(){for(var a=Xa(document,"pcjs","mouse"),b=0;b'+b+"");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.qa[b]=c,c.onchange=function(){var a=ca(c.value,10);null!=a&&Pl(d,a)},!0; case "loadDrive":return this.qa[b]=c,c.onclick=function(){var a=d.qa.listDisks;a&&Ql(d,a.options[a.selectedIndex].text,a.value)},!0;case "mountDrive":return this.da?(this.qa[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Ql(d,ea(b,!0),b,a)}return!1}):c.parentNode.removeChild(c),!0}return!1}; f.oc=function(a,b,c,d){this.na=b;this.A=c;this.Ta=d;this.ua=a;this.T=ib(a,"ChipSet");if((this.N=Rl(this.ua,"autoMount")||this.N)&&"string"==typeof this.N)try{this.N=eval("("+this.N+")")}catch(e){ra("FDC auto-mount error: "+e.message+" ("+this.N+")"),this.N=null}Sl(this);Lb(b,this,Tl);Nb(b,this,Ul);this.da&&Vl(this,"Local Disk","?");Vl(this,"Remote Disk","??");Wl(this)||Za(this)}; -f.Tb=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.ua.mg){this.D=[];for(var c=0;cl.Aa.restore(C)&&(p=!1);p&&l.Aa&&void 0!==l.Ya&&(l.Za=l.Aa.seek(l.Bb,l.bb,l.pb));p||(e=!1)}a.O=b[c++]||0;a.J=b[c]||0;return e} function Wl(a,b){b||(a.S=0);if(a.N)for(var c in a.N){var d=a.N[c],e=d.path,k;if(!(k=d.name))a:{if((k=a.qa.listDisks)&&k.options)for(var l=0;la.sb||k[1]>a.tb)&&(this.Ka('Diskette "'+c+'" too large for drive '+String.fromCharCode(65+a.Xa)),b=null);b?(a.Aa=b,a.jj=c,a.Ud=d,$l(this,c,d,b),k=b.info(),this.O|=128,this.Ka('Mounted diskette "'+c+'" in drive '+String.fromCharCode(65+a.Xa),a.Kd||e),a.Kf=k[0],a.Se=k[1],a.Te=k[2]):a.le=!1;a.Kd&&(a.Kd=!1,--this.S||Za(this));Pl(this,a.Xa)}; -function Vl(a,b,c){if((a=a.qa.listDisks)&&a.options){for(var d=0;d=this.F&&(this.ga&=-81,this.H=this.F=0);return a}; f.Bl=function(a,b){this.F=Ol[c].dd){var d=!1;this.H=0;var c=am(this),e,k,l,p,q,w=c&31;switch(w){case 3:am(this);am(this);bm(this);break;case 4:k=am(this);this.Xa=k&3;e=this.B[this.Xa];bm(this);cm(this,(e.nb&-16777216)>>>24);break;case 5:case 6:k=am(this);d=k>>2&1;this.Xa=k&3;e=this.B[this.Xa];e.bb=d;k=e.Bb=am(this);l=am(this);p=e.pb=am(this);q=am(this);e.zb=128<>8:e.nb=7 k-e.ud,0>e.Bb&&(e.Bb=0),e.Bb>=e.sb&&(e.Bb=e.sb-1),e.ud=k,e.nb=32,e.Bb||(e.nb|=268435456),bm(this),d=!0}0>>8);cm(a,(b.nb&16711680)>>>16);var q=0;if(e!=b.Bb||k!=b.bb)q=l=1;c&128&&(k^=q,d||(q=0));cm(a,e+q);cm(a,k);cm(a,l);cm(a,p)} function am(a){var b=a.K[a.H];a.H++;return b}function bm(a){a.H=a.F=0}function cm(a,b){a.K[a.F++]=b}f.tj=function(a,b,c){if(void 0===b||0>b){b=-1;var d=null,e=0;if(!a.nb&&a.Aa){do{if(a.Za&&(e=a.Ya,0<=(b=a.Aa.read(a.Za,a.Ya++)))){d=a.Za;break}a.Za=a.Aa.seek(a.Bb,a.bb,a.pb);if(!a.Za){a.nb=1088;break}a.Ya=0;em(a)}while(1)}c(b,!1,d,e)}else c(-1,!1)};f.uj=function(a,b){return void 0!==b&&0<=b?fm(a,b):-1}; f.Hj=function(a,b){var c;if(void 0!==b&&0<=b)a:if(c=b,a.nb)c=-1;else{a.Mc[a.he++]=c;if(a.he==a.Mc.length){a.Bb=a.Mc[0];a.bb=a.Mc[1];a.pb=a.Mc[2];a.zb=128<fm(a,a.Jh)){c=-1;break a}a.yf++}a.yf>=a.vd&&(c=-1)}else c=-1;return c};function fm(a,b){if(a.nb||!a.Aa)return-1;do{if(a.Za&&a.Aa.write(a.Za,a.Ya++,b))break;a.Za=a.Aa.seek(a.Bb,a.bb,a.pb);if(!a.Za){a.nb=8256;b=-1;break}a.Ya=0;em(a)}while(1);return b} -function em(a){a.pb++;a.pb>=a.Te+1&&(a.pb=1,a.bb++,a.bb>=a.Se&&(a.bb=0,a.Bb++))}var Tl={1012:Nl.prototype.rk,1013:Nl.prototype.pk,1015:Nl.prototype.qk},Ul={1010:Nl.prototype.Cl,1013:Nl.prototype.Bl,1015:Nl.prototype.Al};Ea(function(){for(var a=Xa(window.document,"pcjs","fdc"),b=0;b=a.Te+1&&(a.pb=1,a.bb++,a.bb>=a.Se&&(a.bb=0,a.Bb++))}var Tl={1012:Nl.prototype.rk,1013:Nl.prototype.pk,1015:Nl.prototype.qk},Ul={1010:Nl.prototype.Cl,1013:Nl.prototype.Bl,1015:Nl.prototype.Al};Ea(function(){for(var a=Xa(document,"pcjs","fdc"),b=0;b=a.xb+b&&(a.pb=b,a.bb++,a.bb>=a.tb&&(a.bb=0,a.Fd++))}f.Vk=function(){var a=this.A.I&255;!(this.A.G>>8)&&128>8||!this.T)||(a=!(this.T.fc[0].Vc&64));return a?!0:!1}; var km={800:gm.prototype.Sk,801:gm.prototype.Tk,802:gm.prototype.Rk},jm={496:gm.prototype.xj,497:gm.prototype.Yj,498:gm.prototype.$j,499:gm.prototype.ak,500:gm.prototype.Wj,501:gm.prototype.Vj,502:gm.prototype.Xj,503:gm.prototype.bk},mm={800:gm.prototype.$l,801:gm.prototype.cm,802:gm.prototype.bm,803:gm.prototype.am,807:gm.prototype.kh,811:gm.prototype.kh,815:gm.prototype.kh},lm={496:gm.prototype.il,497:gm.prototype.nl,498:gm.prototype.ll,499:gm.prototype.ml,500:gm.prototype.hl,501:gm.prototype.gl, -502:gm.prototype.jl,503:gm.prototype.fl,1014:gm.prototype.kl};Ea(function(){for(var a=Xa(window.document,"pcjs","hdc"),b=0;bp.indexOf("/")&&(p=window.location.pathname+p);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(p?' url="'+p+'"':""))}p=null;if("<"==a.charAt(0))try{e||(a=a.replace(/\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(p=new window.ActiveXObject("Microsoft.XMLDOM"), p.async=!1,p.loadXML(a)):p=(new window.DOMParser).parseFromString(a,"text/xml")}catch(G){p=null,a=G.message}else a="unrecognized XML: "+(255/g.exec(a)){var e=d[2];b("Loading "+e+"...");pa(e,!0,null,null,function(k,l,p){if(p||!l)c(a,"unable to resolve XML reference: "+d[0]+" ("+p+")");else{if(k=d[3])if(p=l.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var q=p[0],w,B=/( [a-z]+=)(['"])(.*?)\2/g;w=B.exec(k);)q=0>q.indexOf(w[1])?q.replace(">",w[0]+">"):q.replace(new RegExp(w[1]+"(['\"])(.*?)\\1"),w[0]);p[0]!=q&&(l=l.replace(p[0],q))}else{c(a,"missing <"+d[1]+"> in "+e);return}l=l.replace(/<\?xml[^>]*>[\r\n]*/, "");a=a.replace(d[0],l);$m(a,b,c)}})}else c(a,null)} -function an(a,b,c,d){function e(a){if(void 0===p){var b=l&&Xa(l,"machine-warning");p=b&&b[0]||l}p&&(p.innerHTML=ha(a))}function k(a){e("Error: "+a);q&&(--Xm||Ga(!0));q=!1}var l,p,q=!0;Xm++;try{if(l=window.document.getElementById(a)){c||(c="/versions/pcjs/1.20.9/components.xsl");var w=function(d,p){if(p){var q=function(d,q){if(q)if(q)if(e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var w=p.transformNode(q);w?(l.outerHTML=w,--Xm||Ga(!0)):k("transformNodeToObject failed")}else window.document.implementation&& -window.document.implementation.createDocument?(w=new XSLTProcessor,w.importStylesheet(q),(w=w.transformToFragment(p,window.document))?l.parentNode?(l.parentNode.replaceChild(w,l),--Xm||Ga(!0)):k("invalid machine element: "+a):k("transformToFragment failed")):k("unable to transform XML: unsupported browser");else k("failed to load XSL file: "+c);else k(d)};p?Ym(c,null,null,!1,e,q):k("failed to load XML file: "+b)}else k(d)};"<"!=b.charAt(0)?Ym(b,a,d,!0,e,w):Zm(b,null,a,d,!1,e,w)}else k("missing machine element: "+ +function an(a,b,c,d){function e(a){if(void 0===p){var b=l&&Xa(l,"machine-warning");p=b&&b[0]||l}p&&(p.innerHTML=ha(a))}function k(a){e("Error: "+a);q&&(--Xm||Ga(!0));q=!1}var l,p,q=!0;Xm++;try{if(l=document.getElementById(a)){c||(c="/versions/pcjs/1.20.9/components.xsl");var w=function(d,p){if(p){var q=function(d,q){if(q)if(q)if(e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var w=p.transformNode(q);w?(l.outerHTML=w,--Xm||Ga(!0)):k("transformNodeToObject failed")}else document.implementation&& +document.implementation.createDocument?(w=new XSLTProcessor,w.importStylesheet(q),(w=w.transformToFragment(p,document))?l.parentNode?(l.parentNode.replaceChild(w,l),--Xm||Ga(!0)):k("invalid machine element: "+a):k("transformToFragment failed")):k("unable to transform XML: unsupported browser");else k("failed to load XSL file: "+c);else k(d)};p?Ym(c,null,null,!1,e,q):k("failed to load XML file: "+b)}else k(d)};"<"!=b.charAt(0)?Ym(b,a,d,!0,e,w):Zm(b,null,a,d,!1,e,w)}else k("missing machine element: "+ a)}catch(B){k(B.message)}return q}window.embedPC=function(a,b,c,d){Ga(!1);return an(a,b,c,d)};window.enableEvents=Ga;window.sendEvent=Ha;})(); diff --git a/modules/build/lib/build.js b/modules/build/lib/build.js new file mode 100644 index 000000000..5ec8f75ac --- /dev/null +++ b/modules/build/lib/build.js @@ -0,0 +1,451 @@ +/** + * @fileoverview PCjs Build Options + * @author Jeff Parsons + * @version 1.0 + * Created 2016-Feb-10 + * + * Copyright © 2012-2016 Jeff Parsons + * + * This file is part of the JavaScript Machines Project (aka JSMachines) at + * and . + * + * JSMachines is free software: you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * JSMachines is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without + * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with JSMachines. + * If not, see . + * + * You are required to include the above copyright notice in every source code file of every + * copy or modified version of this work, and to display that copyright notice on every screen + * that loads or runs any version of this software (see Computer.COPYRIGHT). + * + * Some JSMachines files also attempt to load external resource files, such as character-image files, + * ROM files, and disk image files. Those external resource files are not considered part of the + * JSMachines Project for purposes of the GNU General Public License, and the author does not claim + * any copyright as to their contents. + */ + +"use strict"; + +/* + * This file provides all the UI options for building a functional PCjs PC. + */ + +var typeAddress = { + type: "address" +}; + +var typeBoolean = { + type: "boolean" +}; + +var typeNumber = { + type: "number" +}; + +var typePath = { + type: "string" +}; + +var typeString = { + type: "string" +}; + +var typeElement = { + type: "element" +}; + +var machineOptions = { + 'ibm5150': "IBM PC (Model 5150)", + 'ibm5160': "IBM PC XT (Model 5160)", + 'ibm5170': "IBM PC AT (Model 5170)", + 'deskpro386': "COMPAQ DeskPro 386" +}; + +var videoLEDCapsLock = { + 'control': { + _type: typeElement, + 'type': { + _type: typeString, + _value: "led" + }, + 'label': { + _type: typeString, + _value: "Caps" + }, + 'binding': { + _type: typeString, + _value: "caps-lock" + }, + 'pad-left': { + _type: typeString, + _value: "8px" + } + } +}; + +var videoLEDNumLock = { + 'control': { + _type: typeElement, + 'type': { + _type: typeString, + _value: "led" + }, + 'label': { + _type: typeString, + _value: "Num" + }, + 'binding': { + _type: typeString, + _value: "num-lock" + }, + 'pad-left': { + _type: typeString, + _value: "8px" + } + } +}; + +var videoLEDScrollLock = { + 'control': { + _type: typeElement, + 'type': { + _type: typeString, + _value: "led" + }, + 'label': { + _type: typeString, + _value: "Scroll" + }, + 'binding': { + _type: typeString, + _value: "scroll-lock" + }, + 'pad-left': { + _type: typeString, + _value: "8px" + } + } +}; + +var videoLEDContainer = { + _type: typeElement, + _value: [videoLEDCapsLock, videoLEDNumLock, videoLEDScrollLock], + 'type': { + _type: typeString, + _value: "container" + }, + 'pos': { + _type: typeString, + _value: "right" + } +}; + +var videoCGALEDContainer = { + 'title': { + _type: typeElement, + _value: "Color Display" + }, + 'control': videoLEDContainer +}; + +var videoCGALEDMenu = { + 'menu': { + _type: typeElement, + _value: videoCGALEDContainer + } +}; + +var machineElements = { + 'name': { + _type: typeElement, + _desc: "Machine Description", + _value: "IBM PC" + }, + 'computer': { + _type: typeElement, + _desc: "General Computer Features", + _value: null, + 'buswidth': { + _type: typeNumber, + _desc: "Bus width", + _opts: { + 20: "20-bit bus", + 24: "24-bit bus", + 32: "32-bit bus" + } + }, + 'resume': { + _type: typeNumber, + _desc: "Resume option", + _opts: { + 0: "Resume Disabled", + 1: "Resume Enabled", + 2: "Resume with Prompt" + } + } + }, + 'ram': { + _type: typeElement, + _desc: "Read-Write Memory (Conventional or Extended)", + _multi: true, + _value: [ + { + 'id': "ramLow", + 'addr': "0x00000" + } + ], + 'id': { + _type: typeString + }, + 'addr': { + _type: typeAddress + }, + 'size': { + _type: typeNumber + } + }, + 'rom': { + _type: typeElement, + _desc: "Read-Only Memory", + _multi: true, + _value: [ + { + 'id': "romBASIC", + 'addr': "0xf6000", + 'size': "0x8000", + 'file': "/devices/pc/rom/5150/basic/BASIC100.json" + }, + { + 'id': "romBIOS", + 'addr': "0xfe000", + 'size': "0x2000", + 'file': "/devices/pc/rom/5150/bios/1981-04-24/PCBIOS-REV1.json" + } + ], + 'addr': { + _type: typeAddress + }, + 'size': { + _type: typeNumber + }, + 'file': { + _type: typePath + } + }, + 'video': { + _type: typeElement, + _desc: "Video Adapter", + _multi: false, + _opts: { + 'cga': { + 'screenwidth': { + _type: typeNumber, + _opts: [960] + }, + 'screenheight': { + _type: typeNumber, + _opts: [480] + }, + 'scale': { + _type: typeBoolean, + _opts: [true] + }, + 'charset': { + _type: typePath, + _opts: ["/devices/pc/video/ibm/cga/ibm-cga.json"] + }, + 'pos': { + _type: typeString, + _opts: ["center"] + }, + 'padding': { + _type: typeString, + _opts: ["8px"] + }, + 'controls': videoCGALEDMenu + } + } + } +}; + +var pcElements = { + 'machine': { + _desc: "Machine", + _type: typeElement, + _opts: machineOptions, + _value: machineElements, + 'id': { + _type: typeString + }, + 'class': { + _type: typeString, + _value: "pc" + }, + 'border': { + _type: typeNumber, + _value: "1" + }, + 'pos': { + _type: typeString, + _value: "center" + }, + 'background': { + _type: typeString, + _value: "#FAEBD7" + } + } +}; + +/* + * As we build a PC, elements will be added to pcState that mirror the template structures above. Also, + * as choices are made, the identifier of that choice will be added as the 'id' of the corresponding element. + * + * 'machine': { + * 'id': "ibm5150", + * 'class': "pc", + * 'border': "1", + * 'pos': "center" + * 'background': "#FAEBD7" + * 'name': { + * }, + * 'computer': { + * }, + * 'ram': { + * } + * // ... + * } + */ +var pcState = {}; + +/** + * findNewItem(state, template) + * + * @param {Object} state (eg, pcState) + * @param {Object} template (eg, pcElements) + * @return {Object|null} (eg, state['machine']) + */ +function findNewItem(state, template) +{ + for (var item in template) { + + if (item.charAt(0) == '_') continue; + + if (state[item] === undefined) { + state[item] = { + _template: template[item] + }; + return state[item]; + } + + if (typeof template[item] == "object") { + var itemNext = findNewItem(state[item], template[item]); + if (itemNext) return itemNext; + } + } + + if (template._type == typeElement && template._value && typeof template._value == "object") { + return findNewItem(state, template._value); + } + + return null; +} + +/** + * setNewItem(idHTML, eHTML, item) + * + * @param {string} idHTML + * @param {Object} eHTML + * @param {Object} item (ie, a node in pcState with a _template that contains _opts) + */ +function setNewItem(idHTML, eHTML, item) +{ + /* + * First, remove any old options... + * + while (eHTML.firstChild) { + eHTML.removeChild(eHTML.firstChild); + } + */ + /* + * Next, add a new set of options.... + */ + var value; + var opts = item._template._opts; + if (!opts) { + value = item._template._value; + if (value) { + populateItem(item, null); + } + else { + /* + * Add an input field to prompt for the value... + */ + } + setTimeout(function() { buildPC(idHTML) }, 0); + } + else { + var eSelect = document.createElement("select"); + var eOption = document.createElement("option"); + eOption['value'] = "none"; + eOption.textContent = "Select a " + item._template._desc + "..."; + eSelect.appendChild(eOption); + for (value in opts) { + eOption = document.createElement("option"); + eOption['value'] = value; + eOption.textContent = opts[value]; + eSelect.appendChild(eOption); + } + eSelect.onchange = function(event) { + var id = eSelect.value; + if (id != "none" && id != item.id) { + populateItem(item, id); + setTimeout(function() { buildPC(idHTML) }, 0); + } + }; + eHTML.appendChild(eSelect); + } +} + +/** + * populateItem(item, id) + * + * @param {Object} item (eg, state['machine']) + * @param {string|null} id for item + */ +function populateItem(item, id) +{ + if (id) item.id = id; + for (var prop in item._template) { + if (prop == '_value' && !id) { + item[prop] = item._template[prop]; + } + if (prop.charAt(0) != '_') { + var attr = item._template[prop]; + if (item[prop] === undefined && typeof attr._value == "string") { + item[prop] = attr._value; + } + } + } +} + +/** + * buildPC(idHTML) + * + * @param {string} idHTML (the ID of the DIV where build UI options should be presented) + */ +function buildPC(idHTML) +{ + var eHTML = document.getElementById(idHTML); + if (eHTML) { + var item = findNewItem(pcState, pcElements); + if (item) { + setNewItem(idHTML, eHTML, item); + } + } +} diff --git a/modules/c1pjs/lib/computer.js b/modules/c1pjs/lib/computer.js index 334a7cdd3..a6cb8d1ce 100644 --- a/modules/c1pjs/lib/computer.js +++ b/modules/c1pjs/lib/computer.js @@ -265,7 +265,7 @@ C1PComputer.power = function(computer) */ C1PComputer.init = function() { - var aeComputers = Component.getElementsByClass(window.document, C1PJSCLASS, "computer"); + var aeComputers = Component.getElementsByClass(document, C1PJSCLASS, "computer"); for (var iComputer=0; iComputer < aeComputers.length; iComputer++) { diff --git a/modules/c1pjs/lib/cpu.js b/modules/c1pjs/lib/cpu.js index 1e6693129..d99d4b07c 100644 --- a/modules/c1pjs/lib/cpu.js +++ b/modules/c1pjs/lib/cpu.js @@ -3879,7 +3879,7 @@ C1PCPU.prototype.opUndefined = function() */ C1PCPU.init = function() { - var aeCPUs = Component.getElementsByClass(window.document, C1PJSCLASS, "cpu"); + var aeCPUs = Component.getElementsByClass(document, C1PJSCLASS, "cpu"); for (var iCPU=0; iCPU < aeCPUs.length; iCPU++) { var eCPU = aeCPUs[iCPU]; var parmsCPU = Component.getComponentParms(eCPU); diff --git a/modules/c1pjs/lib/debugger.js b/modules/c1pjs/lib/debugger.js index ddc3f16bc..0477eb6f0 100644 --- a/modules/c1pjs/lib/debugger.js +++ b/modules/c1pjs/lib/debugger.js @@ -2202,7 +2202,7 @@ if (DEBUGGER) { */ C1PDebugger.init = function() { - var aeDbg = Component.getElementsByClass(window.document, C1PJSCLASS, "debugger"); + var aeDbg = Component.getElementsByClass(document, C1PJSCLASS, "debugger"); for (var iDbg=0; iDbg < aeDbg.length; iDbg++) { var eDbg = aeDbg[iDbg]; var parmsDbg = Component.getComponentParms(eDbg); diff --git a/modules/c1pjs/lib/disk.js b/modules/c1pjs/lib/disk.js index 4f271687b..0f5f70487 100644 --- a/modules/c1pjs/lib/disk.js +++ b/modules/c1pjs/lib/disk.js @@ -1254,7 +1254,7 @@ C1PDiskController.prototype.writePort = function(port, reg) */ C1PDiskController.init = function() { - var aeDC = Component.getElementsByClass(window.document, C1PJSCLASS, "disk"); + var aeDC = Component.getElementsByClass(document, C1PJSCLASS, "disk"); for (var iDC=0; iDC < aeDC.length; iDC++) { var eDC = aeDC[iDC]; var parmsDC = Component.getComponentParms(eDC); diff --git a/modules/c1pjs/lib/keyboard.js b/modules/c1pjs/lib/keyboard.js index d8aef7480..80d3a5153 100644 --- a/modules/c1pjs/lib/keyboard.js +++ b/modules/c1pjs/lib/keyboard.js @@ -1094,7 +1094,7 @@ C1PKeyboard.prototype.updateMemory = function(fPropagate, addr, bWrite) */ C1PKeyboard.init = function() { - var aeKbd = Component.getElementsByClass(window.document, C1PJSCLASS, "keyboard"); + var aeKbd = Component.getElementsByClass(document, C1PJSCLASS, "keyboard"); for (var iKbd=0; iKbd < aeKbd.length; iKbd++) { var eKbd = aeKbd[iKbd]; var parmsKbd = Component.getComponentParms(eKbd); diff --git a/modules/c1pjs/lib/panel.js b/modules/c1pjs/lib/panel.js index 27dc94c62..207e09835 100644 --- a/modules/c1pjs/lib/panel.js +++ b/modules/c1pjs/lib/panel.js @@ -112,7 +112,7 @@ C1PPanel.prototype.setPower = function(fOn, cmp) C1PPanel.init = function() { var fReady = false; - var aePanels = Component.getElementsByClass(window.document, C1PJSCLASS, "panel"); + var aePanels = Component.getElementsByClass(document, C1PJSCLASS, "panel"); for (var iPanel=0; iPanel < aePanels.length; iPanel++) { var ePanel = aePanels[iPanel]; var parmsPanel = Component.getComponentParms(ePanel); diff --git a/modules/c1pjs/lib/ram.js b/modules/c1pjs/lib/ram.js index b2ee6d3d6..c08c8022f 100644 --- a/modules/c1pjs/lib/ram.js +++ b/modules/c1pjs/lib/ram.js @@ -83,7 +83,7 @@ C1PRAM.prototype.setBuffer = function(abMemory, start, end, cpu) */ C1PRAM.init = function() { - var aeRAM = Component.getElementsByClass(window.document, C1PJSCLASS, "ram"); + var aeRAM = Component.getElementsByClass(document, C1PJSCLASS, "ram"); for (var iRAM=0; iRAM < aeRAM.length; iRAM++) { var eRAM = aeRAM[iRAM]; var parmsRAM = Component.getComponentParms(eRAM); diff --git a/modules/c1pjs/lib/rom.js b/modules/c1pjs/lib/rom.js index 508d6fa03..68df02ba0 100644 --- a/modules/c1pjs/lib/rom.js +++ b/modules/c1pjs/lib/rom.js @@ -229,7 +229,7 @@ C1PROM.prototype.copyImage = function() */ C1PROM.init = function() { - var aeROM = Component.getElementsByClass(window.document, C1PJSCLASS, "rom"); + var aeROM = Component.getElementsByClass(document, C1PJSCLASS, "rom"); for (var iROM=0; iROM < aeROM.length; iROM++) { var eROM = aeROM[iROM]; var parmsROM = Component.getComponentParms(eROM); diff --git a/modules/c1pjs/lib/serial.js b/modules/c1pjs/lib/serial.js index bbdb19f62..c0e6304f3 100644 --- a/modules/c1pjs/lib/serial.js +++ b/modules/c1pjs/lib/serial.js @@ -391,7 +391,7 @@ C1PSerialPort.prototype.updateMemory = function() */ C1PSerialPort.init = function() { - var aeSerial = Component.getElementsByClass(window.document, C1PJSCLASS, "serial"); + var aeSerial = Component.getElementsByClass(document, C1PJSCLASS, "serial"); for (var iSerial=0; iSerial < aeSerial.length; iSerial++) { var eSerial = aeSerial[iSerial]; var parmsSerial = Component.getComponentParms(eSerial); diff --git a/modules/c1pjs/lib/video.js b/modules/c1pjs/lib/video.js index 957d77080..7b22d6d25 100644 --- a/modules/c1pjs/lib/video.js +++ b/modules/c1pjs/lib/video.js @@ -533,7 +533,7 @@ C1PVideo.prototype.updateWindow = function(col, row, b) */ C1PVideo.init = function() { - var aeVideo = Component.getElementsByClass(window.document, C1PJSCLASS, "video"); + var aeVideo = Component.getElementsByClass(document, C1PJSCLASS, "video"); for (var iVideo=0; iVideo < aeVideo.length; iVideo++) { var eVideo = aeVideo[iVideo]; var parmsVideo = Component.getComponentParms(eVideo); @@ -547,7 +547,7 @@ C1PVideo.init = function() * I've since settled on a better work-around in keyboard.js, so I've stopped worrying about how to make * "autocapitalize" work here. */ - var eCanvas = window.document.createElement("canvas"); + var eCanvas = document.createElement("canvas"); if (eCanvas === undefined || !eCanvas.getContext) { eVideo.innerHTML = "
Missing <canvas> support. Please try a newer web browser."; return; diff --git a/modules/htmlout/lib/htmlout.js b/modules/htmlout/lib/htmlout.js index af4d70a33..2b87c2bd8 100644 --- a/modules/htmlout/lib/htmlout.js +++ b/modules/htmlout/lib/htmlout.js @@ -1908,7 +1908,7 @@ HTMLOut.prototype.processMachines = function(aMachines, buildOptions, done) this.addFilesToHTML(asFiles, sScriptEmbed); if (buildOptions.id) { asFiles = []; - asFiles.push("/modules/pcbuild/lib/build.js"); + asFiles.push("/modules/build/lib/build.js"); sScriptEmbed = ''; this.addFilesToHTML(asFiles, sScriptEmbed); } diff --git a/modules/markout/lib/markout.js b/modules/markout/lib/markout.js index ff0278792..4a003f784 100644 --- a/modules/markout/lib/markout.js +++ b/modules/markout/lib/markout.js @@ -1134,7 +1134,7 @@ MarkOut.prototype.convertMDMachineLinks = function(sBlock) reIncludes.lastIndex = 0; // reset lastIndex, since we just modified the string that reIncludes is iterating over } - sBlock = sBlock.replace(/\{%\s*include\s+build\.html\s+id=(["'])(.*?)\1\s*%}/g, '
'); + sBlock = sBlock.replace(/\{%\s*include\s+build\.html\s+id=(["'])(.*?)\1\s*%}/g, '
'); /* * Start looking for Markdown-style machine links now... diff --git a/modules/pcbuild/lib/build.js b/modules/pcbuild/lib/build.js deleted file mode 100644 index 782fbb938..000000000 --- a/modules/pcbuild/lib/build.js +++ /dev/null @@ -1,117 +0,0 @@ -/** - * @fileoverview PCjs Build Options - * @author Jeff Parsons - * @version 1.0 - * Created 2016-Feb-10 - * - * Copyright © 2012-2016 Jeff Parsons - * - * This file is part of the JavaScript Machines Project (aka JSMachines) at - * and . - * - * JSMachines is free software: you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * JSMachines is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with JSMachines. - * If not, see . - * - * You are required to include the above copyright notice in every source code file of every - * copy or modified version of this work, and to display that copyright notice on every screen - * that loads or runs any version of this software (see Computer.COPYRIGHT). - * - * Some JSMachines files also attempt to load external resource files, such as character-image files, - * ROM files, and disk image files. Those external resource files are not considered part of the - * JSMachines Project for purposes of the GNU General Public License, and the author does not claim - * any copyright as to their contents. - */ - -"use strict"; - -/* - * This file provides all the UI options for building a functional PCjs PC. - */ - -var typeAddress = { - type: "address" -}; - -var typeBoolean = { - type: "boolean" -}; - -var typeNumber = { - type: "number" -}; - -var typePath = { - type: "string" -}; - -var typeString = { - type: "string" -}; - -var machineTypes = { - '5150': "IBM PC (Model 5150)", - '5160': "IBM PC XT (Model 5160)", - '5170': "IBM PC AT (Model 5170)", - 'deskpro386': "COMPAQ DeskPro 386" -}; - -var aMachineElements = { - 'machine': { - choices: machineTypes - }, - 'name': { - desc: "Machine Description" - }, - 'computer': { - desc: "General Computer Features", - 'buswidth': { - type: typeNumber, - values: [20, 24, 32] - }, - 'resume': { - type: typeNumber, - value: [0, 1, 2], - descs: ["Resume Disabled", "Resume Enabled", "Resume with Prompt"] - } - }, - 'ram': { - desc: "Read-Write Memory (Conventional or Extended)", - 'addr': { - type: typeAddress - }, - 'size': { - type: typeNumber - } - }, - 'rom': { - desc: "Read-Only Memory", - 'addr': { - type: typeAddress - }, - 'size': { - type: typeNumber - }, - 'file': { - type: typePath - } - } -}; - - -/** - * buildPC(idElement) - * - * @param {string} idElement (the ID of the DIV where build UI options should be presented) - */ -function buildPC(idElement) -{ - alert("build.js loaded: " + idElement); -} diff --git a/modules/pcjs/lib/chipset.js b/modules/pcjs/lib/chipset.js index 7b9e12e27..145453726 100644 --- a/modules/pcjs/lib/chipset.js +++ b/modules/pcjs/lib/chipset.js @@ -5379,7 +5379,7 @@ ChipSet.aPortOutput5170 = { */ ChipSet.init = function() { - var aeChipSet = Component.getElementsByClass(window.document, PCJSCLASS, "chipset"); + var aeChipSet = Component.getElementsByClass(document, PCJSCLASS, "chipset"); for (var iChip = 0; iChip < aeChipSet.length; iChip++) { var eChipSet = aeChipSet[iChip]; var parmsChipSet = Component.getComponentParms(eChipSet); diff --git a/modules/pcjs/lib/computer.js b/modules/pcjs/lib/computer.js index 813613e6e..b9b31666e 100644 --- a/modules/pcjs/lib/computer.js +++ b/modules/pcjs/lib/computer.js @@ -344,7 +344,7 @@ Computer.prototype.getMachineID = function() * * @param {string} sParm * @param {Object} [parmsComponent] - * @return {Object|number|string|boolean|null|undefined} + * @return {string|null} */ Computer.prototype.getMachineParm = function(sParm, parmsComponent) { @@ -1371,7 +1371,7 @@ Computer.init = function() */ if (!COMPILED && XMLVERSION) Computer.APPVERSION = XMLVERSION; - var aeMachines = Component.getElementsByClass(window.document, PCJSCLASS + "-machine"); + var aeMachines = Component.getElementsByClass(document, PCJSCLASS + "-machine"); for (var iMachine = 0; iMachine < aeMachines.length; iMachine++) { @@ -1421,7 +1421,7 @@ Computer.init = function() */ Computer.show = function() { - var aeComputers = Component.getElementsByClass(window.document, PCJSCLASS, "computer"); + var aeComputers = Component.getElementsByClass(document, PCJSCLASS, "computer"); for (var iComputer = 0; iComputer < aeComputers.length; iComputer++) { var eComputer = aeComputers[iComputer]; var parmsComputer = Component.getComponentParms(eComputer); @@ -1470,7 +1470,7 @@ Computer.show = function() */ Computer.exit = function() { - var aeComputers = Component.getElementsByClass(window.document, PCJSCLASS, "computer"); + var aeComputers = Component.getElementsByClass(document, PCJSCLASS, "computer"); for (var iComputer = 0; iComputer < aeComputers.length; iComputer++) { var eComputer = aeComputers[iComputer]; var parmsComputer = Component.getComponentParms(eComputer); diff --git a/modules/pcjs/lib/debugger.js b/modules/pcjs/lib/debugger.js index 26f480dca..e0a9fd206 100644 --- a/modules/pcjs/lib/debugger.js +++ b/modules/pcjs/lib/debugger.js @@ -8131,7 +8131,7 @@ if (DEBUGGER) { */ Debugger.init = function() { - var aeDbg = Component.getElementsByClass(window.document, PCJSCLASS, "debugger"); + var aeDbg = Component.getElementsByClass(document, PCJSCLASS, "debugger"); for (var iDbg = 0; iDbg < aeDbg.length; iDbg++) { var eDbg = aeDbg[iDbg]; var parmsDbg = Component.getComponentParms(eDbg); diff --git a/modules/pcjs/lib/fdc.js b/modules/pcjs/lib/fdc.js index 303a3d52d..e4dadaa27 100644 --- a/modules/pcjs/lib/fdc.js +++ b/modules/pcjs/lib/fdc.js @@ -592,7 +592,7 @@ FDC.prototype.powerUp = function(data, fRepower) } controlDrives.textContent = ""; for (var iDrive = 0; iDrive < this.nDrives; iDrive++) { - var controlOption = window.document.createElement("option"); + var controlOption = document.createElement("option"); controlOption['value'] = iDrive; /* * TODO: This conversion of drive number to drive letter, starting with A:, is very simplistic @@ -1416,7 +1416,7 @@ FDC.prototype.addDiskette = function(sName, sPath) for (var i = 0; i < controlDisks.options.length; i++) { if (controlDisks.options[i].value == sPath) return; } - var controlOption = window.document.createElement("option"); + var controlOption = document.createElement("option"); controlOption['value'] = sPath; controlOption.textContent = sName; controlDisks.appendChild(controlOption); @@ -2518,7 +2518,7 @@ FDC.aPortOutput = { * any associated HTML controls to the new component. */ FDC.init = function() { - var aeFDC = Component.getElementsByClass(window.document, PCJSCLASS, "fdc"); + var aeFDC = Component.getElementsByClass(document, PCJSCLASS, "fdc"); for (var iFDC = 0; iFDC < aeFDC.length; iFDC++) { var eFDC = aeFDC[iFDC]; var parmsFDC = Component.getComponentParms(eFDC); diff --git a/modules/pcjs/lib/hdc.js b/modules/pcjs/lib/hdc.js index afec70d1b..d7b853159 100644 --- a/modules/pcjs/lib/hdc.js +++ b/modules/pcjs/lib/hdc.js @@ -3001,7 +3001,7 @@ HDC.aATCPortOutput = { */ HDC.init = function() { - var aeHDC = Component.getElementsByClass(window.document, PCJSCLASS, "hdc"); + var aeHDC = Component.getElementsByClass(document, PCJSCLASS, "hdc"); for (var iHDC = 0; iHDC < aeHDC.length; iHDC++) { var eHDC = aeHDC[iHDC]; var parmsHDC = Component.getComponentParms(eHDC); diff --git a/modules/pcjs/lib/keyboard.js b/modules/pcjs/lib/keyboard.js index 6f18149f2..ff9f65f9a 100644 --- a/modules/pcjs/lib/keyboard.js +++ b/modules/pcjs/lib/keyboard.js @@ -2312,7 +2312,7 @@ Keyboard.prototype.keySimulate = function(simCode, fDown) */ Keyboard.init = function() { - var aeKbd = Component.getElementsByClass(window.document, PCJSCLASS, "keyboard"); + var aeKbd = Component.getElementsByClass(document, PCJSCLASS, "keyboard"); for (var iKbd = 0; iKbd < aeKbd.length; iKbd++) { var eKbd = aeKbd[iKbd]; var parmsKbd = Component.getComponentParms(eKbd); diff --git a/modules/pcjs/lib/mouse.js b/modules/pcjs/lib/mouse.js index 386d2d977..76047e996 100644 --- a/modules/pcjs/lib/mouse.js +++ b/modules/pcjs/lib/mouse.js @@ -717,7 +717,7 @@ Mouse.prototype.notifyMCR = function(bMCR) */ Mouse.init = function() { - var aeMouse = Component.getElementsByClass(window.document, PCJSCLASS, "mouse"); + var aeMouse = Component.getElementsByClass(document, PCJSCLASS, "mouse"); for (var iMouse = 0; iMouse < aeMouse.length; iMouse++) { var eMouse = aeMouse[iMouse]; var parmsMouse = Component.getComponentParms(eMouse); diff --git a/modules/pcjs/lib/panel.js b/modules/pcjs/lib/panel.js index 6a49a5ecf..1da2164cb 100644 --- a/modules/pcjs/lib/panel.js +++ b/modules/pcjs/lib/panel.js @@ -294,13 +294,13 @@ Panel.prototype.setBinding = function(sHTMLType, sBinding, control, sValue) this.cxDump = this.cxReg; this.cyDump = ((this.canvas.height * Panel.LIVEDUMP.CY) / Panel.LIVECANVAS.CY) | 0; - this.canvasLiveMem = window.document.createElement("canvas"); + this.canvasLiveMem = document.createElement("canvas"); this.canvasLiveMem.width = Panel.LIVEMEM.CX; this.canvasLiveMem.height = Panel.LIVEMEM.CY; this.contextLiveMem = this.canvasLiveMem.getContext("2d"); this.imageLiveMem = this.contextLiveMem.createImageData(this.canvasLiveMem.width, this.canvasLiveMem.height); - this.canvasLiveRegs = window.document.createElement("canvas"); + this.canvasLiveRegs = document.createElement("canvas"); this.canvasLiveRegs.width = Panel.LIVEREGS.CX; this.canvasLiveRegs.height = Panel.LIVEREGS.CY; this.contextLiveRegs = this.canvasLiveRegs.getContext("2d"); @@ -969,7 +969,7 @@ Panel.prototype.centerText = function(sText) Panel.init = function() { var fReady = false; - var aePanels = Component.getElementsByClass(window.document, PCJSCLASS, "panel"); + var aePanels = Component.getElementsByClass(document, PCJSCLASS, "panel"); for (var iPanel=0; iPanel < aePanels.length; iPanel++) { var ePanel = aePanels[iPanel]; var parmsPanel = Component.getComponentParms(ePanel); diff --git a/modules/pcjs/lib/parallelport.js b/modules/pcjs/lib/parallelport.js index 6d8a9e19e..6fbc9c3af 100644 --- a/modules/pcjs/lib/parallelport.js +++ b/modules/pcjs/lib/parallelport.js @@ -503,7 +503,7 @@ ParallelPort.aPortOutput = { */ ParallelPort.init = function() { - var aeParallel = Component.getElementsByClass(window.document, PCJSCLASS, "parallel"); + var aeParallel = Component.getElementsByClass(document, PCJSCLASS, "parallel"); for (var iParallel = 0; iParallel < aeParallel.length; iParallel++) { var eParallel = aeParallel[iParallel]; var parmsParallel = Component.getComponentParms(eParallel); diff --git a/modules/pcjs/lib/ram.js b/modules/pcjs/lib/ram.js index 4273386b3..fd9999416 100644 --- a/modules/pcjs/lib/ram.js +++ b/modules/pcjs/lib/ram.js @@ -266,7 +266,7 @@ RAM.prototype.restore = function(data) */ RAM.init = function() { - var aeRAM = Component.getElementsByClass(window.document, PCJSCLASS, "ram"); + var aeRAM = Component.getElementsByClass(document, PCJSCLASS, "ram"); for (var iRAM = 0; iRAM < aeRAM.length; iRAM++) { var eRAM = aeRAM[iRAM]; var parmsRAM = Component.getComponentParms(eRAM); diff --git a/modules/pcjs/lib/rom.js b/modules/pcjs/lib/rom.js index 32226f18b..c4dcc55ae 100644 --- a/modules/pcjs/lib/rom.js +++ b/modules/pcjs/lib/rom.js @@ -405,7 +405,7 @@ ROM.prototype.cloneROM = function(addr) */ ROM.init = function() { - var aeROM = Component.getElementsByClass(window.document, PCJSCLASS, "rom"); + var aeROM = Component.getElementsByClass(document, PCJSCLASS, "rom"); for (var iROM = 0; iROM < aeROM.length; iROM++) { var eROM = aeROM[iROM]; var parmsROM = Component.getComponentParms(eROM); diff --git a/modules/pcjs/lib/serialport.js b/modules/pcjs/lib/serialport.js index 01df310c9..9287ef430 100644 --- a/modules/pcjs/lib/serialport.js +++ b/modules/pcjs/lib/serialport.js @@ -897,7 +897,7 @@ SerialPort.aPortOutput = { */ SerialPort.init = function() { - var aeSerial = Component.getElementsByClass(window.document, PCJSCLASS, "serial"); + var aeSerial = Component.getElementsByClass(document, PCJSCLASS, "serial"); for (var iSerial = 0; iSerial < aeSerial.length; iSerial++) { var eSerial = aeSerial[iSerial]; var parmsSerial = Component.getComponentParms(eSerial); diff --git a/modules/pcjs/lib/video.js b/modules/pcjs/lib/video.js index b3589a21f..d61a37f4f 100644 --- a/modules/pcjs/lib/video.js +++ b/modules/pcjs/lib/video.js @@ -3232,7 +3232,7 @@ Video.prototype.onFocusChange = function(fFocus) * * if (fFocus) { * window.scrollTo(0, 0); - * window.document.body.scrollTop = 0; + * document.body.scrollTop = 0; * } */ this.fHasFocus = fFocus; @@ -4221,7 +4221,7 @@ Video.prototype.createFontColor = function(font, iColor, rgbColor, nDouble, offD * We still have to use putImageData() to build the font canvas, but that's a one-time operation. */ var rgbOff = [0x00, 0x00, 0x00, 0x00]; - var canvasFont = window.document.createElement("canvas"); + var canvasFont = document.createElement("canvas"); canvasFont.width = font.cxCell << 4; canvasFont.height = (font.cyCell << 4); var contextFont = canvasFont.getContext("2d"); @@ -4780,7 +4780,7 @@ Video.prototype.setDimensions = function() * Allocate the off-screen buffers */ this.imageScreenBuffer = this.contextScreen.createImageData(this.cxBuffer, this.cyBuffer); - this.canvasScreenBuffer = window.document.createElement("canvas"); + this.canvasScreenBuffer = document.createElement("canvas"); this.canvasScreenBuffer.width = this.cxBuffer; this.canvasScreenBuffer.height = this.cyBuffer; this.contextScreenBuffer = this.canvasScreenBuffer.getContext("2d"); @@ -7116,12 +7116,12 @@ Video.aVGAPortOutput = { */ Video.init = function() { - var aeVideo = Component.getElementsByClass(window.document, PCJSCLASS, "video"); + var aeVideo = Component.getElementsByClass(document, PCJSCLASS, "video"); for (var iVideo = 0; iVideo < aeVideo.length; iVideo++) { var eVideo = aeVideo[iVideo]; var parmsVideo = Component.getComponentParms(eVideo); - var eCanvas = window.document.createElement("canvas"); + var eCanvas = document.createElement("canvas"); if (eCanvas === undefined || !eCanvas.getContext) { eVideo.innerHTML = "
Missing <canvas> support. Please try a newer web browser."; return; @@ -7176,14 +7176,14 @@ Video.init = function() * clearly see the overlaid semi-transparent input field, but none of the input characters were passed along, * with the exception of the "Go" (Enter) key. * - * var eInput = window.document.createElement("input"); + * var eInput = document.createElement("input"); * eInput.setAttribute("type", "password"); * eInput.setAttribute("style", "position:absolute; left:0; top:0; width:100%; height:100%; opacity:0.5"); * eVideo.appendChild(eInput); * * See this Chromium issue for more information: https://code.google.com/p/chromium/issues/detail?id=118639 */ - var eTextArea = window.document.createElement("textarea"); + var eTextArea = document.createElement("textarea"); /* * As noted in keyboard.js, the keyboard on an iOS device tends to pop up with the SHIFT key depressed, diff --git a/modules/pcjs/lib/x86cpu.js b/modules/pcjs/lib/x86cpu.js index dbebec0b4..42ce4d585 100644 --- a/modules/pcjs/lib/x86cpu.js +++ b/modules/pcjs/lib/x86cpu.js @@ -4358,7 +4358,7 @@ X86CPU.prototype.stepCPU = function(nMinCycles) */ X86CPU.init = function() { - var aeCPUs = Component.getElementsByClass(window.document, PCJSCLASS, "cpu"); + var aeCPUs = Component.getElementsByClass(document, PCJSCLASS, "cpu"); for (var iCPU = 0; iCPU < aeCPUs.length; iCPU++) { var eCPU = aeCPUs[iCPU]; var parmsCPU = Component.getComponentParms(eCPU); diff --git a/modules/pcjs/lib/x86fpu.js b/modules/pcjs/lib/x86fpu.js index 55268b7de..c0797ff28 100644 --- a/modules/pcjs/lib/x86fpu.js +++ b/modules/pcjs/lib/x86fpu.js @@ -3363,7 +3363,7 @@ X86FPU.afnPreserveExceptions = [ */ X86FPU.init = function() { - var aeFPUs = Component.getElementsByClass(window.document, PCJSCLASS, "fpu"); + var aeFPUs = Component.getElementsByClass(document, PCJSCLASS, "fpu"); for (var iFPU = 0; iFPU < aeFPUs.length; iFPU++) { var eFPU = aeFPUs[iFPU]; var parmsFPU = Component.getComponentParms(eFPU); diff --git a/modules/shared/lib/component.js b/modules/shared/lib/component.js index e2114c791..9f38810d4 100644 --- a/modules/shared/lib/component.js +++ b/modules/shared/lib/component.js @@ -51,7 +51,7 @@ "use strict"; -/* global window: true, DEBUG: true */ +/* global document: true, window: true, DEBUG: true */ if (NODE) { require("./defines"); @@ -494,7 +494,7 @@ Component.bindExternalControl = function(component, sControl, sBinding, sType) } }; -if (window && !window.document.ELEMENT_NODE) window.document.ELEMENT_NODE = 1; +if (document && !document.ELEMENT_NODE) document.ELEMENT_NODE = 1; /** * Component.bindComponentControls(component, element, sAppClass) @@ -513,7 +513,7 @@ Component.bindComponentControls = function(component, element, sAppClass) for (var iNode = 0; iNode < aeChildNodes.length; iNode++) { var control = aeChildNodes[iNode]; - if (control.nodeType !== window.document.ELEMENT_NODE) { + if (control.nodeType !== document.ELEMENT_NODE) { continue; } var sClass = control.getAttribute("class"); diff --git a/modules/shared/lib/embed.js b/modules/shared/lib/embed.js index 0a4b6c866..03f5140d5 100644 --- a/modules/shared/lib/embed.js +++ b/modules/shared/lib/embed.js @@ -32,7 +32,7 @@ "use strict"; -/* global window: true, XSLTProcessor: false, APPNAME: false, APPVERSION: false, DEBUG: true */ +/* global document: true, window: true, XSLTProcessor: false, APPNAME: false, APPVERSION: false, DEBUG: true */ if (NODE) { var Component; @@ -189,11 +189,13 @@ function parseXML(sXML, sXMLFile, idMachine, sParms, fResolve, display, done) * 'ActiveXObject' crud has gone away; but of course, this code must remain in place if * we want to continue supporting older Internet Explorer browsers (ie, back to IE9). */ + /** @namespace window.ActiveXObject */ if (window.ActiveXObject || 'ActiveXObject' in window) { // second test is required for IE11 on Windows 8.1 xmlDoc = new window.ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async = false; xmlDoc['loadXML'](sXML); } else { + /** @namespace window.DOMParser */ xmlDoc = (new window.DOMParser()).parseFromString(sXML, "text/xml"); } } catch(e) { @@ -356,7 +358,7 @@ function embedMachine(sName, sVersion, idElement, sXMLFile, sXSLFile, sParms) }; try { - eMachine = window.document.getElementById(idElement); + eMachine = document.getElementById(idElement); if (eMachine) { var sAppClass = sName.toLowerCase(); // eg, "pcjs" or "c1pjs" if (!sXSLFile) { @@ -420,10 +422,10 @@ function embedMachine(sName, sVersion, idElement, sXMLFile, sXSLFile, sParms) displayError("transformNodeToObject failed"); } } - else if (window.document.implementation && window.document.implementation.createDocument) { + else if (document.implementation && document.implementation.createDocument) { var xsltProcessor = new XSLTProcessor(); xsltProcessor['importStylesheet'](xsl); - var eFragment = xsltProcessor['transformToFragment'](xml, window.document); + var eFragment = xsltProcessor['transformToFragment'](xml, document); if (eFragment) { /* * This fails in Microsoft Edge...