From a0f0f73bded586b991ec9b6fc6eccdd2861e68e6 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 7 Mar 2024 10:31:26 -0500 Subject: [PATCH] Fix MOV as unconditional branch. --- InstructionSets/ARM/Executor.hpp | 8 +++----- Machines/Acorn/Archimedes/Archimedes.cpp | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/InstructionSets/ARM/Executor.hpp b/InstructionSets/ARM/Executor.hpp index 806f95272..38e715120 100644 --- a/InstructionSets/ARM/Executor.hpp +++ b/InstructionSets/ARM/Executor.hpp @@ -184,10 +184,8 @@ struct Executor { // processor mode." if(fields.destination() == 15) { - if constexpr (is_comparison(flags.operation())) { - registers_.set_status(conditions); - } else { - registers_.set_status(pc_proxy); + registers_.set_status(conditions); + if constexpr (!is_comparison(flags.operation())) { registers_.set_pc(pc_proxy); } } else { @@ -201,7 +199,7 @@ struct Executor { } } else { // "If the S flag is clear when Rd is R15, only the 24 PC bits of R15 will be written." - if(fields.destination() == 15 && !is_logical(flags.operation())) { + if(fields.destination() == 15 && !is_comparison(flags.operation())) { registers_.set_pc(pc_proxy); } } diff --git a/Machines/Acorn/Archimedes/Archimedes.cpp b/Machines/Acorn/Archimedes/Archimedes.cpp index 1b128a2e4..f8b4f9a8d 100644 --- a/Machines/Acorn/Archimedes/Archimedes.cpp +++ b/Machines/Acorn/Archimedes/Archimedes.cpp @@ -572,7 +572,7 @@ class ConcreteMachine: // static bool log = false; // if(log) { -// logger.info().append("%08x: %08x", executor_.pc(), instruction); +// logger.info().append("%08x: %08x [r14:%08x]", executor_.pc(), instruction, executor_.registers()[14]); // } InstructionSet::ARM::execute(instruction, executor_); }