Fixed OPDEF opcode generation (improper use of bitwise operators)

This commit is contained in:
Jeff 2017-04-04 11:26:49 -07:00 committed by Jeff Parsons
commit 427e6afdb8
3 changed files with 112 additions and 100 deletions

View file

@ -963,6 +963,9 @@ class DebuggerPDP10 extends Debugger {
case DebuggerPDP10.REGS.C1:
value = (cpu.regPS & PDP10.PSFLAG.CRY1)? 1 : 0;
break;
case DebuggerPDP10.REGS.BI:
value = (cpu.regPS & PDP10.PSFLAG.BIS)? 1 : 0;
break;
case DebuggerPDP10.REGS.ND:
value = (cpu.regPS & PDP10.PSFLAG.DCK)? 1 : 0;
break;
@ -1002,6 +1005,9 @@ class DebuggerPDP10 extends Debugger {
case DebuggerPDP10.REGS.C1:
flag = PDP10.PSFLAG.CRY1;
break;
case DebuggerPDP10.REGS.BI:
flag = PDP10.PSFLAG.BIS;
break;
case DebuggerPDP10.REGS.ND:
flag = PDP10.PSFLAG.DCK;
break;
@ -4147,12 +4153,13 @@ if (DEBUGGER) {
OV: 4, // single-bit "register" representing the Overflow flag
C0: 5, // single-bit "register" representing the Carry 0 flag
C1: 6, // single-bit "register" representing the Carry 1 flag
ND: 7, // single-bit "register" representing the No Divide flag
PD: 8, // single-bit "register" representing the Pushdown Overflow flag
BI: 7, // single-bit "register" representing the Byte Interrupt flag
ND: 8, // single-bit "register" representing the No Divide flag
PD: 9, // single-bit "register" representing the Pushdown Overflow flag
};
DebuggerPDP10.REGNAMES = [
"PC", "RA", "EA", "PS", "OV", "C0", "C1", "ND", "PD"
"PC", "RA", "EA", "PS", "OV", "C0", "C1", "BI", "ND", "PD"
];
/*

View file

@ -815,7 +815,12 @@ class Macro10 {
this.popScope();
if (w !== undefined) {
this.aWords[nLocation] += (w & (PDP10.OPCODE.A_FIELD | PDP10.OPCODE.X_FIELD | PDP10.OPCODE.Y_FIELD));
this.aWords[nLocation] |= (w & PDP10.OPCODE.I_FIELD);
/*
* We can't "OR" (|=) the I_FIELD bit into the target word, because it's a 36-bit value and bitwise
* operators truncate to 32 bits, so we'll use addition, trusting that the field was initially zero.
*/
this.dbg.assert(!(this.aWords[nLocation] & PDP10.OPCODE.I_FIELD));
this.aWords[nLocation] += (w & PDP10.OPCODE.I_FIELD);
if (sFixup) {
if (!this.aFixups[nLocation]) {
this.aFixups[nLocation] = sFixup;