From 41939eeaf9850f8c0859292720ed3d8101e0e70c Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Mon, 13 Jun 2022 19:24:37 -0700 Subject: [PATCH] DSPDisassembler: Fix disassembly of LSR and ASR Before, both 1441 and 147f would disassemble as `lsr $acc0, #1`, when the second should be `lsr $acc0, #-1`, and both 14c1 and 14ff would be `asr $acc0, #1` when the second should be `asr $acc0, #-1`. I'm not entirely sure whether the minus signs actually make sense here, but this change is consistent with the assembler so that's an improvement at least. devkitPro previously changed the formatting to not require negative signs for lsr and asr; this is probably something we should do in the future: https://github.com/devkitPro/gamecube-tools/commit/8a65c85c9b4748ed3dab3c0c85aeb0df95d58cfb This fixes the HermesText and HermesBinary tests (HermesText already wrote `lsr $ACC0, #-5`, so this is consistent with what it used before.) --- Source/Core/Core/DSP/DSPDisassembler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Core/DSP/DSPDisassembler.cpp b/Source/Core/Core/DSP/DSPDisassembler.cpp index 91f9b8f593..6e833cdf16 100644 --- a/Source/Core/Core/DSP/DSPDisassembler.cpp +++ b/Source/Core/Core/DSP/DSPDisassembler.cpp @@ -108,7 +108,7 @@ std::string DSPDisassembler::DisassembleParameters(const DSPOPCTemplate& opc, u1 { // Left and right shifts function essentially as a single shift by a 7-bit signed value, // but are split into two intructions for clarity. - buf += fmt::format("#{}", (val & 0x20) != 0 ? (64 - val) : val); + buf += fmt::format("#{}", (val & 0x20) != 0 ? (int(val) - 64) : int(val)); } else {