mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-06-20 08:18:36 +03:00
nice big refactor
This commit is contained in:
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.FloatingPoint;
|
||||
/// <summary>
|
||||
/// Handler for floating-point operations on float64 (DC opcode)
|
||||
/// </summary>
|
||||
public class Float64OperationHandler : FloatingPointBaseHandler
|
||||
public class Float64OperationHandler : InstructionHandler
|
||||
{
|
||||
// DC opcode - operations on float64
|
||||
private static readonly string[] Mnemonics =
|
||||
@ -55,27 +55,20 @@ public class Float64OperationHandler : FloatingPointBaseHandler
|
||||
}
|
||||
|
||||
// Read the ModR/M byte
|
||||
byte modRM = CodeBuffer[position++];
|
||||
Decoder.SetPosition(position);
|
||||
|
||||
// Extract the fields from the ModR/M byte
|
||||
byte mod = (byte)((modRM & 0xC0) >> 6);
|
||||
byte reg = (byte)((modRM & 0x38) >> 3);
|
||||
byte rm = (byte)(modRM & 0x07);
|
||||
var (mod, reg, rm, destOperand) = ModRMDecoder.ReadModRM(true); // true for 64-bit operand
|
||||
|
||||
// Set the mnemonic based on the opcode and reg field
|
||||
instruction.Mnemonic = Mnemonics[reg];
|
||||
instruction.Mnemonic = Mnemonics[(int)reg];
|
||||
|
||||
// For memory operands, set the operand
|
||||
if (mod != 3) // Memory operand
|
||||
{
|
||||
string operand = ModRMDecoder.DecodeModRM(mod, rm, true); // true for 64-bit operand
|
||||
instruction.Operands = operand;
|
||||
instruction.Operands = destOperand;
|
||||
}
|
||||
else // Register operand (ST(i))
|
||||
{
|
||||
// For DC C0-DC FF, the operands are reversed: ST(i), ST(0)
|
||||
instruction.Operands = $"st({rm}), st(0)";
|
||||
instruction.Operands = $"st({(int)rm}), st(0)";
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user