fix @(Rn)+/@-(Rn) incr/decr is always 2 -- Issue: 'addressing modes #4'

This commit is contained in:
Neil Webber 2024-03-29 08:54:00 -05:00
parent 7617579031
commit 899e2a00ea

View file

@ -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: