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

simplify reading logic

This commit is contained in:
bird_egop
2025-04-13 23:22:30 +03:00
parent 0ea3294c61
commit 00547ed273
13 changed files with 31 additions and 79 deletions

View File

@ -50,18 +50,14 @@ public class AddR32Rm32Handler : InstructionHandler
// Get the register name
string regName = ModRMDecoder.GetRegisterName(reg, 32);
// For memory operands, set the operand
if (mod != 3) // Memory operand
if (mod == 3)
{
string operand = ModRMDecoder.DecodeModRM(mod, rm, false);
instruction.Operands = $"{regName}, {operand}";
}
else // Register operand
{
string rmName = ModRMDecoder.GetRegisterName(rm, 32);
instruction.Operands = $"{regName}, {rmName}";
// Register operand
destOperand = ModRMDecoder.GetRegisterName(rm, 32);
}
instruction.Operands = $"{regName}, {destOperand}";
return true;
}
}
}