Fixed 36-bit multiplication in the expression parser so that, within the PDP-10 environment, it produces the same 36-bit results that a PDP-10 would produce (important for MACRO-10 compatibility)

This commit is contained in:
Jeff 2017-04-01 00:43:44 -07:00 committed by Jeff Parsons
commit 1711393755
5 changed files with 99 additions and 62 deletions

View file

@ -426,6 +426,22 @@ class Debugger extends Component
return ((((dst / Debugger.TWO_POW32)|0) ^ ((src / Debugger.TWO_POW32)|0)) * Debugger.TWO_POW32) + ((dst ^ src) >>> 0);
}
/**
* evalMUL(dst, src)
*
* I could have adapted the code from /modules/pdp10/lib/cpuops.js:PDP10.doMUL(), but it was simpler to
* write this base method and let the PDP-10 Debugger override it with a call to the *actual* doMUL() method.
*
* @this {Debugger}
* @param {number} dst
* @param {number} src
* @return {number} (dst * src)
*/
evalMUL(dst, src)
{
return dst * src;
}
/**
* truncate(v, nBits, fUnsigned)
*
@ -513,7 +529,7 @@ class Debugger extends Component
var val1 = aVals.pop();
switch(chOp) {
case '*':
valNew = val1 * val2;
valNew = this.evalMUL(val1, val2);
break;
case '/':
if (!val2) return false;