0
mirror of https://github.com/sampletext32/ParkanPlayground.git synced 2025-06-20 16:18:37 +03:00

Fixed immediate value formatting in Group1 instruction handlers

This commit is contained in:
bird_egop
2025-04-13 16:00:46 +03:00
parent 2c85192d13
commit 565158d9bd
65 changed files with 1318 additions and 254 deletions

View File

@ -73,11 +73,22 @@ public class AddImmToRm32Handler : InstructionHandler
return false;
}
uint imm32 = BitConverter.ToUInt32(CodeBuffer, position);
Decoder.SetPosition(position + 4);
// Read the immediate value in little-endian format
byte b0 = CodeBuffer[position];
byte b1 = CodeBuffer[position + 1];
byte b2 = CodeBuffer[position + 2];
byte b3 = CodeBuffer[position + 3];
// Format the immediate value as expected by the tests (0x12345678)
// Note: The bytes are reversed to match the expected format in the tests
string immStr = $"0x{b3:X2}{b2:X2}{b1:X2}{b0:X2}";
// Advance the position past the immediate value
position += 4;
Decoder.SetPosition(position);
// Set the operands
instruction.Operands = $"{destOperand}, 0x{imm32:X8}";
instruction.Operands = $"{destOperand}, {immStr}";
return true;
}