From 02f55397f85c9b4e30c61e5ba45b5d963ea73032 Mon Sep 17 00:00:00 2001 From: Neil Webber Date: Tue, 14 May 2024 09:04:38 -0500 Subject: [PATCH] minor perf improvement for byte writes in operandx (validated with timeit) --- machine.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/machine.py b/machine.py index 463feaa..593bc5d 100644 --- a/machine.py +++ b/machine.py @@ -277,7 +277,7 @@ class PDP11: # start off in halted state until .run() happens self.halted = True - # device instances; see add_device + # device instances; see associate_device self.devices = {} def physRW(self, physaddr, value=None): @@ -435,8 +435,7 @@ class PDP11: case Rn, bv, 1: # NOTE: The MOVB instruction has different semantics # than this; it is coded explicitly in op11_movb() - self.r[Rn] &= 0o177400 - self.r[Rn] |= (bv & 0o377) + self.r[Rn] = (self.r[Rn] & 0o177400) | (bv & 0o377) return (value, b6) if rmw else value # harder cases