mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-06-20 00:18:02 +03:00
Refactored register operands to separate 8-bit registers into dedicated Register8Operand class
This commit is contained in:
@ -16,6 +16,17 @@ public static class OperandFactory
|
||||
return new RegisterOperand(register, size);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an 8-bit register operand using RegisterIndex8 enum
|
||||
/// </summary>
|
||||
/// <param name="register8">The 8-bit register</param>
|
||||
/// <returns>A register operand for 8-bit registers</returns>
|
||||
public static Register8Operand CreateRegisterOperand8(RegisterIndex8 register8)
|
||||
{
|
||||
// Create a new Register8Operand with the 8-bit register
|
||||
return new Register8Operand(register8);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an immediate value operand
|
||||
/// </summary>
|
||||
|
31
X86Disassembler/X86/Operands/Register8Operand.cs
Normal file
31
X86Disassembler/X86/Operands/Register8Operand.cs
Normal file
@ -0,0 +1,31 @@
|
||||
namespace X86Disassembler.X86.Operands;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an 8-bit register operand in an x86 instruction
|
||||
/// </summary>
|
||||
public class Register8Operand : Operand
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the 8-bit register
|
||||
/// </summary>
|
||||
public RegisterIndex8 Register { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the Register8Operand class
|
||||
/// </summary>
|
||||
/// <param name="register">The 8-bit register</param>
|
||||
public Register8Operand(RegisterIndex8 register)
|
||||
{
|
||||
Type = OperandType.Register;
|
||||
Register = register;
|
||||
Size = 8; // Always 8 bits for this operand type
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a string representation of this operand
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return ModRMDecoder.GetRegisterName(Register);
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
namespace X86Disassembler.X86.Operands;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a register operand in an x86 instruction
|
||||
/// Represents a standard register operand (16/32/64-bit) in an x86 instruction
|
||||
/// </summary>
|
||||
public class RegisterOperand : Operand
|
||||
{
|
||||
@ -14,7 +14,7 @@ public class RegisterOperand : Operand
|
||||
/// Initializes a new instance of the RegisterOperand class
|
||||
/// </summary>
|
||||
/// <param name="register">The register</param>
|
||||
/// <param name="size">The size of the register in bits</param>
|
||||
/// <param name="size">The size of the register in bits (16, 32, or 64)</param>
|
||||
public RegisterOperand(RegisterIndex register, int size = 32)
|
||||
{
|
||||
Type = OperandType.Register;
|
||||
|
Reference in New Issue
Block a user