Added support for converting numbers to/from octal, along with improved support for binary numbers

This commit is contained in:
Jeff Parsons 2016-09-15 18:23:09 -07:00
commit 1265104e6d
15 changed files with 888 additions and 789 deletions

View file

@ -1,10 +1,11 @@
(function(){var m,aa,ba={163840:[40,1,8],184320:[40,1,9],327680:[40,2,8],368640:[40,2,9],737280:[80,2,9],1228800:[80,2,15],1474560:[80,2,18],2949120:[80,2,36],21368320:[615,4,17]},p={to:1,cl:3,uo:26," ":32,"!":33,'"':34,"#":35,$:36,"%":37,"&":38,"'":39,"(":40,")":41,"*":42,"+":43,",":44,"-":45,".":46,"/":47,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,":":58,";":59,"<":60,"=":61,">":62,"?":63,"@":64,ue:65,Ai:66,Bi:67,Ci:68,E:69,Di:70,Ei:71,Fi:72,Gi:73,Hi:74,Ii:75,Ji:76,Ki:77,Li:78,Mi:79,Ni:80,Q:81,Oi:82,
Pi:83,Qi:84,Ri:85,Si:86,Ti:87,Ui:88,Vi:89,mg:90,"[":91,"\\":92,"]":93,"^":94,_:95,"`":96,ve:97,nl:98,pl:99,d:100,e:101,zl:102,Al:103,Bl:104,Cl:105,Sm:106,k:107,Tm:108,Xm:109,n:110,dn:111,p:112,q:113,r:114,ko:115,t:116,no:117,oo:118,po:119,x:120,y:121,z:122,"{":123,"|":124,"}":125,"~":126},ca={};ca[186]=p[";"];ca[187]=p["="];ca[188]=p[","];ca[189]=p["-"];ca[190]=p["."];ca[191]=p["/"];ca[192]=p["`"];ca[219]=p["["];ca[220]=p["\\"];ca[221]=p["]"];ca[222]=p["'"];ca[173]=p["-"];var da={};da[p["1"]]=p["!"];
da[p["2"]]=p["@"];da[p["3"]]=p["#"];da[p["4"]]=p.$;da[p["5"]]=p["%"];da[p["6"]]=p["^"];da[p["7"]]=p["&"];da[p["8"]]=p["*"];da[p["9"]]=p["("];da[p["0"]]=p[")"];da[186]=p[":"];da[187]=p["+"];da[188]=p["<"];da[189]=p._;da[190]=p[">"];da[191]=p["?"];da[192]=p["~"];da[219]=p["{"];da[220]=p["|"];da[221]=p["}"];da[222]=p['"'];da[173]=p._;da[61]=p["+"];da[59]=p[":"];
function ea(a,b){var c;if(a){b||(b=10);if("$"==a.charAt(0))b=16,a=a.substr(1);else if("0x"==a.substr(0,2))b=16,a=a.substr(2);else{var d=a.charAt(a.length-1).toLowerCase();"h"==d?(b=16,d=null):"."==d&&(b=10,d=null);null==d&&(a=a.substr(0,a.length-1))}var e,d=a,f=b;(f&&10!=f?16==f?null!==d.match(/^[0-9a-f]+$/i):2==f&&null!==d.match(/^[01]+$/i):null!==d.match(/^[0-9]+$/))&&!isNaN(e=parseInt(a,b))&&(c=e|0)}return c}
function fa(a,b){var c="";void 0===b?b=32:32<b&&(b=32);if(null==a||isNaN(a))for(;0<b--;)c="?"+c;else for(;0<b--;)c=(a&1?"1":"0")+c,a>>=1;return c}function ga(a,b){var c="";if(!b||4<b)b=4;for(var d=0;d<b;d++)c&&(c=","+c),c=fa(a&255,8)+"b"+c,a>>=8;return c}function t(a,b){var c="";void 0===b?b=8:8<b&&(b=8);if(null==a||isNaN(a))for(;0<b--;)c="?"+c;else for(;0<b--;){var d=a&15,d=d+(0<=d&&9>=d?48:55),c=String.fromCharCode(d)+c;a>>=4}return c}function u(a){return"0x"+t(a,2)}
function v(a){return"0x"+t(a,4)}function ha(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 la(a,b){return-1!==a.indexOf(b,a.length-b.length)}var ma={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function na(a){return a.replace(/[&<>"']/g,function(a){return ma[a]})}
function oa(a,b,c){return c?(" "+a).slice(-b):(a+" ").slice(0,b)}function pa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var qa={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",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 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?null!==d.match(/^[0-9a-f]+$/i):8==e?null!==d.match(/^[0-7]+$/):
2==e&&null!==d.match(/^[01]+$/):null!==d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function fa(a,b){var c="";b?32<b&&(b=32):b=32;if(null==a||isNaN(a))for(;0<b--;)c="?"+c;else for(;0<b--;)c=(a&1?"1":"0")+c,a>>=1;return c}function ga(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 t(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 t(a,2,!0)}function v(a){return t(a,4,!0)}function ha(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 la(a,b){return-1!==a.indexOf(b,a.length-b.length)}var ma={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function na(a){return a.replace(/[&<>"']/g,function(a){return ma[a]})}function oa(a,b,c){return c?(" "+a).slice(-b):(a+" ").slice(0,b)}
function pa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var qa={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",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 ra(a,b,c){var d=0,e=a.length,f=0;for(void 0===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 sa=Date.now||function(){return+new Date};function ta(){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 ua=[31,28,31,30,31,30,31,31,30,31,30,31];
function va(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.uh|g<<f.shift&f.uh}return c}function xa(a,b){return(b&a.uh)>>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 za(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"==
@ -40,7 +41,7 @@ log:536870912,warn:1073741824,halt:-2147483648};function Fb(a){Za.call(this,"Pan
Hb.prototype.contains=function(a,b){return a>=this.x&&a<this.x+this.ad&&b>=this.y&&b<this.y+this.A};function Ib(a,b,c,d){void 0===d&&(d=b>=c>>2);d?(b=new Hb(a.x,a.y,a.ad,a.A*b/c|0),a.y+=b.A,a.A-=b.A):(b=new Hb(a.x,a.y,a.ad*b/c|0,a.A),a.x+=b.ad,a.ad-=b.ad);return b}m=Fb.prototype;m.Pb=function(a,b,c,d){return this.X&&this.X.Pb(a,b,c,d)||this.F&&this.F.Pb(a,b,c,d)||this.B&&this.B.Pb(a,b,c,d)||this.ha&&this.ha.Pb(a,b,c,d)?!0:this.parent.Pb.call(this,a,b,c,d)};
m.Hc=function(a,b,c,d){this.X=a;this.ga=b;this.F=c;this.ha=d;this.B=Jb(a,"Keyboard")};m.gc=function(a,b){b||Kb();return!0};m.fc=function(){return!0};m.he=function(a,b){a.button||(this.ea=b?0:-1,Lb(this,a,b))};m.Jf=function(a){Lb(this,a)};
function Lb(a,b,c){var d=1280/null.offsetWidth,e=720/null.offsetHeight,f=null.getBoundingClientRect(),d=(b.clientX-f.left)*d|0;b=(b.clientY-f.top)*e|0;null==c&&(a.ea||(a.ea=Math.abs(a.L-d)>Math.abs(a.V-b)?1:2),1==a.ea?b=a.V:2==a.ea&&(d=a.L));a.L=d;a.V=b;if(0<=d&&1280>d&&0<=b&&720>b){a:{c=d;if(960>c&&a.A&&a.A.Qe)for(f=0;f<a.A.Qe.length;f++)if(e=a.A.Qe[f],e.contains(c,b)){c-=e.x;b-=e.y;var d=a.A.Bf[f],g=xa(Mb.Gk,a.A.Xg[d.Dl]),f=g*a.ga.Sb,d=(g+d.Td)*a.ga.Sb-1;0<b&&(f+=e.ad*(b-1)*a.ya);f+=c*a.ya;f|=0;
f>d&&(f=d);c=f;break a}c=-1}if(-1!==c&&(c&=-16,c!=a.Ca)){b=c;if(a.context&&a.ia&&a.ka){e=a.ia.width;a.ka.fillStyle="black";a.ka.fillRect(0,360,e,360);Nb(a,378,a.ia,a.ka);a.pa=a.Da.width/24|0;if(null==b)Ob(a,"Mouse over memory to dump");else for(Ob(a,"0x"+t(b),null,0,1),f=1;16>=f;f++){d="";for(g=1;8>=g;g++){var h;h=a.ga;var k=b++;h=h.sa[(k&h.Gb)>>>h.La].re(k&h.A,k);Ob(a,t(h,2),null,1);d+=32<=h&&128>h?String.fromCharCode(h):"."}Ob(a,d,null,0,1)}a.context.drawImage(a.ia,0,360,e,360,a.rb,a.Db,a.Pa,a.cb)}a.Ca=
f>d&&(f=d);c=f;break a}c=-1}if(-1!==c&&(c&=-16,c!=a.Ca)){b=c;if(a.context&&a.ia&&a.ka){e=a.ia.width;a.ka.fillStyle="black";a.ka.fillRect(0,360,e,360);Nb(a,378,a.ia,a.ka);a.pa=a.Da.width/24|0;if(null==b)Ob(a,"Mouse over memory to dump");else for(Ob(a,t(b,8,!0),null,0,1),f=1;16>=f;f++){d="";for(g=1;8>=g;g++){var h;h=a.ga;var k=b++;h=h.sa[(k&h.Gb)>>>h.La].re(k&h.A,k);Ob(a,t(h,2),null,1);d+=32<=h&&128>h?String.fromCharCode(h):"."}Ob(a,d,null,0,1)}a.context.drawImage(a.ia,0,360,e,360,a.rb,a.Db,a.Pa,a.cb)}a.Ca=
c}}}m.pd=function(){};function Pb(a,b,c,d){a.A.Bf[a.A.ej++]={Dl:b,Td:c,type:d};return va(Mb,b,c,0,d)}function Nb(a,b,c,d){var e,f=null.style.color,g=a.Oa=10;a.C=g;a.U=b;a.W=a.va=18;e||(e=a.ua||a.va+"px Monaco, Lucida Console, Courier New");a.fa=a.ua=e;c&&(a.Da=c);d&&(a.N=d,a.Fa=f||"white")}
function Ob(a,b,c,d,e){a.N.font=a.fa;a.N.fillStyle=a.Fa;a.N.fillText(b,a.C,a.U);a.C+=a.pa;null!=c&&(16!=a.Tb?b=c.toString():(b=8>a.Ka?"0x":"",b+=t(c,a.Ka)),a.N.fillText(b,a.C,a.U),a.C+=a.pa);d&&(a.C+=a.pa*d);e&&(a.C=a.Oa,a.U+=(a.W+2)*(e||1))}function Kb(){for(var a=!1,b=rb(document,"pcx86","panel"),c=0;c<b.length;c++){var d=b[c],e=ob(d),f=mb(e.id);f||(a=!0,f=new Fb(e));qb(f,d);a&&wb(f)}}Ua(Kb);
function Qb(a,b,c){Za.call(this,"Bus",a,Qb);this.F=b;this.ha=c;this.N=a.busWidth||20;this.W=Math.pow(2,this.N);this.Cg=this.Gb=this.W-1|0;this.La=32==this.N||20>=this.N?12:24>=this.N?14:15;this.Sb=1<<this.La;this.fa=this.Sb>>2;this.A=this.Sb-1;this.U=this.W/this.Sb|0;this.ga=this.U-1;this.B=[];this.C=[];this.L=this.V=!1;this.aa=[];this.ea=[];a=new C;Rb(a,this.ha);this.sa=Array(this.U);for(b=0;b<this.U;b++)this.sa[b]=a;a=this.F;b=this.sa;c=this.La;a.kd=a.sa=b;a.La=c;a.Sb=1<<a.La;a.Fa=a.Sb-1;a.Fd=b.length;
@ -293,7 +294,7 @@ function Rj(){var a=this.T();uf(this)?this.A-=this.B.bb:(Q(this,M(this)+a),this.
function Vj(){var a=this.T();wf(this)||!xf(this)!=!yf(this)?this.A-=this.B.bb:(Q(this,M(this)+a),this.A-=this.B.ab)}function Wj(){this.Jb.call(this,Xj,this.xa);this.A-=-1===this.C?1:this.B.Ig}function Yj(){this.S|=1;this.$a.call(this,fi)}function Zj(){this.S|=1;this.ea.call(this,fi)}function ak(){this.Oa.call(this,fi)}function bk(){this.V.call(this,fi)}function Vd(){this.Jb.call(this,ck,xj)}function Zd(){this.ya.call(this,2==this.ba?dk:ek,xj)}
function fk(){var a=Vf(this),b=G(this);Q(this,b);a&&I(this,J(this)+a);this.A-=this.B.Dk}function gk(){var a=G(this);Q(this,a);this.A-=this.B.Ak}function $d(){this.U=this.fa;var a=Vf(this),b=this.xa()&31;this.A-=11;K(this,this.P);var c=J(this)&this.R;if(0<b){for(this.A-=(b<<2)+(1<b?1:0);--b;)this.P=this.P&~this.R|this.P-this.ba&this.R,K(this,wd(this,this.ta,this.P&this.R));K(this,c)}this.P=this.P&~this.R|c;I(this,J(this)&~this.ta.Ba|J(this)-a&this.ta.Ba);this.U=-1}
function ae(){this.U=this.fa;I(this,J(this)&~this.ta.Ba|this.P&this.ta.Ba);this.P=this.P&~this.R|G(this)&this.R;this.A-=5;this.U=-1}function hk(){Cj.call(this,Vf(this));this.A-=this.B.Ck}function ik(){Cj.call(this,0);this.A-=this.B.Bk}function jk(a){this.lg=a;this.V.call(this,Ph)}function kk(){this.S|=36;this.A-=this.B.nd}function ge(){ke.call(this)}function Jd(){D.call(this,6)}
function ke(){Q(this,this.qe-this.wa.Aa);yb(this,"Undefined opcode "+u(this.Qa(this.Ha))+" at "+("0x"+t(this.Ha)));this.Wb()}
function ke(){Q(this,this.qe-this.wa.Aa);yb(this,"Undefined opcode "+u(this.Qa(this.Ha))+" at "+t(this.Ha,8,!0));this.Wb()}
var Fd=[function(){this.$a.call(this,xh)},function(){this.ea.call(this,yh)},function(){this.Oa.call(this,xh)},function(){this.V.call(this,yh)},function(){this.G=this.G&-256|xh.call(this,this.G&255,this.xa());this.A--},function(){this.G=this.G&~this.R|yh.call(this,this.G&this.R,this.Ma());this.A--},function(){xd(this,this.Xa.Z,this.ba,2);this.A-=this.B.Ie},function(){this.U=this.fa;zd(this,G(this));this.A-=this.B.zc;this.U=-1},function(){this.$a.call(this,Bi)},function(){this.ea.call(this,Ci)},function(){this.Oa.call(this,
Bi)},function(){this.V.call(this,Ci)},function(){this.G=this.G&-256|Bi.call(this,this.G&255,this.xa());this.A--},function(){this.G=this.G&~this.R|Ci.call(this,this.G&this.R,this.Ma());this.A--},function(){xd(this,this.wa.Z,this.ba,2);this.A-=this.B.Ie},function(){of(this,G(this));this.A-=this.B.zc},function(){this.$a.call(this,vh)},function(){this.ea.call(this,wh)},function(){this.Oa.call(this,vh)},function(){this.V.call(this,wh)},function(){this.G=this.G&-256|vh.call(this,this.G&255,this.xa());this.A--},
function(){this.G=this.G&~this.R|wh.call(this,this.G&this.R,this.Ma());this.A--},function(){xd(this,this.ta.Z,this.ba,2);this.A-=this.B.Ie},function(){this.U=this.fa;nd(this,G(this));this.A-=this.B.zc;this.U=-1},function(){this.$a.call(this,Di)},function(){this.ea.call(this,Ei)},function(){this.Oa.call(this,Di)},function(){this.V.call(this,Ei)},function(){this.G=this.G&-256|Di.call(this,this.G&255,this.xa());this.A--},function(){this.G=this.G&~this.R|Ei.call(this,this.G&this.R,this.Ma());this.A--},
@ -434,8 +435,8 @@ function cm(a){Za.call(this,"ROM",a,cm);this.A=null;this.X=a.addr;this.C=a.size;
cm.prototype.gc=function(){this.Qd&&(this.ha&&fm(this.ha,this.id,0,this.X>>>4,0,this.X,this.C,this.Qd),delete this.Qd);return!0};cm.prototype.fc=function(){return!0};
function dm(a,b,c,d){if(d)a.Na("Unable to load system ROM (error "+d+": "+b+")");else{jb(a.ce,b,c);if("["==c.charAt(0)||"{"==c.charAt(0))try{var e=eval("("+c+")"),f=e.bytes,g=e.data;if(f)a.A=f;else if(g)for(a.A=Array(4*g.length),d=c=0;c<g.length;c++)a.A[d++]=g[c]&255,a.A[d++]=g[c]>>8&255,a.A[d++]=g[c]>>16&255,a.A[d++]=g[c]>>24&255;else a.A=e;a.Qd=e.symbols;if(!a.A.length){x("Empty ROM: "+b);return}if(1==a.A.length){x(a.A[0]);return}}catch(h){a.Na("ROM data error: "+h.message);return}else for(b=c.replace(/\n/gm,
" ").replace(/ +$/,"").split(" "),a.A=Array(b.length),e=0;e<b.length;e++)a.A[e]=ea(b[e],16);em(a)}}
function em(a){if(!xb(a))if(!a.L)wb(a);else if(a.A&&a.ga){a.C||(a.C=a.A.length);if(a.A.length!=a.C)yb(a,"ROM size (0x"+t(a.A.length)+") does not match specified size ("+("0x"+t(a.C))+")");else{var b;b=a.X;if(Yb(a.ga,b,a.C,fc)){for(var c=0;c<a.A.length;c++){var d=a.ga,e=b+c;d.sa[(e&d.Gb)>>>d.La].xf(e&d.A,a.A[c]&255,e)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.N?b.push(a.N):null!=a.N&&a.N.length&&(b=a.N);for(c=0;c<b.length;c++){var d=a,e=b[c],f=cc(d.ga,d.X,d.C);bc(d.ga,e,d.C,f)}a.B&&((b=mb(a.B,a.id))?
(c=a.A,d=a.V,5==b.Ua?gm(b,c,d||[12640,8752],8):b.Ua==hm&&gm(b,c,d||[14221,16269],8),wb(b)):a.Na("Unable to find component: "+a.B));delete a.A}}wb(a)}}Ua(function(){for(var a=rb(document,"pcx86","rom"),b=0;b<a.length;b++){var c=a[b],d=ob(c),d=new cm(d);qb(d,c)}});function im(a){Za.call(this,"RAM",a,im);this.B=a.addr;this.A=a.size;this.L=a.test;this.X=!!this.A;this.C=!1}hb(im);m=im.prototype;m.Hc=function(a,b,c,d){this.ga=b;this.F=c;this.ha=d;this.N=Jb(a,"ChipSet");wb(this)};
function em(a){if(!xb(a))if(!a.L)wb(a);else if(a.A&&a.ga){a.C||(a.C=a.A.length);if(a.A.length!=a.C)yb(a,"ROM size ("+t(a.A.length,8,!0)+") does not match specified size ("+t(a.C,8,!0)+")");else{var b;b=a.X;if(Yb(a.ga,b,a.C,fc)){for(var c=0;c<a.A.length;c++){var d=a.ga,e=b+c;d.sa[(e&d.Gb)>>>d.La].xf(e&d.A,a.A[c]&255,e)}b=!0}else b=!1;if(b){b=[];"number"==typeof a.N?b.push(a.N):null!=a.N&&a.N.length&&(b=a.N);for(c=0;c<b.length;c++){var d=a,e=b[c],f=cc(d.ga,d.X,d.C);bc(d.ga,e,d.C,f)}a.B&&((b=mb(a.B,
a.id))?(c=a.A,d=a.V,5==b.Ua?gm(b,c,d||[12640,8752],8):b.Ua==hm&&gm(b,c,d||[14221,16269],8),wb(b)):a.Na("Unable to find component: "+a.B));delete a.A}}wb(a)}}Ua(function(){for(var a=rb(document,"pcx86","rom"),b=0;b<a.length;b++){var c=a[b],d=ob(c),d=new cm(d);qb(d,c)}});function im(a){Za.call(this,"RAM",a,im);this.B=a.addr;this.A=a.size;this.L=a.test;this.X=!!this.A;this.C=!1}hb(im);m=im.prototype;m.Hc=function(a,b,c,d){this.ga=b;this.F=c;this.ha=d;this.N=Jb(a,"ChipSet");wb(this)};
m.gc=function(a,b){return!b&&(this.reset(),a&&this.controller&&!this.restore(a))?!1:!0};m.fc=function(a){return a&&this.controller?this.save():!0};
m.reset=function(){if(!this.B&&!this.X&&this.N){var a=1024*Xk(this.N);this.A&&a!=this.A&&(ec(this.ga,this.B,this.A),this.C=!1);this.A=a}!this.C&&this.A&&Yb(this.ga,this.B,this.A,1)&&(this.C=!0,"ramCPQ"==this.xd&&(this.controller=new jm(this),Yb(this.ga,km,4,4,this.controller)));if(this.C){if(this.L||lc(this.ga,1138,4660),"ramCPQ"!=this.xd&&this.N&&(a=this.N,a.A)){var b=1048576>this.B?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;al(a)}}else x("No RAM allocated")};
m.save=function(){var a=new mf(this);this.controller&&O(a,0,this.controller.save());return a.data()};m.restore=function(a){return this.controller?this.controller.restore(a[0]):!0};function jm(a){this.N=a;this.C=lm;this.ha=mm;this.B=nm;this.A=null}var km=-2134900736,lm=65535,mm=2575,nm=2,om=[null,0],pm=[function(a){return this.controller.Qa(a)},null,null,function(a,b){this.controller.qc(a,b)},null,null];m=jm.prototype;m.save=function(){return[this.C,this.B]};
@ -568,7 +569,7 @@ m.he=function(a,b){if(this.Gc&&this.F&&this.F.la.Ib){var c="mouse button"+a+" "+
function Io(a,b,c,d){var e=64|(a.aa?32:0)|(a.ea?16:0)|(a.W&192)>>4|(a.U&192)>>6,f=a.U&63,g=a.W&63;B(a,8388608)&&z(a,(b?b+": ":"")+(void 0!==d?"mouse ("+c+","+d+"): ":"")+"serial packet ["+u(e)+","+u(f)+","+u(g)+"]",0,!0);a.N.fg([e,f,g]);a.U=a.W=0}Ua(function(){for(var a=rb(document,"pcx86","mouse"),b=0;b<a.length;b++){var c=a[b],d=ob(c),d=new Eo(d);qb(d,c)}});
function Jo(a,b,c){Za.call(this,"Disk",{id:a.ce+".disk"+t(++Ko,4)},Jo,2097152);this.controller=a;this.X=a.X;this.ha=a.ha;this.B=b;this.ga=b.name;this.df=b.df;this.wg=this.N=!1;Lo(this,c,b.Bb,b.ub,b.lb,b.Va);this.U=[];this.ea=[];this.L=null;this.ia=0;this.fa=!1;wb(this)}var Ko=0;hb(Jo);function Mo(a,b,c,d,e,f){this.za=a;this.jc=c;this.bh=d;this.fj=e;this.xe=f}var No=[0,2],Oo=[24,2],Po=[60,4],Qo=[0,2],Ro=[4,2],So=[6,2],To=[28,2],Uo=[32,2],Vo=[34,2],Wo=[38,2],Xo=[44,4],Yo=[50,2];
function Zo(a,b,c){var d;c=c||2;var e=b&511,f=$o(a.za,a.xe[b>>9]);if(f){if(e+c<=f.length)return ap(a.za,f,e,c);for(e=d=0;c--;)d|=Zo(a,b++,1)<<e,e+=8}return d}function bp(a,b,c){return Zo(a,b[0]+(c||0),b[1])}function cp(a,b,c){for(var d=0;!c||b<c;){var e=Zo(a,b,1);if(!e)break;var f;f=a;var g=b+1,h=e,k="";for(h||(h=-1);h--;){var l=Zo(f,g++,1);if(!l)break;k+=String.fromCharCode(l)}f=k;if(!f)break;b+=1+e;if(d){if(e=Zo(a,b),g=a.A[e])g=g[0],a.yd[g]&&a.yd[g].we[e].push(f)}else c||(a.ig=f);b+=2;d++}}
Mo.prototype.wj=function(a,b){var c=null;if(this.yd)for(var d in this.yd){var e=this.yd[d];if(a>=e.ni&&a<=e.Hk){d=a-=e.ni;var f,g;for(g in e.we){var h=e.we[g],k=a-h[0];if(!k){c=this.ig+"!"+h[1];break}b&&0<k&&k<d&&(f=h,d=k)}!c&&f&&(c=this.ig+"!"+f[1]+"+"+v(d));break}}return c||this.jc+"+"+("0x"+t(a))};m=Jo.prototype;m.Hc=function(a,b,c,d){this.ha=d};m.gc=function(a,b){b||!this.wg||this.N||(wb(this,!1),this.load(this.ga,this.V,null,this.yl,this));return!0};m.yl=function(){wb(this,!0)};
Mo.prototype.wj=function(a,b){var c=null;if(this.yd)for(var d in this.yd){var e=this.yd[d];if(a>=e.ni&&a<=e.Hk){d=a-=e.ni;var f,g;for(g in e.we){var h=e.we[g],k=a-h[0];if(!k){c=this.ig+"!"+h[1];break}b&&0<k&&k<d&&(f=h,d=k)}!c&&f&&(c=this.ig+"!"+f[1]+"+"+v(d));break}}return c||this.jc+"+"+t(a,8,!0)};m=Jo.prototype;m.Hc=function(a,b,c,d){this.ha=d};m.gc=function(a,b){b||!this.wg||this.N||(wb(this,!1),this.load(this.ga,this.V,null,this.yl,this));return!0};m.yl=function(){wb(this,!0)};
m.fc=function(a,b){if(this.N){var c,d=0;if(this.fa&&!Ea("Disk writes are still in progress, shut down anyway?"))return!1;for(;c=dp(this,!1);)if(d=c[0]){this.controller.Na('Unable to save "'+this.ga+'" (error '+d+")");break}b&&this.N&&(c="action=close&volume="+this.V,c+="&machine="+this.controller.hf(),c+="&user="+this.controller.ie(),za(Aa()+"/api/v1/disk?"+c,null,!0),this.N=!1);!d&&a&&this.controller.Na(this.ga+" saved")}return!0};
function Lo(a,b,c,d,e,f){a.mode=b;a.Bb=c;a.ub=d;a.lb=e;a.Va=f;a.A=[];if("preload"!=a.mode){b=Array(a.Bb);for(c=0;c<b.length;c++){d=Array(a.ub);for(e=0;e<d.length;e++){f=Array(a.lb);for(var g=1;g<=f.length;g++)f[g-1]=ep(null,c,e,g,a.Va,"local"==a.mode?0:null);d[e]=f}b[c]=d}a.A=b}a.aa=null}
m.load=function(a,b,c,d,e){var f=b;if(this.W)return!0;this.ga=a;this.V=b;this.Tg=ha(b);var g=this;this.W=d;this.ka=e||this.controller;if(c){var h=new FileReader;h.onload=function(){var a=h.result,b,c=a?a.byteLength:0,d=ba[c];if(d){g.Bb=d[0];g.ub=d[1];g.lb=d[2];g.Va=512;b=g.Va>>2;var e=d=0,a=new DataView(a,0,c);g.A=Array(g.Bb);for(c=0;c<g.A.length;c++)for(var f=g.A[c]=Array(g.ub),F=0;F<f.length;F++)for(var w=f[F]=Array(g.lb),E=0;E<w.length;E++){for(var H=ep(null,c,F,E+1,g.Va,0),L=H.data,W=0;W<b;W++,
@ -656,14 +657,14 @@ function gq(a,b,c){b.errorCode=4;b.Se&&b.Se.length==b.Hb||(b.Se=Array(b.Hb));b.e
m.Je=function(a,b,c){var d=-1,e=null,f=0;if(a.errorCode)return b&&b(d,!1,e,f),d;var g=!1!==c?1:0;if(a.pb&&(f=a.eb,d=a.za.read(a.pb,a.eb),a.eb+=g,0<=d))return e=a.pb,b&&b(d,!1,e,f),d;if(b){if(a.za)return a.za.seek(a.be,a.kb,a.xb+a.qg,!1,function(c,k){(a.pb=c)?(e=c,f=a.eb=0,hq(a),d=a.za.read(a.pb,a.eb),a.eb+=g):a.errorCode=20;b(d,k,e,f)}),d;a.errorCode=20;b(d,!1,e,f)}return d};
function $p(a,b){if(a.errorCode)return-1;do{if(a.pb&&a.za.write(a.pb,a.eb++,b))break;a.za&&a.za.seek(a.be,a.kb,a.xb+a.qg,!0,function(b){a.pb=b});if(!a.pb){a.errorCode=20;b=-1;break}a.eb=0;hq(a)}while(1);return b}function hq(a){a.xb++;var b=1-a.qg;a.xb>=a.lb+b&&(a.xb=b,a.kb++,a.kb>=a.ub&&(a.kb=0,a.be++))}m.Mm=function(){var a=this.F.M&255;!(this.F.G>>8)&&128<a&&(this.ka=a-128);return!0};m.Nm=function(){var a;(a=this.F.G>>8||!this.N)||(a=!(this.N.vc[0].Ad&64));return a?!0:!1};
var Qp={800:Mp.prototype.Km,801:Mp.prototype.Lm,802:Mp.prototype.Jm},Pp={496:Mp.prototype.hl,497:Mp.prototype.Rl,498:Mp.prototype.Tl,499:Mp.prototype.Ul,500:Mp.prototype.Pl,501:Mp.prototype.Ol,502:Mp.prototype.Ql,503:Mp.prototype.Vl},Sp={800:Mp.prototype.fo,801:Mp.prototype.jo,802:Mp.prototype.io,803:Mp.prototype.ho,807:Mp.prototype.oi,811:Mp.prototype.oi,815:Mp.prototype.oi},Rp={496:Mp.prototype.pn,497:Mp.prototype.un,498:Mp.prototype.sn,499:Mp.prototype.tn,500:Mp.prototype.on,501:Mp.prototype.nn,
502:Mp.prototype.qn,503:Mp.prototype.mn,1014:Mp.prototype.rn};Ua(function(){for(var a=rb(document,"pcx86","hdc"),b=0;b<a.length;b++){var c=a[b],d=ob(c),d=new Mp(d);qb(d,c)}});function iq(a){Za.call(this,"Debugger",a,iq);this.pa=this.Ca=this.ea=0;this.va=!1;this.A=-1;this.C=[];this.ya={}}hb(iq);var jq={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};
502:Mp.prototype.qn,503:Mp.prototype.mn,1014:Mp.prototype.rn};Ua(function(){for(var a=rb(document,"pcx86","hdc"),b=0;b<a.length;b++){var c=a[b],d=ob(c),d=new Mp(d);qb(d,c)}});function iq(a){Za.call(this,"Debugger",a,iq);this.pa=this.Ca=this.ea=0;this.va=!1;this.A=-1;this.C=[];this.ya={}}hb(iq);var jq={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};iq.prototype.nh=function(){return-1};iq.prototype.oh=function(){};
iq.prototype.Ok=function(a,b){return a.replace("["+b+"]","unimplemented")};iq.prototype.Mg=function(a,b,c){if(b)if(a){0>this.A&&this.C.length&&(this.A=0);if(0>this.A||a!=this.C[this.A])this.C.splice(0,0,a),this.A=0;this.A--}else this.va?a="end":a=this.C[this.A+1];b=[];if(a){a=a.toLowerCase().replace(/""/g,"'");var d=0,e=null;c=c||";";for(var f=0;f<=a.length;f++){var g=a.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==c&&!e||!g)b.push(pa(a.substring(d,f))),d=f+1}}return b};
function kq(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<<e;break;case ">>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f<e?1:0;break;case "<=":d=f<=e?1:0;break;case ">":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break;
case "^":d=f^e;break;case "|":d=f|e;break;case "&&":d=f&&e?1:0;break;case "||":d=f||e?1:0;break;default:return!1}a.push(d|0)}return!0}iq.prototype.nh=function(){return-1};iq.prototype.oh=function(){};
iq.prototype.Mg=function(a,b,c){if(b)if(a){0>this.A&&this.C.length&&(this.A=0);if(0>this.A||a!=this.C[this.A])this.C.splice(0,0,a),this.A=0;this.A--}else this.va?a="end":a=this.C[this.A+1];b=[];if(a){a=a.toLowerCase().replace(/""/g,"'");var d=0,e=null;c=c||";";for(var f=0;f<=a.length;f++){var g=a.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==c&&!e||!g)b.push(pa(a.substring(d,f))),d=f+1}}return b};
case "^":d=f^e;break;case "|":d=f|e;break;case "&&":d=f&&e?1:0;break;case "||":d=f||e?1:0;break;default:return!1}a.push(d|0)}return!0}
function lq(a,b,c){var d;if(b){b=mq(a,b);for(var e=0,f=!1,g=b,h=[],k=[],l=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<l.length;){var n=l[e++],r=n.length,n=pa(n);if(!n){f=!0;break}n=nq(a,n,null,!1===c);if(void 0===n){f=!0;c=!1;break}h.push(n);if(e==l.length)break;var n=l[e++],q=n.length;k.length&&jq[n]<jq[k[k.length-1]]&&kq(h,k,1);k.push(n);b=b.substr(r+q)}kq(h,k)&&1==h.length||(f=!0);f?c&&a.O("error parsing '"+g+"' at character "+(g.length-b.length)):(d=h.pop(),c&&oq(a,null,
d))}return d}iq.prototype.Ok=function(a,b){return a.replace("["+b+"]","unimplemented")};function mq(a,b){for(var c;(c=b.match(/\{(.*?)}/))&&!(0<=c[1].indexOf("{"));){var d=lq(a,c[1]);b=b.replace("{"+c[1]+"}",null!=d?t(d):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=a.Ok(b,c[1]);for(c=b;d=c.match(/\$([a-z]+)/i);){var e=null;switch(d[1].toLowerCase()){case "ops":e=a.pa-a.Ca}if(null==e)break;c=c.replace(d[0],e.toString())}return c}
function nq(a,b,c,d){var e;null!=b?(e=a.nh(b),0<=e?e=a.oh(e):(e=a.ya[b],null==e&&(e=ea(b,16))),null!=e||d||a.O("invalid "+(c?c:"value")+": "+b)):d||a.O("missing "+(c||"value"));return e}function oq(a,b,c){var d,e=!1;void 0!==c&&(e=!0,d="0x"+t(c)+" "+c+". ("+ga(c)+")");a.O((null!=b?b+": ":"")+d);return e}function pq(a,b){if(b)return oq(a,b,a.ya[b]);var c=0;for(b in a.ya)oq(a,b,a.ya[b]),c++;return 0<c}
function qq(a){iq.call(this,a);this.Ja=4;this.Da=5;this.Ba=1048575;this.aa=rq(this);this.sb=rq(this);this.ua=rq(this);this.N=[];this.B=this.ra=this.fa=[];sq(this);this.Oa=0;tq(this);this.$a={};uq(this,a.messages);this.gb=a.commands;var b=this;window?void 0===window.pcx86&&(window.pcx86=function(a){return vq(b,a)}):void 0===global.pcx86&&(global.pcx86=function(a){return vq(b,a)})}hb(qq,iq);
d))}return d}function mq(a,b){for(var c;(c=b.match(/\{(.*?)}/))&&!(0<=c[1].indexOf("{"));){var d=lq(a,c[1]);b=b.replace("{"+c[1]+"}",null!=d?t(d):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=a.Ok(b,c[1]);for(c=b;d=c.match(/\$([a-z]+)/i);){var e=null;switch(d[1].toLowerCase()){case "ops":e=a.pa-a.Ca}if(null==e)break;c=c.replace(d[0],e.toString())}return c}
function nq(a,b,c,d){var e;null!=b?(e=a.nh(b),0<=e?e=a.oh(e):(e=a.ya[b],null==e&&(e=ea(b,16))),null!=e||d||a.O("invalid "+(c?c:"value")+": "+b)):d||a.O("missing "+(c||"value"));return e}function oq(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=0,g="";f?11<f&&(f=11):f=d&-65536?11:6;if(null==d||isNaN(d))for(;0<f--;)g="?"+g;else for(;0<f--;)g=String.fromCharCode((d&7)+48)+g,d>>=3;d=t(c,0,!0)+" "+c+". "+("0o"+g)+" "+ga(c,0,!0)}a.O((null!=b?b+": ":"")+d);return e}
function pq(a,b){if(b)return oq(a,b,a.ya[b]);var c=0;for(b in a.ya)oq(a,b,a.ya[b]),c++;return 0<c}function qq(a){iq.call(this,a);this.Ja=4;this.Da=5;this.Ba=1048575;this.aa=rq(this);this.sb=rq(this);this.ua=rq(this);this.N=[];this.B=this.ra=this.fa=[];sq(this);this.Oa=0;tq(this);this.$a={};uq(this,a.messages);this.gb=a.commands;var b=this;window?void 0===window.pcx86&&(window.pcx86=function(a){return vq(b,a)}):void 0===global.pcx86&&(global.pcx86=function(a){return vq(b,a)})}hb(qq,iq);
var wq={16:262144,19:524288,21:32768,22:65536,28:2048,33:134217728,51:16777216},xq=[26,28,40,42,109],yq={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory",f:"frequencies","g [#]":"go [to #]",h:"halt","i [#]":"input port #","if":"eval expression",k:"stack trace",l:"load sector(s)",ln:"list nearest symbol(s)",m:"messages",mouse:"mouse action","o [#]":"output port #",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",
"t [#]":"trace","u [#]":"unassemble",x:"execution options",v:"print version","var":"assign variable"},zq="INVALID AAA AAD AAM AAS ADC ADD AND ARPL AS: BOUND BSF BSR BT BTC BTR BTS CALL CBW CLC CLD CLI CLTS CMC CMP CMPSB CMPSW CS: CWD DAA DAS DEC DIV DS: ENTER ES: ESC FS: GS: HLT IBTS IDIV IMUL IN INC INS INT INT3 INTO IRET JBE JC JCXZ JG JGE JL JLE JMP JA JNC JNO JNP JNS JNZ JO JP JS JZ LAHF LAR LDS LEA LEAVE LES LFS LGDT LGS LIDT LLDT LMSW LOADALL LOCK LODSB LODSW LOOP LOOPNZ LOOPZ LSL LSS LTR MOV MOVSB MOVSW MOVSX MOVZX MUL NEG NOP NOT OR OS: OUT OUTS POP POPA POPF PUSHF PUSHA PUSH RCL RCR REPNZ REPZ RET RETF ROL ROR SAHF SALC SAR SBB SCASB SCASW SETBE SETC SETG SETGE SETL SETLE SETNBE SETNC SETNO SETNP SETNS SETNZ SETO SETP SETS SETZ SGDT SHL SHLD SHR SHRD SIDT SLDT SMSW SS: STC STD STI STOSB STOSW STR SUB TEST VERR VERW WAIT XBTS XCHG XLAT XOR".split(" "),
Aq="FLD FST FSTP FXCH FILD FIST FISTP FBLD FBSTP FADD FADDP FIADD FSUB FSUBP FISUB FSUBR FSUBRP FISUBR FMUL FMULP FIMUL FDIV FDIVP FIDIV FDIVR FDIVRP FIDIVR FSQRT FSCALE FPREM FRNDINT FXTRACT FABS FCHS FCOM FCOMP FCOMPP FICOM FICOMP FTST FXAM FPTAN FPATAN F2XM1 FYL2X FYL2XP1 FLDZ FLD1 FLDPI FLDL2T FLDL2E FLDLG2 FLDLN2 FINIT FNINIT FDISI FNDISI FENI FNENI FLDCW FSTCW FNSTCW FSTSW FNSTSW FCLEX FNCLEX FSTENV FNSTENV FLDENV FSAVE FNSAVE FRSTOR FINCSTP FDECSTP FFREE FFREEP FNOP FWAIT FSETPM FSINCOS FSTSWAX".split(" "),
@ -692,7 +693,7 @@ this.ka=null;gf(this.F,104,this.Rm.bind(this));wb(this)};function Tq(a,b,c,d,e,f
function Vq(a,b,c,d){var e=a.na(b,2),f=a.na(b,2),g=a.oa(b,4),h=a.oa(b,4),k=rq(a,a.oa(b,4),a.na(b,2));b=rq(a,a.oa(b,4),a.na(b,2));b=Qq(a,b).toUpperCase();var k=Qq(a,k).toUpperCase(),l=(c?"_CODE":"_DATA")+t(e,2);d&&B(a,128)&&a.message((b==k?"":b+"!")+k+" "+(c?"code":"data")+"("+t(e,4)+")="+t(f,4)+":"+t(g)+" len "+t(h));c=Uq(a,k,e);c[k+l]=g;fm(a,k,e,f,g,null,h,c)}function Wq(a,b,c){c=Qq(a,c).toUpperCase();Xq(a,c,b)}
m.Pm=function(){var a=this.F;if(null!=this.L&&2752554==a.G){var b=a.M&65535,c=a.K&65535,d=rq(this,J(a)+12,a.ta.Z);switch(this.oa(d)){case 336:Vq(this,rq(this,a.H,b),!c,!!this.L)}}return!0};
m.Qm=function(a){var b=this.F,c=b.G&65535,d=b.H&65535,e=b.I&65535,f=b.M&65535,g=b.K&65535,h=b.J&65535,k=b.Xa.Z;if(null==this.L)return 79==c&&hf(b,a,function(a){return function(){62342!=(b.G&65535)?(b.G=b.G&-65536|62342,z(a,"INT 0x41 handling enabled",128),a.L=!0):(z(a,"INT 0x41 monitoring enabled",128),a.L=!1)}}(this)),!0;switch(c){case 79:this.L&&(b.G=b.G&-65536|62342,z(this,"INT 0x41 handling enabled",128));break;case 80:Tq(this,rq(this,h,k),d+1,e,!(g&1),!!this.L);break;case 82:Xq(this,null,d);
break;case 127:this.L&&(b.G=b.G&-65536|(this.cb?0:1));break;case 131:this.L&&(a=rq(this,b.M,e),this.rb++?(this.O("TRAPFAULT failed"),Yq(this,this.B,a,!0,!0),this.rb=0,this.Wb()):(this.O("INT 0x41 TRAPFAULT: fault="+v(d)+" error="+("0x"+t(b.K))+" addr="+Zq(a)),this.Rd(this.B,a,!0),tq(this,!0)));break;case 141:this.L&&(b.G=b.G&-65536|1);break;case 336:Vq(this,rq(this,b.H,f),!g,!!this.L);break;case 338:Wq(this,d,rq(this,b.J,f))}this.cb=!1;return!this.L};
break;case 127:this.L&&(b.G=b.G&-65536|(this.cb?0:1));break;case 131:this.L&&(a=rq(this,b.M,e),this.rb++?(this.O("TRAPFAULT failed"),Yq(this,this.B,a,!0,!0),this.rb=0,this.Wb()):(this.O("INT 0x41 TRAPFAULT: fault="+v(d)+" error="+t(b.K,8,!0)+" addr="+Zq(a)),this.Rd(this.B,a,!0),tq(this,!0)));break;case 141:this.L&&(b.G=b.G&-65536|1);break;case 336:Vq(this,rq(this,b.H,f),!g,!!this.L);break;case 338:Wq(this,d,rq(this,b.J,f))}this.cb=!1;return!this.L};
m.Rm=function(a){var b=this.F,c=b.G&255,d=b.G>>8&255,e=b.H&65535,f=b.I&65535,g=b.M&65535,h=b.J&65535,k=b.Xa.Z;if(null==this.ka){if(67==d){if(609437257==b.oa((b.wa.Z<<4)+10)||1111835735==b.oa((b.wa.Z<<4)+95))return!0;hf(b,a,function(a){return function(){62342!=(b.G&65535)?(b.G=b.G&-65536|62342,z(a,"INT 0x68 handling enabled",128),a.L=a.ka=!0):(z(a,"INT 0x68 monitoring enabled",128),a.ka=!1)}}(this))}return!0}switch(d){case 67:this.ka&&(b.G=b.G&-65536|62342);break;case 68:this.ka&&(a=jd(b.wa,this.ql.bind(this)))&&
(b.J=a[0],zd(b,a[1]));break;case 72:Xq(this,null,e);break;case 80:32==c?Tq(this,rq(this,h,k),0,f,!0,!!this.ka):128>c?Tq(this,rq(this,h,k),e+1,c&64?g:f,!(c&1),!!this.ka):Vq(this,rq(this,h,k),!(c&1),!!this.ka),this.ka&&(b.G=b.G&-256|1)}return!this.ka};m.ql=function(){var a=this.F;5==(a.G&255)&&(a.I=a.K=0,a.G=a.G&-256|1);return!1};
m.Pb=function(a,b,c){var d=this;switch(b){case "debugInput":return this.Ka=this.qa[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",vq(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.A<d.C.length-1&&(b=d.C[++d.A])):40==a.keyCode&&(0<d.A?b=d.C[--d.A]:(b="",d.A=-1)),null!=b){var g=b.length;c.value=b;c.setSelectionRange(g,g)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.qa[b]=c,Na(c,function(){if(d.Ka){var a=d.Ka.value;
@ -770,7 +771,7 @@ qd=qd+(" %%"+t(be.ml));a.O(qd)}else a.O("unsupported operation")}}else a.O("mis
tb-=Eb;0>tb&&(null==tc[tc.length-1].Z?(Eb=tb+Eb,tb=0):tb+=tc.length);var li=[];"call"==Dn&&(de=1E5,li=["CALL"]);for(void 0!==Cn&&a.O(Eb+" instructions earlier:");0<de&&tb!=a.Fa;){var rd=tc[tb++];if(null==rd.Z)break;var Ve=rq(a,rd.Ra,rd.Z,rd.Ea,rd.type,rd.Rb,rd.oc),es=Eb--,Gn=tr(a,Ve,"history",es);(!li.length||0<=Gn.indexOf(li[0]))&&a.O(Gn);Ve.Ue&&(tb+=Ve.Ue,de-=Ve.Ue,Eb-=Ve.Ue);tb>=tc.length&&(tb=0);a.Jb=Eb;Fn++;de--}}Fn||(a.O("no "+En+"history available"),a.Jb=void 0)}else if("di"==ia){P.shift();
var mi=P[0];if(mi){var We=nq(a,mi);if(void 0===We||0>We||255<We)a.O("invalid vector: "+mi);else{var Hn="&",In=!!(a.F.Za&1),Jn=!1,qg=a.F.Lc+(We<<(In?3:2)),ni=a.F.na(qg+0),fs=a.F.na(qg+2);In&&(Hn="#",a.F.na(qg+4)&2048&&(Jn=!0,ni|=a.F.na(qg+6)<<16));a.O("dumpIDT("+v(We)+"): "+Hn+t(fs,4)+":"+t(ni,Jn?8:4))}}else a.O("no IDT vector")}else if("dt"==ia)P.shift(),a.O("no information");else{var ee=fr(a,ja);if(ee&&(null!=ee.Z||null!=ee.Ea)){var rg=0;Ha&&("l"==Ha.charAt(0)&&(Ha=Ha.substr(1)||Xa),rg=nq(a,Ha)>>>
0,65536<rg&&(rg=65536));for(var sd="",sg="dd"==ia?4:"dw"==ia?2:1,tg=sg*rg||128,gs=tg+15>>4||1;gs--&&0<tg;){var ug=0,oi=0,Xe,Ye="",pi="",ja=Zq(ee);for(Xe=16;0<Xe&&0<tg;Xe--){var vg=a.Qa(ee,1),ug=ug|vg<<(oi++<<3);oi==sg&&(Ye+=t(ug,2*sg),Ye+=1==sg?9==Xe?"-":" ":" ",ug=oi=0);pi+=32<=vg&&128>vg?String.fromCharCode(vg):".";tg--}sd&&(sd+="\n");sd+=ja+" "+Ye+(0==Xe?" "+pi:"")}sd&&a.O(sd);a.sb=ee}}}}}break;case "e":if("else"==g[0])break;var wg=1,Kn=255,Ln=a.Qa,Mn=a.qc;"ew"==g[0]&&(wg=2,Kn=65535,Ln=a.na,
Mn=a.jb);var Nn=wg<<1,On=g[1];if(null==On)a.O("edit memory commands:"),a.O("\teb [a] [...] edit bytes at address a"),a.O("\tew [a] [...] edit words at address a");else{var xg=fr(a,On);if(xg)for(var yg=2;yg<g.length;yg++){var Ze=lq(a,g[yg]);if(void 0===Ze){a.O("unrecognized value: "+g[yg]);break}Ze&~Kn&&a.O("warning: "+t(Ze)+" exceeds "+wg+"-byte value");var hs=Ln.call(a,xg);a.O("changing "+Zq(xg)+" from 0x"+t(hs,Nn)+" to 0x"+t(Ze,Nn));Mn.call(a,xg,Ze,wg)}}break;case "f":Er(a,g[1]);break;case "g":a:{var Pn=
Mn=a.jb);var Nn=wg<<1,On=g[1];if(null==On)a.O("edit memory commands:"),a.O("\teb [a] [...] edit bytes at address a"),a.O("\tew [a] [...] edit words at address a");else{var xg=fr(a,On);if(xg)for(var yg=2;yg<g.length;yg++){var Ze=lq(a,g[yg]);if(void 0===Ze){a.O("unrecognized value: "+g[yg]);break}Ze&~Kn&&a.O("warning: "+t(Ze)+" exceeds "+wg+"-byte value");var hs=Ln.call(a,xg);a.O("changing "+Zq(xg)+" from "+t(hs,Nn,!0)+" to "+t(Ze,Nn,!0));Mn.call(a,xg,Ze,wg)}}break;case "f":Er(a,g[1]);break;case "g":a:{var Pn=
g[1],is=b;"gt"==g[0]&&(a.cb=!0);if(void 0!==Pn){var qi=fr(a,Pn,!0);if(!qi)break a;gr(a,qi,is);a.Rd(a.B,qi,!0)}a.Le(!0)||c||a.O("cpu busy or unavailable, run command ignored")}break;case "h":a:{var ri;if(a.la.Ib)ri="halting",a.Wb();else{if(vb(a,!0))break a;ri="already halted"}c||a.O(ri)}break;case "i":if("if"==g[0]){var si;var $e=b.substr(2),$e=pa($e);lq(a,$e)?(c||a.O("true: "+$e),si=!0):(c||a.O("false: "+$e),si=!1);si||(d=!1);break}if("int"==g[0]){var zg;a:switch(nq(a,g[1])){case 19:ok(a,19,a.F.Ha,
!0);a.Ca=a.pa;zg=!0;break a;case 33:ok(a,33,a.F.Ha,!0);a.Ca=a.pa;zg=!0;break a;default:zg=!1}zg||(d=!1);break}var ti=g[1];if(ti&&"?"!=ti){var ui=nq(a,ti);if(void 0!==ui){var js=oc(a.ga,ui,1);a.O(v(ui)+": "+u(js))}}else a.O("input commands:"),a.O("\ti [p]\tread port [p]"),a.O("warning: port accesses can affect hardware state");break;case "k":var ks=g[0];if("?"==g[1])a.O("stack trace commands:"),a.O("\tk\tshow frame addresses"),a.O("\tks\tshow symbol information");else{var vi=0,Qn=a.F.wa.Z,af=rq(a),
Vc=rq(a,J(a.F),a.F.ta.Z);for(a.O("stack trace for "+Zq(Vc));10>vi;){for(var uc=null,ls=256;Vc.Ra>>>0<a.F.Rg>>>0;){af.Ra=a.tb(Vc,!0);if(null==Vc.Ea||!ls--)break;af.Z=Qn;if(uc=Jr(a,af))break;af.Z=a.tb(Vc);if(uc=Jr(a,af,!0)){Qn=a.tb(Vc,!0);0<uc.indexOf("INT")&&a.tb(Vc,!0);break}}if(!uc||null==uc)break;var Rn=null;if("ks"==ks){var Sn=uc.match(/[0-9A-F]+$/);Sn&&(Rn=Gr(a,Sn[0]))}uc=oa(uc,50)+" ;"+(Rn||"stack="+Zq(Vc));a.O(uc);vi++}vi||a.O("no return addresses found")}break;case "l":if("ln"==g[0]){Gr(a,