From 6b3b41a0c847c3bd25bade9798caf57d91ece029 Mon Sep 17 00:00:00 2001 From: Neil Webber Date: Sun, 12 May 2024 04:17:25 -0500 Subject: [PATCH] Make sure HALT_SEQUENCE works even if only one byte --- kl11.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kl11.py b/kl11.py index 12af4e4..8d2db99 100644 --- a/kl11.py +++ b/kl11.py @@ -38,8 +38,8 @@ # which is Unicode U+00E7, c--cedilla, will cause the emulation to # halt as if the physical console HALT toggle had been selected. # This sequence was chosen because it is option-C on a mac; see -# HALT_BYTES -# to override this choice. NOTE: the first N-1 bytes of the HALT_BYTES +# HALT_SEQUENCE +# to override this choice. NOTE: the first N-1 HALT_SEQUENCE bytes # will still be transmitted to the emulation, the HALT will only occur # once the full sequence has been received. # @@ -250,6 +250,8 @@ class KL11: if in_halt_sequence is None: if b == self.HALT_SEQUENCE[0]: in_halt_sequence = 1 + if len(self.HALT_SEQUENCE) == 1: + return elif b == self.HALT_SEQUENCE[in_halt_sequence]: in_halt_sequence += 1 if len(self.HALT_SEQUENCE) == in_halt_sequence: