From aea2634940b4556f8ee746e5f20d4570e9ecfcb6 Mon Sep 17 00:00:00 2001 From: Charles Anthony Date: Sat, 8 Jun 2024 13:53:17 -0700 Subject: [PATCH] IBM1130: Fix address computation overflow In sim_instr(), the effective address is computed; for the case of TAG (index register addressing), the contents of the specified index register is added to the effective address, but the result is not masked to 16 bits as per the hardware functionality. Adding a a 16 bit mask operation fixes the issue. --- Ibm1130/ibm1130_cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ibm1130/ibm1130_cpu.c b/Ibm1130/ibm1130_cpu.c index aba74fb6..f82b610a 100644 --- a/Ibm1130/ibm1130_cpu.c +++ b/Ibm1130/ibm1130_cpu.c @@ -653,7 +653,7 @@ t_stat sim_instr (void) eaddr = word2; /* assume standard addressing & compute effective address */ if (TAG) /* if indexed */ - eaddr += ReadIndex(TAG); /* add index register value */ + eaddr = (eaddr + ReadIndex(TAG)) & 0xFFFF; /* add index register value */ if (INDIR) /* if indirect addressing */ eaddr = ReadW(eaddr); /* pick up referenced address */