From 899e2a00ea1b97c34916927276c18030381f59ea Mon Sep 17 00:00:00 2001 From: Neil Webber Date: Fri, 29 Mar 2024 08:54:00 -0500 Subject: [PATCH] fix @(Rn)+/@-(Rn) incr/decr is always 2 -- Issue: 'addressing modes #4' --- machine.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/machine.py b/machine.py index bb0dcf1..b71d1ad 100644 --- a/machine.py +++ b/machine.py @@ -465,6 +465,7 @@ class PDP11: if addrmode == 0o30: addr = self.mmu.wordRW(addr, space=space) space = self.mmu.DSPACE + autocrement = 2 # regardless of opsize used above extendedb6 = None # force update below # both autodecrement addrmode, PC - NOPE. @@ -475,7 +476,12 @@ class PDP11: # both autodecrement addrmodes, not PC # note that bytes and -(SP) still decrement by 2 case 0, 0o40 | 0o50 as addrmode, Rn: - autocrement = -2 if Rn == self.SP else -opsize + if Rn == self.SP: + autocrement = -2 + elif addrmode == 0o50: + autocrement = -2 + else: + autocrement = -opsize extendedb6 = None # force update below addr = self.u16add(self.r[Rn], autocrement) if addrmode == 0o50: