namespace X86Disassembler.X86.Handlers; /// /// Abstract base class for instruction handlers /// public abstract class InstructionHandler : IInstructionHandler { // The instruction decoder that owns this handler protected readonly InstructionDecoder Decoder; // ModRM decoder for handling addressing modes protected readonly ModRMDecoder ModRMDecoder; /// /// Initializes a new instance of the InstructionHandler class /// /// The instruction decoder that owns this handler protected InstructionHandler(InstructionDecoder decoder) { Decoder = decoder; ModRMDecoder = new ModRMDecoder(decoder); } /// /// Checks if this handler can decode the given opcode /// /// The opcode to check /// True if this handler can decode the opcode public abstract bool CanHandle(byte opcode); /// /// Decodes an instruction /// /// The opcode of the instruction /// The instruction object to populate /// True if the instruction was successfully decoded public abstract bool Decode(byte opcode, Instruction instruction); }