From 94c72d28a60e4dced5e06f73be84f894b18fe7f1 Mon Sep 17 00:00:00 2001 From: Neil Webber Date: Sun, 7 Apr 2024 08:56:00 -0500 Subject: [PATCH] Fix for #14 https://github.com/outofmbufs/python-pdp11-emulator/issues/14 --- kl11.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/kl11.py b/kl11.py index 6cad894..8309681 100644 --- a/kl11.py +++ b/kl11.py @@ -123,14 +123,23 @@ class KL11: self.ub.intmgr.simple_irq(pri=4, vector=0o64) # transmit buffer - case 6 if value is not None: # tbuf - # *** WRITING *** - value &= 0o177 - if (value != 0o177): - s = chr(value) - self.tq.put(s) - if self.t_ienable: - self.ub.intmgr.simple_irq(pri=4, vector=0o64) + case 6: + if value is None: + # *** READING *** + # manual says this is load-only; however automatic + # byte write support (byteme/mmio) requires this + # be readable. Probably byteme should be fixed instead + # to catch traps from unreadables and synthesize + # a zero there (?) + value = 0 + else: + # *** WRITING *** + value &= 0o177 + if (value != 0o177): + s = chr(value) + self.tq.put(s) + if self.t_ienable: + self.ub.intmgr.simple_irq(pri=4, vector=0o64) case _: raise PDPTraps.AddressError