From 82c461307eba25265867f233a27060621ac6cba4 Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Mon, 31 Oct 2022 19:03:38 -0700 Subject: TAD is 12-bit addition with carry-complements-link, not 13-bit addition --- Bugs | 1 - isa/decode.cpp | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Bugs b/Bugs index 2681d88..a4a5ad9 100644 --- a/Bugs +++ b/Bugs @@ -1,2 +1 @@ -TAD should do AC+[mem] and invert the link bit if the result carries IF is used for same-page and zero-page memory accesses (including the first access of an indirect) diff --git a/isa/decode.cpp b/isa/decode.cpp index c35118b..af38c64 100644 --- a/isa/decode.cpp +++ b/isa/decode.cpp @@ -34,8 +34,8 @@ instruction_context decode(unsigned int dfifb, unsigned int pc, unsigned int bit inst.need_write_acc = true; inst.need_write_link = true; inst.ef = [](auto &ctx) { - unsigned int sum = (ctx.link.value() << 12) + ctx.acc.value() + ctx.data.value(); - ctx.link = (sum >> 12) & 1; + unsigned int sum = ctx.acc.value() + ctx.data.value(); + ctx.link = ctx.link.value() ^ (sum >> 12); ctx.acc = sum & 07777; }; break; -- cgit v1.2.3