From 555250dbd92da578494d3363da82ba491abb822a Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 17 Oct 2022 22:19:35 -0400 Subject: [PATCH] Don't trample on X before use. --- .../M68k/Implementation/PerformImplementation.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/InstructionSets/M68k/Implementation/PerformImplementation.hpp b/InstructionSets/M68k/Implementation/PerformImplementation.hpp index 40e024307..88d0af4e6 100644 --- a/InstructionSets/M68k/Implementation/PerformImplementation.hpp +++ b/InstructionSets/M68k/Implementation/PerformImplementation.hpp @@ -435,20 +435,22 @@ template void rox( } else { switch(operation) { case Operation::ROXLb: case Operation::ROXLw: case Operation::ROXLl: - status.carry_flag = status.extend_flag = Status::FlagT((destination >> (size - shift)) & 1); + status.carry_flag = Status::FlagT((destination >> (size - shift)) & 1); destination = IntT( (destination << shift) | (IntT(status.extend_flag ? 1 : 0) << (shift - 1)) | (destination >> (size + 1 - shift)) ); + status.extend_flag = status.carry_flag; break; case Operation::ROXRb: case Operation::ROXRw: case Operation::ROXRl: - status.carry_flag = status.extend_flag = Status::FlagT(destination & (1 << (shift - 1))); + status.carry_flag = Status::FlagT(destination & (1 << (shift - 1))); destination = IntT( (destination >> shift) | ((status.extend_flag ? top_bit() : 0) >> (shift - 1)) | (destination << (size + 1 - shift)) ); + status.extend_flag = status.carry_flag; break; } }