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

nice big refactor

This commit is contained in:
bird_egop
2025-04-13 23:06:52 +03:00
parent 59df064ca4
commit 11a2cfada4
92 changed files with 981 additions and 1509 deletions

View File

@ -56,7 +56,27 @@ public class XorImmWithRm16SignExtendedHandler : InstructionHandler
}
// Read the ModR/M byte
var (mod, reg, rm, destOperand) = ModRMDecoder.ReadModRM();
var (mod, reg, rm, memOperand) = ModRMDecoder.ReadModRM();
// For the first operand, handle based on addressing mode
string rmOperand;
if (mod == 3) // Register addressing mode
{
// Get 16-bit register name for the operand
rmOperand = ModRMDecoder.GetRegisterName(rm, 16);
}
else // Memory addressing mode
{
// For memory operands, replace "dword ptr" with "word ptr"
if (memOperand.StartsWith("dword ptr "))
{
rmOperand = memOperand.Replace("dword ptr", "word ptr");
}
else
{
rmOperand = memOperand;
}
}
// Get the updated position after ModR/M decoding
position = Decoder.GetPosition();
@ -85,7 +105,7 @@ public class XorImmWithRm16SignExtendedHandler : InstructionHandler
}
// Set the operands
instruction.Operands = $"{destOperand}, {immStr}";
instruction.Operands = $"{rmOperand}, {immStr}";
return true;
}