From 3ae7eb01fef89e420901d691389f76e0a210da3a Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Sat, 5 Nov 2022 12:53:29 -0700 Subject: Fix implementation of IAC microinstruction --- isa/decode.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/isa/decode.cpp b/isa/decode.cpp index 6ab90fd..df263ad 100644 --- a/isa/decode.cpp +++ b/isa/decode.cpp @@ -331,7 +331,8 @@ instruction_context decode(std::uint_fast32_t flags, unsigned int pc, unsigned i if (cma) ctx.acc = ~ctx.acc.value() & 07777; if (cml) ctx.link = !ctx.link.value(); if (iac) { - if (++ctx.acc.value() == 0) ctx.link = !ctx.link.value(); + ctx.acc = (ctx.acc.value() + 1) & 07777; + if (ctx.acc.value() == 0) ctx.link = !ctx.link.value(); } if (rar && !ral) { unsigned int x = (ctx.link.value() << 12) | ctx.acc.value(); -- cgit v1.2.3