From 62150f45deab8b5111b3e92e7d234be206915c72 Mon Sep 17 00:00:00 2001 From: Neil Webber Date: Thu, 23 May 2024 18:14:23 -0500 Subject: [PATCH] squeeze a few nsec out of MOV --- op4.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/op4.py b/op4.py index 1b23727..6cc9c68 100644 --- a/op4.py +++ b/op4.py @@ -68,9 +68,9 @@ def op01_mov(cpu, inst): # avoid call to the more-general operandx for mode 0, direct register. # This optimization is a substantial speed up for register MOVs. srcb6 = (inst & 0o7700) >> 6 - if srcb6 < 8: - val = cpu.r[srcb6] - else: + try: + val = cpu.r[srcb6] # only works if srcb6 < 8; register direct + except IndexError: val = cpu.operandx(srcb6) cpu.psw_v = 0 # per manual; V is cleared