From e4c0a89889b08c6ce363014ee24a9c9406976ecf Mon Sep 17 00:00:00 2001 From: Thomas Harte <thomas.harte@gmail.com> Date: Thu, 19 May 2022 15:01:09 -0400 Subject: [PATCH] Just use the four-bit register number directly. --- .../M68k/Implementation/ExecutorImplementation.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/InstructionSets/M68k/Implementation/ExecutorImplementation.hpp b/InstructionSets/M68k/Implementation/ExecutorImplementation.hpp index d42e3dda8..7a8f17b52 100644 --- a/InstructionSets/M68k/Implementation/ExecutorImplementation.hpp +++ b/InstructionSets/M68k/Implementation/ExecutorImplementation.hpp @@ -205,8 +205,8 @@ uint32_t Executor<model, BusHandler>::State::index_8bitdisplacement() { // also include the scale field even if not. const auto extension = read_pc<uint16_t>(); const auto offset = int8_t(extension); - const int register_index = (extension >> 12) & 7; - const uint32_t displacement = registers[register_index + ((extension >> 12) & 0x08)].l; + const int register_index = (extension >> 12) & 15; + const uint32_t displacement = registers[register_index].l; const uint32_t sized_displacement = (extension & 0x800) ? displacement : int16_t(displacement); return offset + sized_displacement; }