summaryrefslogtreecommitdiff
path: root/io
diff options
context:
space:
mode:
authorJulian Blake Kongslie2022-10-31 19:26:35 -0700
committerJulian Blake Kongslie2022-10-31 19:26:35 -0700
commit6ffe43a8ccee6f3e2d6fda5062901f16c54ddaad (patch)
tree5358c32b23130bd65ed191e3959c7ce7dd048f21 /io
parentUnify TT_INPUT_INT_ENABLE and TT_OUTPUT_INT_ENABLE (diff)
downloadbiggolf-6ffe43a8ccee6f3e2d6fda5062901f16c54ddaad.tar.xz
Level-trigger on TTO_FLAG instead of edge-trigger.
Diffstat (limited to '')
-rw-r--r--io/model.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/io/model.cpp b/io/model.cpp
index 3bea59e..fcabbd2 100644
--- a/io/model.cpp
+++ b/io/model.cpp
@@ -29,7 +29,7 @@ bool iomodel::interact(std::array<std::uint_fast32_t, NUM_CTLREGS> &ctlregs) {
29 interrupt = true; 29 interrupt = true;
30 } 30 }
31 if (ctlregs[TT_INT_ENABLE]) { 31 if (ctlregs[TT_INT_ENABLE]) {
32 if ((ctlregs[TT_BITS] & (TTO_FLAG|TTO_FLAG_OLD)) == TTO_FLAG) 32 if (ctlregs[TT_BITS] & TTO_FLAG)
33 interrupt = true; 33 interrupt = true;
34 } 34 }
35 ctlregs[INT_PENDING] = interrupt; 35 ctlregs[INT_PENDING] = interrupt;
@@ -40,7 +40,6 @@ bool iomodel::interact(std::array<std::uint_fast32_t, NUM_CTLREGS> &ctlregs) {
40 ctlregs[DATA_INSTRUCTION_FIELD_BUFFER] = 0; 40 ctlregs[DATA_INSTRUCTION_FIELD_BUFFER] = 0;
41 ctlregs[HALTED] = 0; 41 ctlregs[HALTED] = 0;
42 ctlregs[INT_ENABLE] = 0; 42 ctlregs[INT_ENABLE] = 0;
43 ctlregs[TT_BITS] |= (ctlregs[TT_BITS] & TTO_FLAG) ? TTO_FLAG_OLD : 0;
44 } else { 43 } else {
45 ctlregs[INT_ENABLE] = (ctlregs[INT_ENABLE] >> 1) * 3; 44 ctlregs[INT_ENABLE] = (ctlregs[INT_ENABLE] >> 1) * 3;
46 } 45 }