From ec5b362c3cda195178697192ba5a31643e5c358d Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Mon, 31 Oct 2022 21:23:09 -0700 Subject: Fix FLAGS bit handling by IO model --- io/model.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'io/model.cpp') diff --git a/io/model.cpp b/io/model.cpp index fb9f62b..79bc511 100644 --- a/io/model.cpp +++ b/io/model.cpp @@ -33,16 +33,16 @@ bool iomodel::interact(std::array &ctlregs) { if (interrupt) ctlregs[FLAGS] |= FLAG_INT_REQUEST; else - ctlregs[FLAGS] &= !FLAG_INT_REQUEST; + ctlregs[FLAGS] &= ~FLAG_INT_REQUEST; interrupt = interrupt && (ctlregs[FLAGS] & FLAG_INT_ENABLE); + if (ctlregs[FLAGS] & FLAG_INT_ENABLE_DELAY) + ctlregs[FLAGS] |= FLAG_INT_ENABLE; + if (interrupt) { ctlregs[FLAGS_SAVED] = ctlregs[FLAGS]; ctlregs[FLAGS] = 0; ctlregs[HALTED] = 0; - } else { - if (ctlregs[FLAGS] & FLAG_INT_ENABLE_DELAY) - ctlregs[FLAGS] |= FLAG_INT_ENABLE; } return interrupt; -- cgit v1.2.3