From 3f6b5e337b282bd8675a97e048e267e6f90ccec6 Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Mon, 17 Oct 2022 17:54:53 -0700 Subject: Clean up address handling and change autoinc to preincrement --- isa/decode.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'isa/decode.cpp') diff --git a/isa/decode.cpp b/isa/decode.cpp index cb6a694..03e2225 100644 --- a/isa/decode.cpp +++ b/isa/decode.cpp @@ -252,7 +252,7 @@ instruction_context decode(unsigned int dfifb, unsigned int pc, unsigned int bit // Instructions with memory operands may be direct or indirect if (inst.need_exec_load || inst.need_exec_store || inst.possibly_redirects) { - auto addr = (df << 12) | ((bits & 00200) ? (inst.next_pc & 07600) : 0) | (bits & 00177); + auto addr = (df << 12) | ((bits & 00200) ? (pc & 07600) : 0) | (bits & 00177); if (bits & 00400) { inst.need_indirect_load = true; inst.init_address = addr; @@ -262,7 +262,7 @@ instruction_context decode(unsigned int dfifb, unsigned int pc, unsigned int bit } // Non-jump indirect memory operands may be autoincrementing depending on operand bits - if (!inst.possibly_redirects && inst.need_indirect_load && ((bits & 00170) == 00010)) + if (!inst.possibly_redirects && inst.need_indirect_load && ((inst.init_address.value() & 07770) == 00010)) inst.need_autoinc_store = true; return inst; -- cgit v1.2.3