From 6b45e0f81267be6140f0f178579494ca6d24443b Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Mon, 31 Oct 2022 19:55:32 -0700 Subject: Restructure a lot of the control registers --- io/model.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'io') diff --git a/io/model.cpp b/io/model.cpp index fcabbd2..fb9f62b 100644 --- a/io/model.cpp +++ b/io/model.cpp @@ -24,24 +24,25 @@ bool iomodel::interact(std::array &ctlregs) { } bool interrupt = false; - if (ctlregs[TT_INT_ENABLE]) { + if (ctlregs[TT_FLAGS] & TTF_INT_ENABLE) { if (ctlregs[TT_BITS] & TTI_FLAG) interrupt = true; - } - if (ctlregs[TT_INT_ENABLE]) { if (ctlregs[TT_BITS] & TTO_FLAG) interrupt = true; } - ctlregs[INT_PENDING] = interrupt; - interrupt = interrupt && (ctlregs[INT_ENABLE] & 1); + if (interrupt) + ctlregs[FLAGS] |= FLAG_INT_REQUEST; + else + ctlregs[FLAGS] &= !FLAG_INT_REQUEST; + interrupt = interrupt && (ctlregs[FLAGS] & FLAG_INT_ENABLE); if (interrupt) { - ctlregs[DATA_INSTRUCTION_FIELD_SAVED] = ctlregs[DATA_INSTRUCTION_FIELD_BUFFER]; - ctlregs[DATA_INSTRUCTION_FIELD_BUFFER] = 0; + ctlregs[FLAGS_SAVED] = ctlregs[FLAGS]; + ctlregs[FLAGS] = 0; ctlregs[HALTED] = 0; - ctlregs[INT_ENABLE] = 0; } else { - ctlregs[INT_ENABLE] = (ctlregs[INT_ENABLE] >> 1) * 3; + if (ctlregs[FLAGS] & FLAG_INT_ENABLE_DELAY) + ctlregs[FLAGS] |= FLAG_INT_ENABLE; } return interrupt; -- cgit v1.2.3