Merge branch 'master' into gh-pages, and fix a few issues related to autoStart

# Conflicts:
#	_posts/2016-12-02-the-pdp-11-and-vt100-revisited.md
#	docs/pcx86/examples/pcx86-dbg.js
#	docs/pcx86/examples/pcx86.js
This commit is contained in:
Jeff Parsons 2016-12-04 11:26:10 -08:00 committed by Jeff Parsons
commit 9ed580066c
33 changed files with 348 additions and 321 deletions

View file

@ -75,8 +75,8 @@ Here's a simple machine XML definition that's more useful:
[Example 1](examples/example1.html) shows the [XML](examples/example1.xml) in action.
Machine definitions can also include visual elements. For example, we can include a "Run" button with the CPU component.
Note that as soon as the machine is ready and the CPU starts running, the "Run" button will change to "Halt".
Machine definitions can also include visual elements. For example, we can include a **Run** button with the CPU component.
Note that as soon as the machine is ready and the CPU starts running, the **Run** button will change to **Halt**.
```xml
<machine id="ibm" class="pc" width="720px">
@ -174,7 +174,7 @@ All of the examples described above are available for [download](examples/).
If you have (or find) an IMG disk image file on a server, the PCjs web server provides a
[DiskDump API](/api/v1/dump) via endpoint "/api/v1/dump" that creates PCx86-compatible disks in JSON:
{{ site.url }}/api/v1/dump?disk=(file|url)&format=json
For example, let's say you found a disk image online, such as:

View file

@ -33,7 +33,7 @@ Attributes
* Provides an easy way to multiply the default CPU speed.
* *autoStart* (optional)
* This can be set to "true" or "false" to explicitly control whether or not the machine starts running automatically.
If this parameter is omitted, the machine will autostart only if no Debugger component is included and no "Run" button is defined.
If this parameter is omitted, the machine will autostart only if no Debugger component is included and no **Run** button is defined.
Also supports the attributes of *[Component](/docs/pcx86/component/)*. The *id* attribute is optional, since machines
currently support only one CPU component.

View file

@ -51,7 +51,7 @@ function ea(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),e=0<a.indexOf(",");e&&(
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function fa(a,b){var c,d="";b?32<b&&(b=32):b=32;for(var e=null==a||isNaN(a),f=c=c||b;0<b--;)f||(d=","+d,f=c),d=(e?"?":a&1?"1":"0")+d,a>>=1,f--;return d}function ha(a,b,c){var d="";if(!b||4<b)b=4;for(var e=0;e<b;e++)d&&(d=","+d),d=fa(a&255,8)+d,a>>=8;return(c?"0b":"")+d}
function ia(a,b,c){var d="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}function r(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}function u(a){return r(a,2,!0)}function v(a){return r(a,4,!0)}
function ja(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function ka(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function ma(a,b){return-1!==a.indexOf(b,a.length-b.length)}var na={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function oa(a){return a.replace(/[&<>"']/g,function(a){return na[a]})}
function pa(a,b,c){return c?(" "+a).slice(-b):(a+" ").slice(0,b)}function qa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var ra={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",11:"VT",12:"FF",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"};
function pa(a,b,c){return c?(" "+a).slice(-b):(a+" ").slice(0,b)}function qa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var ra={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",10:"LF",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"};
function sa(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a<b?-1:0});d<e;){var g=d+e>>1,h;h=c(b,a[g]);0<h?d=g+1:(e=g,f=!h)}return f?d:~d}var ta=Date.now||function(){return+new Date};function ua(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}var va=[31,28,31,30,31,30,31,31,30,31,30,31];
function wa(a,b){var c=0,d=1,e;for(e in a){if(d>=arguments.length)break;var f=a[e],g=arguments[d++],c=c&~f.vh|g<<f.shift&f.vh}return c}function xa(a,b){return(b&a.vh)>>a.shift}function ya(a,b){var c;if(Array.prototype.indexOf)return a.indexOf(b,c);c=c||0;0>c&&(c+=a.length);0>c&&(c=0);for(var d=a.length;c<d;c++)if(c in a&&a[c]===b)return c;return-1}
function Aa(a,b,c,d){var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(f=h.responseText,200==h.status||!h.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=h.status||-1),d&&d(a,f,e))});if(b&&"object"==
@ -605,8 +605,8 @@ l.hc=function(a,b){if(!b)if(this.zj(this.pa),!a||!this.restore)this.reset();else
function Eo(a,b){var c=0;b||(b=[0,0,384,0,1,0,0,96,a.Ja,[]]);a.ya=b[c++];a.Da=b[c++];a.fa=b[c++];a.ka=b[c++];a.U=b[c++];a.C=b[c++];a.ra=b[c++];a.B=b[c++];a.A=b[c++];a.aa=b[c];return!0}l.hg=function(a){if("number"==typeof a)this.aa.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.aa.push(a.charCodeAt(b));else this.aa=this.aa.concat(a);Fo(this);return!0};l.ll=function(a){var b=this.A;this.A&=~(zo|Ao);a&32&&(this.A=this.A|zo|1);a&64&&(this.A=this.A|Ao|2);b!=this.A&&Go(this)};
function Fo(a){0<a.aa.length&&!(a.B&1)&&(a.ya=a.aa.shift(),a.B|=1);Go(a)}l.Em=function(a,b){var c=this.C&128?this.fa&255:this.ya;x(this,a,null,b,this.C&128?"DLL":"RBR",c);this.B&=-2;Fo(this);return c};l.qm=function(a,b){var c=this.C&128?this.fa>>8:this.ka;x(this,a,null,b,this.C&128?"DLM":"IER",c);return c};l.rm=function(a,b){var c=this.U;x(this,a,null,b,"IIR",c);return c};l.sm=function(a,b){var c=this.C;x(this,a,null,b,"LCR",c);return c};l.um=function(a,b){var c=this.ra;x(this,a,null,b,"MCR",c);return c};
l.tm=function(a,b){var c=this.B;x(this,a,null,b,"LSR",c);return c};l.zm=function(a,b){var c=this.A;this.A&=-4;x(this,a,null,b,"MSR",c);return c};
l.ho=function(a,b,c){x(this,a,b,c,this.C&128?"DLL":"THR");if(this.C&128)this.fa=this.fa&-256|b;else{this.Da=b;this.B&=-97;a=!1;y(this,"transmitByte("+u(b)+")");this.ua&&this.ua.call(this.L,b)&&(a=!0);if(this.V)13==b?this.ea=0:8==b?(this.V.value=this.V.value.slice(0,-1),0<this.ea&&this.ea--):(a=(a=ra[b])?"<"+a+">":String.fromCharCode(b),c=a.length,32>b&&1==c&&(c=0),9==b&&(b=this.Ga||8,c=b-this.ea%b,this.Ga&&(a=pa("",c))),this.Ea&&!this.ea&&c&&(a=String.fromCharCode(this.Ea)+a),this.V.value+=a,this.V.scrollTop=
this.V.scrollHeight,this.ea+=c),a=!0;else if(null!=this.W){if(10==b||1024<=this.W.length)this.O(this.W),this.W="";10!=b&&(this.W+=String.fromCharCode(b));a=!0}a&&(this.B|=96)}};l.Tn=function(a,b,c){x(this,a,b,c,this.C&128?"DLM":"IER");this.C&128?this.fa=this.fa&255|b<<8:this.ka=b};l.Un=function(a,b,c){x(this,a,b,c,"LCR");this.C=b};
l.ho=function(a,b,c){x(this,a,b,c,this.C&128?"DLL":"THR");if(this.C&128)this.fa=this.fa&-256|b;else{this.Da=b;this.B&=-97;a=!1;y(this,"transmitByte("+u(b)+")");this.ua&&this.ua.call(this.L,b)&&(a=!0);if(this.V)13==b?this.ea=0:8==b?(this.V.value=this.V.value.slice(0,-1),0<this.ea&&this.ea--):(a=(a=13!=b&&10!=b?ra[b]:null)?"<"+a+">":String.fromCharCode(b),c=a.length,32>b&&1==c&&(c=0),9==b&&(b=this.Ga||8,c=b-this.ea%b,this.Ga&&(a=pa("",c))),this.Ea&&!this.ea&&c&&(a=String.fromCharCode(this.Ea)+a),this.V.value+=
a,this.V.scrollTop=this.V.scrollHeight,this.ea+=c),a=!0;else if(null!=this.W){if(10==b||1024<=this.W.length)this.O(this.W),this.W="";10!=b&&(this.W+=String.fromCharCode(b));a=!0}a&&(this.B|=96)}};l.Tn=function(a,b,c){x(this,a,b,c,this.C&128?"DLM":"IER");this.C&128?this.fa=this.fa&255|b<<8:this.ka=b};l.Un=function(a,b,c){x(this,a,b,c,"LCR");this.C=b};
l.Vn=function(a,b,c){var d=b^this.ra;x(this,a,b,c,"MCR");this.ra=b;d&3&&this.Cc&&(a=0,a=this.pa?a|(b&2?32:0)|(b&1?320:0):a|(b&2?16:0)|(b&1?1048576:0),this.Cc.call(this.L,a))};function Go(a){var b=-1;a.B&1&&a.ka&1?b=4:a.A&3&&a.ka&8&&(b=0);0<=b?(a.U&=-8,a.U|=b,a.N&&a.ia&&mg(a.N,a.ia,100)):(a.U|=1,a.N&&a.ia&&lg(a.N,a.ia))}
var Co={0:yo.prototype.Em,1:yo.prototype.qm,2:yo.prototype.rm,3:yo.prototype.sm,4:yo.prototype.um,5:yo.prototype.tm,6:yo.prototype.zm},Do={0:yo.prototype.ho,1:yo.prototype.Tn,3:yo.prototype.Un,4:yo.prototype.Vn};Xa(function(){for(var a=tb(document,"pcx86","serial"),b=0;b<a.length;b++){var c=a[b],d=qb(c),d=new yo(d);sb(d,c)}});function Ho(a){bb.call(this,"Mouse",a,Ho,16777216);if(this.ka=a.serial)this.pa="SerialPort";this.ia=this.fa=this.Ic=!1;this.C=[];this.B=[];xb(this)}jb(Ho);var wn=0;l=Ho.prototype;
l.Jc=function(a,b,c,d){this.X=a;this.ga=b;this.F=c;this.ha=d;for(b=null;b=Jb(a,"Video",b);)this.C.push(b)};l.hc=function(a,b){if(!b){if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;if(this.pa&&!this.N){for(a=null;(a=Jb(this.X,this.pa,a))&&(!a.bj||!(this.N=a.bj(this.ka,this,this.kl))););if(this.N)for(this.B=[],a=0;a<this.C.length;a++)b=this.C[a],b.V=this,(b=b.X)&&this.B.push(b);else w(this.id+": "+this.pa+" "+this.ka+" unavailable")}this.Ic?Io(this):Jo(this)}return!0};
@ -869,4 +869,4 @@ a):f("transformToFragment failed")):f("unable to transform XML: unsupported brow
function zs(a,b,c,d){if(!c&&b){d.push(b);a=lb[d[0]];b=null;for(var e in a)if(ma(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?Aa(b,null,!0,function(a,b){As(b,d)}):As(null,d)}else w("Error ("+c+") requesting "+a)}
function As(a,b){var c,d,e,f=b[0],g=b[1];c=b[4];c=c.match(/^(\s*\(function\(\)\{)([\s\S]*)(}\)\(\);\s*)$/);var h=lb[f],k={},m;for(m in h){var n=h[m],t=ka(m);if("xml"==t){for(t=/[ \t]*<disk [^>]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=t.exec(h[m]);){var q=d[2];q&&(h[q]||(n=n.replace(d[0],"")))}d=m=ja(m)}else"xsl"==t&&(e=m=ja(m));k[m]=n}a&&(k[m="css"]=a);b[2]&&(k[m="parms"]=b[2]);b[3]&&(k[m="state"]=b[3]);d&&e?(a=JSON.stringify(k),g+=".js",c=c[1]+"var resources="+a+";"+c[2]+c[3],c=c.replace(/\u00A9/g,
"&#xA9;"),a=Na(c,"javascript",!1,g),a=a+(', copy it to your web server as "'+g+'", and then add the following to your web page:\n\n')+('<div id="'+f+'"></div>\n')+"...\n",a=a+('<script type="text/javascript" src="'+g+'">\x3c/script>\n')+('<script type="text/javascript">embedPC("'+f+'","'+d+'","'+e+'");\x3c/script>\n\n')+"The machine should appear where the <div> is located.",w(a)):w("Missing XML/XSL resources")}
window.savePC=function(a,b,c){var d=pb("Computer",a),e=pb("Debugger",a);if(d){var f=Tr(d,!0),g=d.U?JSON.stringify(d.U):null;b||(b="/versions/pcjs/1.30.6/pc"+(e?"-dbg":"")+".js");if(c&&c({state:f,Ok:g}))return!0;Aa(b,null,!0,function(c,d,e){zs(c,d,e,[a,ja(b,!0),g,f])});return!0}w("Unable to identify machine '"+a+"'");return!1};})();
window.savePC=function(a,b,c){var d=pb("Computer",a),e=pb("Debugger",a);if(d){var f=Tr(d,!0),g=d.U?JSON.stringify(d.U):null;b||(b="/versions/pcx86/1.30.6/pcx86"+(e?"-dbg":"")+".js");if(c&&c({state:f,Ok:g}))return!0;Aa(b,null,!0,function(c,d,e){zs(c,d,e,[a,ja(b,!0),g,f])});return!0}w("Unable to identify machine '"+a+"'");return!1};})();

View file

@ -50,8 +50,8 @@ p[219]=n["{"];p[220]=n["|"];p[221]=n["}"];p[222]=n['"'];p[173]=n._;p[61]=n["+"];
function ea(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),e=0<a.indexOf(",");e&&(a=a.replace(/,/g,""));"#"==d?(b=8,d=null):"$"==d&&(b=16,d=null);null==d?a=a.substr(1):("0"==d&&(d=a.charAt(1),"b"==d&&e&&(b=2,d=null),"o"==d?(b=8,d=null):"x"==d&&(b=16,d=null)),null==d?a=a.substr(2):(d=a.charAt(a.length-1).toLowerCase(),"y"==d?(b=2,d=null):"."==d?(b=10,d=null):"h"==d&&(b=16,d=null),null==d&&(a=a.substr(0,a.length-1))));var f,d=a;((e=b)&&10!=e?16==e?d.match(/^[0-9a-f]+$/i):8==e?d.match(/^[0-7]+$/):2==e&&
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function fa(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}function ga(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}
function ha(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function ia(a,b){return-1!==a.indexOf(b,a.length-b.length)}var ja={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function ka(a){return a.replace(/[&<>"']/g,function(a){return ja[a]})}function la(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}
var ma={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",11:"VT",12:"FF",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"},na=Date.now||function(){return+new Date};function oa(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}
var pa=[31,28,31,30,31,30,31,31,30,31,30,31];function qa(a,b){var c=0,d=1,e;for(e in a){if(d>=arguments.length)break;var f=a[e],g=arguments[d++],c=c&~f.sg|g<<f.shift&f.sg}return c}function ra(a,b){return(b&a.sg)>>a.shift}
var ma={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",10:"LF",11:"VT",12:"FF",13:"CR",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"},na=Date.now||function(){return+new Date};
function oa(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}var pa=[31,28,31,30,31,30,31,31,30,31,30,31];function qa(a,b){var c=0,d=1,e;for(e in a){if(d>=arguments.length)break;var f=a[e],g=arguments[d++],c=c&~f.sg|g<<f.shift&f.sg}return c}function ra(a,b){return(b&a.sg)>>a.shift}
function sa(a,b,c,d){var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(f=h.responseText,200==h.status||!h.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=h.status||-1),d&&d(a,f,e))});if(b&&"object"==
typeof b){var k="",m;for(m in b)b.hasOwnProperty(m)&&(k&&(k+="&"),k+=m+"="+encodeURIComponent(b[m]));k=k.replace(/%20/g,"+");h.open("POST",a,!!c);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(k)}else h.open("GET",a,!!c),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();c||(f=h.responseText,200!=h.status&&(e=h.status||-1),d&&d(a,f,e),g=[f,e]);return g}function ta(){return"http://"+(window?window.location.host:"www.pcjs.org")}
function r(a){window&&window.alert(a)}function ua(a){var b=!1;window&&(b=window.confirm(a));return b}var va=null;function wa(){if(null==va){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}va=a}return va}function xa(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}
@ -565,8 +565,8 @@ l.wi=function(a){if(!this.D){var b=nc(this.ba,"connection");if(b){var c=b.split(
l.Ub=function(a,b){if(!b)if(this.wi(this.Z),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};l.Tb=function(a){return a?this.save():!0};l.reset=function(){Wl(this)};l.save=function(){var a=new de(this),b=0,c=[];c[b++]=this.ma;c[b++]=this.pa;c[b++]=this.P;c[b++]=this.Y;c[b++]=this.H;c[b++]=this.L;c[b++]=this.da;c[b++]=this.C;c[b++]=this.B;c[b]=this.K;a.set(0,c);return a.data()};l.restore=function(a){return Wl(this,a[0])};
function Wl(a,b){var c=0;b||(b=[0,0,384,0,1,0,0,96,a.sa,[]]);a.ma=b[c++];a.pa=b[c++];a.P=b[c++];a.Y=b[c++];a.H=b[c++];a.L=b[c++];a.da=b[c++];a.C=b[c++];a.B=b[c++];a.K=b[c];return!0}l.jf=function(a){if("number"==typeof a)this.K.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.K.push(a.charCodeAt(b));else this.K=this.K.concat(a);Xl(this);return!0};l.$j=function(a){var b=this.B;this.B&=~(Rl|Sl);a&32&&(this.B=this.B|Rl|1);a&64&&(this.B=this.B|Sl|2);b!=this.B&&Yl(this)};
function Xl(a){0<a.K.length&&!(a.C&1)&&(a.ma=a.K.shift(),a.C|=1);Yl(a)}l.pl=function(){var a=this.L&128?this.P&255:this.ma;this.C&=-2;Xl(this);return a};l.bl=function(){return this.L&128?this.P>>8:this.Y};l.cl=function(){return this.H};l.dl=function(){return this.L};l.fl=function(){return this.da};l.el=function(){return this.C};l.kl=function(){var a=this.B;this.B&=-4;return a};
l.Im=function(a,b){if(this.L&128)this.P=this.P&-256|b;else{this.pa=b;this.C&=-97;a=!1;this.ga&&this.ga.call(this.D,b)&&(a=!0);if(this.G){if(13==b)this.R=0;else if(8==b)this.G.value=this.G.value.slice(0,-1),0<this.R&&this.R--;else{a=(a=ma[b])?"<"+a+">":String.fromCharCode(b);var c=a.length;32>b&&1==c&&(c=0);9==b&&(b=this.ra||8,c=b-this.R%b,this.ra&&(a=" ".slice(0,c)));this.qa&&!this.R&&c&&(a=String.fromCharCode(this.qa)+a);this.G.value+=a;this.G.scrollTop=this.G.scrollHeight;
this.R+=c}a=!0}else if(null!=this.I){if(10==b||1024<=this.I.length)this.rc(this.I),this.I="";10!=b&&(this.I+=String.fromCharCode(b));a=!0}a&&(this.C|=96)}};l.vm=function(a,b){this.L&128?this.P=this.P&255|b<<8:this.Y=b};l.wm=function(a,b){this.L=b};l.xm=function(a,b){a=b^this.da;this.da=b;a&3&&this.Rc&&(a=0,a=this.Z?a|(b&2?32:0)|(b&1?320:0):a|(b&2?16:0)|(b&1?1048576:0),this.Rc.call(this.D,a))};
l.Im=function(a,b){if(this.L&128)this.P=this.P&-256|b;else{this.pa=b;this.C&=-97;a=!1;this.ga&&this.ga.call(this.D,b)&&(a=!0);if(this.G){if(13==b)this.R=0;else if(8==b)this.G.value=this.G.value.slice(0,-1),0<this.R&&this.R--;else{a=(a=13!=b&&10!=b?ma[b]:null)?"<"+a+">":String.fromCharCode(b);var c=a.length;32>b&&1==c&&(c=0);9==b&&(b=this.ra||8,c=b-this.R%b,this.ra&&(a=" ".slice(0,c)));this.qa&&!this.R&&c&&(a=String.fromCharCode(this.qa)+a);this.G.value+=a;this.G.scrollTop=
this.G.scrollHeight;this.R+=c}a=!0}else if(null!=this.I){if(10==b||1024<=this.I.length)this.rc(this.I),this.I="";10!=b&&(this.I+=String.fromCharCode(b));a=!0}a&&(this.C|=96)}};l.vm=function(a,b){this.L&128?this.P=this.P&255|b<<8:this.Y=b};l.wm=function(a,b){this.L=b};l.xm=function(a,b){a=b^this.da;this.da=b;a&3&&this.Rc&&(a=0,a=this.Z?a|(b&2?32:0)|(b&1?320:0):a|(b&2?16:0)|(b&1?1048576:0),this.Rc.call(this.D,a))};
function Yl(a){var b=-1;a.C&1&&a.Y&1?b=4:a.B&3&&a.Y&8&&(b=0);0<=b?(a.H&=-8,a.H|=b,a.S&&a.W&&Ue(a.S,a.W,100)):(a.H|=1,a.S&&a.W&&Te(a.S,a.W))}var Ul={0:Ql.prototype.pl,1:Ql.prototype.bl,2:Ql.prototype.cl,3:Ql.prototype.dl,4:Ql.prototype.fl,5:Ql.prototype.el,6:Ql.prototype.kl},Vl={0:Ql.prototype.Im,1:Ql.prototype.vm,3:Ql.prototype.wm,4:Ql.prototype.xm};Ga(function(){for(var a=bb(document,"pcx86","serial"),b=0;b<a.length;b++){var c=a[b],d=Za(c),d=new Ql(d);ab(d,c)}});
function Zl(a){Ka.call(this,"Mouse",a,Zl);if(this.Y=a.serial)this.Z="SerialPort";this.W=this.P=this.cc=!1;this.D=[];this.C=[];t(this)}Ta(Zl);var pl=0;l=Zl.prototype;l.pc=function(a,b,c,d){this.ba=a;this.ia=b;this.A=c;this.Ia=d;for(b=null;b=mb(a,"Video",b);)this.D.push(b)};
l.Ub=function(a,b){if(!b){if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;if(this.Z&&!this.G){for(a=null;(a=mb(this.ba,this.Z,a))&&(!a.fi||!(this.G=a.fi(this.Y,this,this.Zj))););if(this.G)for(this.C=[],a=0;a<this.D.length;a++)b=this.D[a],b.P=this,(b=b.G)&&this.C.push(b);else r(this.id+": "+this.Z+" "+this.Y+" unavailable")}this.cc?$l(this):am(this)}return!0};l.Tb=function(a){return a?this.save():!0};l.reset=function(){bm(this)};
@ -687,4 +687,4 @@ a):f("transformToFragment failed")):f("unable to transform XML: unsupported brow
function Mn(a,b,c,d){if(!c&&b){d.push(b);a=Ua[d[0]];b=null;for(var e in a)if(ia(e,"components.xsl")){b=e.replace(".xsl",".css");break}b?sa(b,null,!0,function(a,b){Nn(b,d)}):Nn(null,d)}else r("Error ("+c+") requesting "+a)}
function Nn(a,b){var c,d,e,f=b[0],g=b[1];c=b[4];c=c.match(/^(\s*\(function\(\)\{)([\s\S]*)(}\)\(\);\s*)$/);var h=Ua[f],k={},m;for(m in h){var q=h[m],y=ha(m);if("xml"==y){for(y=/[ \t]*<disk [^>]*path=(['"])(.*?)\1.*?<\/disk>\n?/g;d=y.exec(h[m]);){var w=d[2];w&&(h[w]||(q=q.replace(d[0],"")))}d=m=ga(m)}else"xsl"==y&&(e=m=ga(m));k[m]=q}a&&(k[m="css"]=a);b[2]&&(k[m="parms"]=b[2]);b[3]&&(k[m="state"]=b[3]);d&&e?(a=JSON.stringify(k),g+=".js",c=c[1]+"var resources="+a+";"+c[2]+c[3],c=c.replace(/\u00A9/g,
"&#xA9;"),a=Aa(c,"javascript",!1,g),a=a+(', copy it to your web server as "'+g+'", and then add the following to your web page:\n\n')+('<div id="'+f+'"></div>\n')+"...\n",a=a+('<script type="text/javascript" src="'+g+'">\x3c/script>\n')+('<script type="text/javascript">embedPC("'+f+'","'+d+'","'+e+'");\x3c/script>\n\n')+"The machine should appear where the <div> is located.",r(a)):r("Missing XML/XSL resources")}
window.savePC=function(a,b,c){var d=Ya("Computer",a),e=Ya("Debugger",a);if(d){var f=Cn(d,!0),g=d.L?JSON.stringify(d.L):null;b||(b="/versions/pcjs/1.30.6/pc"+(e?"-dbg":"")+".js");if(c&&c({state:f,Gj:g}))return!0;sa(b,null,!0,function(c,d,e){Mn(c,d,e,[a,ga(b,!0),g,f])});return!0}r("Unable to identify machine '"+a+"'");return!1};})();
window.savePC=function(a,b,c){var d=Ya("Computer",a),e=Ya("Debugger",a);if(d){var f=Cn(d,!0),g=d.L?JSON.stringify(d.L):null;b||(b="/versions/pcx86/1.30.6/pcx86"+(e?"-dbg":"")+".js");if(c&&c({state:f,Gj:g}))return!0;sa(b,null,!0,function(c,d,e){Mn(c,d,e,[a,ga(b,!0),g,f])});return!0}r("Unable to identify machine '"+a+"'");return!1};})();