More MACRO-10 fixes
This commit is contained in:
parent
3e2b825bef
commit
e1f37c8275
4 changed files with 141 additions and 132 deletions
|
|
@ -1723,23 +1723,22 @@ class DebuggerPDP10 extends Debugger {
|
|||
if (opMask == PDP10.OPCODE.OPIO) {
|
||||
if (operand < 0 || operand > PDP10.OPCODE.IO_MASK) {
|
||||
operand &= PDP10.OPCODE.IO_MASK;
|
||||
this.println("device code (" + sOperand + ") truncated to " + this.toStrBase(operand));
|
||||
if (MAXDEBUG) this.println("device code (" + sOperand + ") truncated to " + this.toStrBase(operand));
|
||||
}
|
||||
opCode += (operand * PDP10.OPCODE.IO_SCALE);
|
||||
}
|
||||
else {
|
||||
if (operand < 0 || operand > PDP10.OPCODE.A_MASK) {
|
||||
operand &= PDP10.OPCODE.A_MASK;
|
||||
this.println("accumulator (" + sOperand + ") truncated to " + this.toStrBase(operand));
|
||||
if (MAXDEBUG) this.println("accumulator (" + sOperand + ") truncated to " + this.toStrBase(operand));
|
||||
}
|
||||
opCode += (operand << PDP10.OPCODE.A_SHIFT);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (operand < 0 || operand > PDP10.OPCODE.Y_MASK) {
|
||||
this.println("memory address out of range: " + sOperand);
|
||||
opCode = -1;
|
||||
break;
|
||||
operand &= PDP10.ADDR_MASK;
|
||||
if (MAXDEBUG) this.println("address (" + sOperand + ") truncated to " + this.toStrBase(operand));
|
||||
}
|
||||
opCode += operand;
|
||||
sOperand = match[3];
|
||||
|
|
@ -1751,7 +1750,7 @@ class DebuggerPDP10 extends Debugger {
|
|||
}
|
||||
if (operand < 0 || operand > PDP10.OPCODE.X_MASK) {
|
||||
operand &= PDP10.OPCODE.X_MASK;
|
||||
this.println("index (" + sOperand + ") truncated to " + this.toStrBase(operand));
|
||||
if (MAXDEBUG) this.println("index (" + sOperand + ") truncated to " + this.toStrBase(operand));
|
||||
}
|
||||
opCode += operand << PDP10.OPCODE.X_SHIFT;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -234,9 +234,9 @@ class Macro10 {
|
|||
this.parseText(macro.sText);
|
||||
}
|
||||
|
||||
for (var f in this.aFixups) {
|
||||
for (i = 0; i < this.aFixups.length; i++) {
|
||||
var w = 0, nBits = 0;
|
||||
var fixup = this.aFixups[+f];
|
||||
var fixup = this.aFixups[i];
|
||||
var nLocation = fixup.nLocation;
|
||||
if (fixup.nBits < 0) {
|
||||
w = this.dbg.parseInstruction(fixup.aValues[0], fixup.aValues[1], nLocation);
|
||||
|
|
@ -247,9 +247,9 @@ class Macro10 {
|
|||
this.aWords[nLocation++] += w;
|
||||
continue;
|
||||
}
|
||||
for (i = 0; i < fixup.aValues.length; i++) {
|
||||
var sValue = fixup.aValues[i];
|
||||
var value = this.parseExpression(sValue);
|
||||
for (var j = 0; j < fixup.aValues.length; j++) {
|
||||
var sValue = fixup.aValues[j];
|
||||
var value = this.parseExpression(sValue, nLocation);
|
||||
if (value === undefined) {
|
||||
this.error("unable to parse expression: " + sValue);
|
||||
break;
|
||||
|
|
@ -569,17 +569,19 @@ class Macro10 {
|
|||
}
|
||||
|
||||
/**
|
||||
* parseExpression(sOperand)
|
||||
* parseExpression(sOperand, nLocation)
|
||||
*
|
||||
* This is a wrapper around the Debugger's parseExpression() function to take care of some
|
||||
* additional requirements we have, such as interpreting '.' as the current location counter.
|
||||
*
|
||||
* @this {Macro10}
|
||||
* @param {string} sOperand
|
||||
* @param {number} [nLocation]
|
||||
* @return {number|undefined}
|
||||
*/
|
||||
parseExpression(sOperand)
|
||||
parseExpression(sOperand, nLocation)
|
||||
{
|
||||
if (nLocation === undefined) nLocation = this.nLocation;
|
||||
/*
|
||||
* The Debugger's parseInstruction() replaces any period not PRECEDED by a decimal digit with
|
||||
* the current address, because our Debuggers' only other interpretation of a period is as the
|
||||
|
|
@ -587,7 +589,7 @@ class Macro10 {
|
|||
* the decimal point within a floating-point number, so here we only replace periods that are
|
||||
* not FOLLOWED by a decimal digit.
|
||||
*/
|
||||
sOperand = sOperand.replace(/\.([^0-9]|$)/g, "$1" + this.dbg.toStrBase(this.nLocation));
|
||||
sOperand = sOperand.replace(/\.([^0-9]|$)/g, this.dbg.toStrBase(nLocation, -1) + "$1");
|
||||
return this.dbg.parseExpression(sOperand);
|
||||
}
|
||||
|
||||
|
|
@ -809,6 +811,10 @@ class Macro10 {
|
|||
}
|
||||
}
|
||||
|
||||
// if (this.tblMacros[name] !== undefined) {
|
||||
// this.warning("macro redefined: " + name);
|
||||
// }
|
||||
|
||||
this.tblMacros[name] = {name, nOperand, aParms, aDefaults, sText};
|
||||
|
||||
if (!this.nMacroDef) {
|
||||
|
|
|
|||
|
|
@ -689,9 +689,13 @@ class Debugger extends Component {
|
|||
value = Str.parseInt(sValue, this.nBase);
|
||||
}
|
||||
}
|
||||
if (value == null && !fQuiet) this.println("invalid " + (sName? sName : "value") + ": " + sValue);
|
||||
if (value == null && !fQuiet) {
|
||||
this.println("invalid " + (sName? sName : "value") + ": " + sValue);
|
||||
}
|
||||
} else {
|
||||
if (!fQuiet) this.println("missing " + (sName || "value"));
|
||||
if (!fQuiet) {
|
||||
this.println("missing " + (sName || "value"));
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue