From 763beb022c799598ef4eaa9750ad259497bd2e84 Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Sat, 22 Oct 2022 22:53:26 -0700 Subject: Merge TT_INPUT and TT_OUTPUT into TT_BITS --- io/model.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'io/model.cpp') diff --git a/io/model.cpp b/io/model.cpp index eaa6ca8..e1b59ea 100644 --- a/io/model.cpp +++ b/io/model.cpp @@ -16,21 +16,21 @@ bool iomodel::interact(std::array &ctlregs) { ++time; - if (ctlregs[TT_OUTPUT] & 0x100) { + if (ctlregs[TT_BITS] & TTO_TX) { // PDP-8 doesn't really have support for 8-bit output, this is Jules' contribution - std::cout << (char)((ctlregs[TT_OUTPUT] & 0xff) ^ 0x80) << std::flush; - ctlregs[TT_OUTPUT] &= ~0x1ff; - log.emplace(time + TT_OUTPUT_DELAY, event(TT_OUTPUT, 0x200, 0)); + std::cout << (char)(((ctlregs[TT_BITS] & TTO_DATA) >> TTO_DATA_SHIFT) ^ 0x80) << std::flush; + ctlregs[TT_BITS] &= ~TTO_TX & ~TTO_DATA; + log.emplace(time + TT_OUTPUT_DELAY, event(TT_BITS, TTO_FLAG, 0)); } bool interrupt = false; if (ctlregs[INT_ENABLE] & 1) { if (ctlregs[TT_INPUT_INT_ENABLE]) { - if (ctlregs[TT_INPUT] & 0x100) + if (ctlregs[TT_BITS] & TTI_FLAG) interrupt = true; } if (ctlregs[TT_OUTPUT_INT_ENABLE]) { - if (!(ctlregs[TT_OUTPUT] & 0x400) && (ctlregs[TT_OUTPUT] & 0x200)) + if ((ctlregs[TT_BITS] & (TTO_FLAG|TTO_FLAG_OLD)) == TTO_FLAG) interrupt = true; } } @@ -40,7 +40,7 @@ bool iomodel::interact(std::array &ctlregs) { ctlregs[DATA_INSTRUCTION_FIELD_BUFFER] = 0; ctlregs[HALTED] = 0; ctlregs[INT_ENABLE] = 0; - ctlregs[TT_OUTPUT] = (ctlregs[TT_OUTPUT] & 0x200) * 3; + ctlregs[TT_BITS] |= (ctlregs[TT_BITS] & TTO_FLAG) ? TTO_FLAG_OLD : 0; } else { ctlregs[INT_ENABLE] = (ctlregs[INT_ENABLE] >> 1) * 3; } -- cgit v1.2.3