Fixed the Debugger's arithmetic truncation function (truncate())

This commit is contained in:
Jeff 2017-04-01 14:36:39 -07:00 committed by Jeff Parsons
commit 75b9a9c2ba
9 changed files with 84 additions and 149 deletions

View file

@ -716,7 +716,7 @@ var Sw="Hard Drive",Vw=["XTC","ATC","COMPAQ"],Tw=[{0:[306,2],1:[375,8],2:[306,6]
815:Gw.prototype.ii},Jw={496:Gw.prototype.Bn,497:Gw.prototype.Gn,498:Gw.prototype.En,499:Gw.prototype.Fn,500:Gw.prototype.An,501:Gw.prototype.zn,502:Gw.prototype.Cn,503:Gw.prototype.yn,1014:Gw.prototype.Dn};$a(function(){for(var a=zb(document,"pcx86","hdc"),b=0;b<a.length;b++){var c=a[b],d=vb(c),d=new Gw(d);yb(d,c)}});function Vx(a){mb.call(this,"Debugger",a);this.F=+a.base||16;this.ae=null;this.ha=["{","}"];this.Aa=["[","]"];this.Z=this.la=this.M=0;this.ga=!1;this.A=-1;this.C=[];this.Y={}}
ba(Vx,mb);Vx.prototype.hh=function(){return-1};Vx.prototype.ih=function(){};Vx.prototype.Qk=function(a,b){return a.replace("["+b+"]","unimplemented")};
Vx.prototype.Dg=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.ga?a="end":a=this.C[this.A+1];b=[];if(a){a=a.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(Ba(a.substring(d,f))),d=f+1}}return b};
function Wx(a,b,c){var d=a;b=b||32;if(c)if(32==b)d=a>>>0;else if(32>b)d=a&(1<<b)-1;else{if(b=Math.pow(2,b),0>a||a>=b)d=a%b,0>d&&(d+=b)}else 32>=b?d=a|0:(b=Math.pow(2,b-1),a<-b?(a<2*-b&&(d=a%(2*b)),d+=2*b):d>=b&&(a>=2*b&&(d=a%(2*b)),d-=2*b));a!=d&&(a=d);return a}
function Wx(a,b,c){var d=a;b=b||32;if(c)if(32==b)d=a>>>0;else if(32>b)d=a&(1<<b)-1;else{if(b=Math.pow(2,b),0>a||a>=b)d=a%b,0>d&&(d+=b)}else 32>=b?d=a<<32-b>>32-b:(b=Math.pow(2,b-1),a>=b?(d=a%b,(a/b|0)&1&&(d-=b)):a<-b&&(d=a%b,((-a-1)/b|0)&1?d&&(d+=b):d||(d-=b)));a!=d&&(a=d);return a}
function Xx(a,b,c){for(c=void 0===c?-1:c;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e,f=a.pop();e=a.pop();switch(d){case "*":e*=f;break;case "/":if(!f)return!1;e=Math.trunc(e/f);break;case "^/":if(!f)return!1;e%=f;break;case "+":e+=f;break;case "-":e-=f;break;case "<<":e<<=f;break;case ">>":e>>=f;break;case ">>>":e>>>=f;break;case "<":e=e<f?1:0;break;case "<=":e=e<=f?1:0;break;case ">":e=e>f?1:0;break;case ">=":e=e>=f?1:0;break;case "==":e=e==f?1:0;break;case "!=":e=e!=f?1:0;break;case "&":e&=
f;break;case "!":case "|":e|=f;break;case "^!":e|=f;break;case "&&":e=e&&f?1:0;break;case "||":e=e||f?1:0;break;case "_":case "^_":"^_"==d&&(f=35-(f&255));f&&(e=Wx(e,0,!0),e=0<f?e*Math.pow(2,f):Math.trunc(e/Math.pow(2,-f)));break;default:return!1}a.push(Wx(e))}return!0}
function Yx(a,b,c,d,e,f){var g,h,k,m=!1,p=0,v=[],u=[],E=a.F;for(a.F=e;c<d;){h=b[c++].trim();k=c<d?b[c++]:"";if(h)p=Zx(a,h,null,f,p);else if("{"==k){h=1;for(p=c;c<d;)if(c++,k=c<b.length?b[c++]:"","{"==k)h++;else if("}"==k&&!--h)break;p=Yx(a,b,p,c-1,a.F,f);h=c<d?b[c++].trim():"";k=c<d?b[c++]:""}else{if(" "==k)continue;if("^B"==k){a.F=2;continue}if("^O"==k){a.F=8;continue}if("^D"==k){a.F=10;continue}if(!(p&-1073741824)){if("+"==k)continue;if("-"==k){p=p<<2|1;continue}if("~"==k||"^-"==k){p=p<<2|2;continue}if("^L"==