From e0ee03184517737bb5a01f98142ad713324bda7c Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Sat, 22 Oct 2022 23:31:04 -0700 Subject: Initial interrupt controller support --- io/model.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'io/model.cpp') diff --git a/io/model.cpp b/io/model.cpp index e1b59ea..d6e36f9 100644 --- a/io/model.cpp +++ b/io/model.cpp @@ -24,16 +24,16 @@ bool iomodel::interact(std::array &ctlregs) { } bool interrupt = false; - if (ctlregs[INT_ENABLE] & 1) { - if (ctlregs[TT_INPUT_INT_ENABLE]) { - if (ctlregs[TT_BITS] & TTI_FLAG) - interrupt = true; - } - if (ctlregs[TT_OUTPUT_INT_ENABLE]) { - if ((ctlregs[TT_BITS] & (TTO_FLAG|TTO_FLAG_OLD)) == TTO_FLAG) - interrupt = true; - } + if (ctlregs[TT_INPUT_INT_ENABLE]) { + if (ctlregs[TT_BITS] & TTI_FLAG) + interrupt = true; } + if (ctlregs[TT_OUTPUT_INT_ENABLE]) { + if ((ctlregs[TT_BITS] & (TTO_FLAG|TTO_FLAG_OLD)) == TTO_FLAG) + interrupt = true; + } + ctlregs[INT_PENDING] = interrupt; + interrupt = interrupt && (ctlregs[INT_ENABLE] & 1); if (interrupt) { ctlregs[DATA_INSTRUCTION_FIELD_SAVED] = ctlregs[DATA_INSTRUCTION_FIELD_BUFFER]; -- cgit v1.2.3