summaryrefslogtreecommitdiff
path: root/io/model.cpp
diff options
context:
space:
mode:
authorJulian Blake Kongslie2022-10-22 23:31:04 -0700
committerJulian Blake Kongslie2022-10-22 23:31:04 -0700
commite0ee03184517737bb5a01f98142ad713324bda7c (patch)
tree882fcd3fb0042b2ede3d9ae2435709bd42ff1cc0 /io/model.cpp
parentImprove decoder comments to directly reference instruct mnemonics (diff)
downloadbiggolf-e0ee03184517737bb5a01f98142ad713324bda7c.tar.xz
Initial interrupt controller support
Diffstat (limited to 'io/model.cpp')
-rw-r--r--io/model.cpp18
1 files changed, 9 insertions, 9 deletions
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<unsigned int, NUM_CTLREGS> &ctlregs) {
24 } 24 }
25 25
26 bool interrupt = false; 26 bool interrupt = false;
27 if (ctlregs[INT_ENABLE] & 1) { 27 if (ctlregs[TT_INPUT_INT_ENABLE]) {
28 if (ctlregs[TT_INPUT_INT_ENABLE]) { 28 if (ctlregs[TT_BITS] & TTI_FLAG)
29 if (ctlregs[TT_BITS] & TTI_FLAG) 29 interrupt = true;
30 interrupt = true;
31 }
32 if (ctlregs[TT_OUTPUT_INT_ENABLE]) {
33 if ((ctlregs[TT_BITS] & (TTO_FLAG|TTO_FLAG_OLD)) == TTO_FLAG)
34 interrupt = true;
35 }
36 } 30 }
31 if (ctlregs[TT_OUTPUT_INT_ENABLE]) {
32 if ((ctlregs[TT_BITS] & (TTO_FLAG|TTO_FLAG_OLD)) == TTO_FLAG)
33 interrupt = true;
34 }
35 ctlregs[INT_PENDING] = interrupt;
36 interrupt = interrupt && (ctlregs[INT_ENABLE] & 1);
37 37
38 if (interrupt) { 38 if (interrupt) {
39 ctlregs[DATA_INSTRUCTION_FIELD_SAVED] = ctlregs[DATA_INSTRUCTION_FIELD_BUFFER]; 39 ctlregs[DATA_INSTRUCTION_FIELD_SAVED] = ctlregs[DATA_INSTRUCTION_FIELD_BUFFER];