namespace X86Disassembler.X86.Handlers.Stack;
///
/// Handler for POPAD instruction (0x61)
/// Pops all general-purpose registers from the stack in the order: EDI, ESI, EBP, ESP (ignored), EBX, EDX, ECX, EAX
///
public class PopadHandler : InstructionHandler
{
///
/// Initializes a new instance of the PopadHandler class
///
/// The instruction decoder that owns this handler
public PopadHandler(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)
{
// POPAD is 0x61
return opcode == 0x61;
}
///
/// Decodes a POPAD 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)
{
// Set the instruction type
instruction.Type = InstructionType.Popad;
// POPAD has no operands
instruction.StructuredOperands = [];
return true;
}
}