namespace X86Disassembler.X86.Handlers.FloatingPoint.Comparison; using X86Disassembler.X86.Operands; /// /// Handler for FCOMPP instruction (DE D9) /// public class FcomppHandler : InstructionHandler { /// /// Initializes a new instance of the FcomppHandler class /// /// The instruction decoder that owns this handler public FcomppHandler(InstructionDecoder decoder) : base(decoder) { } /// /// Checks if this handler can decode the given opcode /// /// The opcode to check /// True if this handler can decode the opcode public override bool CanHandle(byte opcode) { // FCOMPP is DE D9 if (opcode != 0xDE) return false; if (!Decoder.CanReadByte()) { return false; } // Check if the ModR/M byte is exactly D9 (reg = 3, rm = 1, mod = 3) byte modRm = Decoder.PeakByte(); return modRm == 0xD9; } /// /// Decodes a FCOMPP instruction /// /// The opcode of the instruction /// The instruction object to populate /// True if the instruction was successfully decoded public override bool Decode(byte opcode, Instruction instruction) { if (!Decoder.CanReadByte()) { return false; } // Read the ModR/M byte var (mod, reg, rm, _) = ModRMDecoder.ReadModRM(); // Set the instruction type instruction.Type = InstructionType.Fcompp; // FCOMPP has no operands instruction.StructuredOperands = []; return true; } }