mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-06-20 16:18:37 +03:00
move handlers, remove bases
This commit is contained in:
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group1;
|
||||
/// <summary>
|
||||
/// Handler for ADC r/m32, imm32 instruction (0x81 /2)
|
||||
/// </summary>
|
||||
public class AdcImmToRm32Handler : Group1BaseHandler
|
||||
public class AdcImmToRm32Handler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the AdcImmToRm32Handler class
|
||||
@ -65,7 +65,7 @@ public class AdcImmToRm32Handler : Group1BaseHandler
|
||||
byte rm = (byte)(modRM & 0x07);
|
||||
|
||||
// Decode the destination operand
|
||||
string destOperand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
string destOperand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
|
||||
// Read the immediate value
|
||||
if (position + 3 >= Length)
|
||||
|
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group1;
|
||||
/// <summary>
|
||||
/// Handler for ADC r/m32, imm8 (sign-extended) instruction (0x83 /2)
|
||||
/// </summary>
|
||||
public class AdcImmToRm32SignExtendedHandler : Group1BaseHandler
|
||||
public class AdcImmToRm32SignExtendedHandler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the AdcImmToRm32SignExtendedHandler class
|
||||
@ -65,7 +65,7 @@ public class AdcImmToRm32SignExtendedHandler : Group1BaseHandler
|
||||
byte rm = (byte)(modRM & 0x07);
|
||||
|
||||
// Decode the destination operand
|
||||
string destOperand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
string destOperand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
|
||||
// Read the immediate value (sign-extended from 8 to 32 bits)
|
||||
if (position >= Length)
|
||||
|
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group1;
|
||||
/// <summary>
|
||||
/// Handler for ADD r/m32, imm32 instruction (0x81 /0)
|
||||
/// </summary>
|
||||
public class AddImmToRm32Handler : Group1BaseHandler
|
||||
public class AddImmToRm32Handler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the AddImmToRm32Handler class
|
||||
@ -65,7 +65,7 @@ public class AddImmToRm32Handler : Group1BaseHandler
|
||||
byte rm = (byte)(modRM & 0x07);
|
||||
|
||||
// Decode the destination operand
|
||||
string destOperand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
string destOperand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
|
||||
// Read the immediate value
|
||||
if (position + 3 >= Length)
|
||||
|
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group1;
|
||||
/// <summary>
|
||||
/// Handler for ADD r/m32, imm8 (sign-extended) instruction (0x83 /0)
|
||||
/// </summary>
|
||||
public class AddImmToRm32SignExtendedHandler : Group1BaseHandler
|
||||
public class AddImmToRm32SignExtendedHandler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the AddImmToRm32SignExtendedHandler class
|
||||
@ -65,7 +65,7 @@ public class AddImmToRm32SignExtendedHandler : Group1BaseHandler
|
||||
byte rm = (byte)(modRM & 0x07);
|
||||
|
||||
// Decode the destination operand
|
||||
string destOperand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
string destOperand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
|
||||
// Read the immediate value
|
||||
if (position >= Length)
|
||||
|
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group1;
|
||||
/// <summary>
|
||||
/// Handler for ADD r/m8, imm8 instruction (0x80 /0)
|
||||
/// </summary>
|
||||
public class AddImmToRm8Handler : Group1BaseHandler
|
||||
public class AddImmToRm8Handler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the AddImmToRm8Handler class
|
||||
@ -73,7 +73,7 @@ public class AddImmToRm8Handler : Group1BaseHandler
|
||||
else
|
||||
{
|
||||
// Use ModR/M decoder for memory addressing
|
||||
destOperand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
destOperand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
}
|
||||
|
||||
Decoder.SetPosition(position);
|
||||
|
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group1;
|
||||
/// <summary>
|
||||
/// Handler for AND r/m32, imm32 instruction (0x81 /4)
|
||||
/// </summary>
|
||||
public class AndImmWithRm32Handler : Group1BaseHandler
|
||||
public class AndImmWithRm32Handler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the AndImmWithRm32Handler class
|
||||
@ -65,7 +65,7 @@ public class AndImmWithRm32Handler : Group1BaseHandler
|
||||
byte rm = (byte)(modRM & 0x07);
|
||||
|
||||
// Decode the destination operand
|
||||
string destOperand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
string destOperand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
|
||||
// Read the immediate value
|
||||
if (position + 3 >= Length)
|
||||
|
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group1;
|
||||
/// <summary>
|
||||
/// Handler for AND r/m32, imm8 (sign-extended) instruction (0x83 /4)
|
||||
/// </summary>
|
||||
public class AndImmWithRm32SignExtendedHandler : Group1BaseHandler
|
||||
public class AndImmWithRm32SignExtendedHandler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the AndImmWithRm32SignExtendedHandler class
|
||||
@ -65,7 +65,7 @@ public class AndImmWithRm32SignExtendedHandler : Group1BaseHandler
|
||||
byte rm = (byte)(modRM & 0x07);
|
||||
|
||||
// Decode the destination operand
|
||||
string destOperand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
string destOperand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
|
||||
// Read the immediate value (sign-extended from 8 to 32 bits)
|
||||
if (position >= Length)
|
||||
|
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group1;
|
||||
/// <summary>
|
||||
/// Handler for CMP r/m32, imm32 instruction (0x81 /7)
|
||||
/// </summary>
|
||||
public class CmpImmWithRm32Handler : Group1BaseHandler
|
||||
public class CmpImmWithRm32Handler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CmpImmWithRm32Handler class
|
||||
@ -65,7 +65,7 @@ public class CmpImmWithRm32Handler : Group1BaseHandler
|
||||
byte rm = (byte)(modRM & 0x07);
|
||||
|
||||
// Decode the destination operand
|
||||
string destOperand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
string destOperand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
|
||||
// Read the immediate value
|
||||
if (position + 3 >= Length)
|
||||
|
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group1;
|
||||
/// <summary>
|
||||
/// Handler for CMP r/m32, imm8 (sign-extended) instruction (0x83 /7)
|
||||
/// </summary>
|
||||
public class CmpImmWithRm32SignExtendedHandler : Group1BaseHandler
|
||||
public class CmpImmWithRm32SignExtendedHandler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CmpImmWithRm32SignExtendedHandler class
|
||||
@ -65,7 +65,7 @@ public class CmpImmWithRm32SignExtendedHandler : Group1BaseHandler
|
||||
byte rm = (byte)(modRM & 0x07);
|
||||
|
||||
// Decode the destination operand
|
||||
string destOperand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
string destOperand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
|
||||
// Read the immediate value
|
||||
if (position >= Length)
|
||||
|
@ -1,44 +0,0 @@
|
||||
namespace X86Disassembler.X86.Handlers.Group1;
|
||||
|
||||
/// <summary>
|
||||
/// Base class for Group 1 instruction handlers (ADD, OR, ADC, SBB, AND, SUB, XOR, CMP)
|
||||
/// </summary>
|
||||
public abstract class Group1BaseHandler : InstructionHandler
|
||||
{
|
||||
// ModR/M decoder
|
||||
protected readonly ModRMDecoder _modRMDecoder;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the Group1BaseHandler class
|
||||
/// </summary>
|
||||
/// <param name="codeBuffer">The buffer containing the code to decode</param>
|
||||
/// <param name="decoder">The instruction decoder that owns this handler</param>
|
||||
/// <param name="length">The length of the buffer</param>
|
||||
protected Group1BaseHandler(byte[] codeBuffer, InstructionDecoder decoder, int length)
|
||||
: base(codeBuffer, decoder, length)
|
||||
{
|
||||
_modRMDecoder = new ModRMDecoder(codeBuffer, decoder, length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the 32-bit register name for the given register index
|
||||
/// </summary>
|
||||
/// <param name="reg">The register index</param>
|
||||
/// <returns>The register name</returns>
|
||||
protected static string GetRegister32(byte reg)
|
||||
{
|
||||
string[] registerNames = { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi" };
|
||||
return registerNames[reg & 0x07];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the 8-bit register name for the given register index
|
||||
/// </summary>
|
||||
/// <param name="reg">The register index</param>
|
||||
/// <returns>The register name</returns>
|
||||
protected static string GetRegister8(byte reg)
|
||||
{
|
||||
string[] registerNames = { "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh" };
|
||||
return registerNames[reg & 0x07];
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group1;
|
||||
/// <summary>
|
||||
/// Handler for OR r/m32, imm32 instruction (0x81 /1)
|
||||
/// </summary>
|
||||
public class OrImmToRm32Handler : Group1BaseHandler
|
||||
public class OrImmToRm32Handler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the OrImmToRm32Handler class
|
||||
@ -65,7 +65,7 @@ public class OrImmToRm32Handler : Group1BaseHandler
|
||||
byte rm = (byte)(modRM & 0x07);
|
||||
|
||||
// Decode the destination operand
|
||||
string destOperand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
string destOperand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
|
||||
// Read the immediate value
|
||||
if (position + 3 >= Length)
|
||||
|
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group1;
|
||||
/// <summary>
|
||||
/// Handler for OR r/m32, imm8 (sign-extended) instruction (0x83 /1)
|
||||
/// </summary>
|
||||
public class OrImmToRm32SignExtendedHandler : Group1BaseHandler
|
||||
public class OrImmToRm32SignExtendedHandler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the OrImmToRm32SignExtendedHandler class
|
||||
@ -65,7 +65,7 @@ public class OrImmToRm32SignExtendedHandler : Group1BaseHandler
|
||||
byte rm = (byte)(modRM & 0x07);
|
||||
|
||||
// Decode the destination operand
|
||||
string destOperand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
string destOperand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
|
||||
// Read the immediate value (sign-extended from 8 to 32 bits)
|
||||
if (position >= Length)
|
||||
|
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group1;
|
||||
/// <summary>
|
||||
/// Handler for OR r/m8, imm8 instruction (0x80 /1)
|
||||
/// </summary>
|
||||
public class OrImmToRm8Handler : Group1BaseHandler
|
||||
public class OrImmToRm8Handler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the OrImmToRm8Handler class
|
||||
@ -73,7 +73,7 @@ public class OrImmToRm8Handler : Group1BaseHandler
|
||||
else
|
||||
{
|
||||
// Use ModR/M decoder for memory addressing
|
||||
destOperand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
destOperand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
}
|
||||
|
||||
Decoder.SetPosition(position);
|
||||
|
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group1;
|
||||
/// <summary>
|
||||
/// Handler for SBB r/m32, imm32 instruction (0x81 /3)
|
||||
/// </summary>
|
||||
public class SbbImmFromRm32Handler : Group1BaseHandler
|
||||
public class SbbImmFromRm32Handler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the SbbImmFromRm32Handler class
|
||||
@ -65,7 +65,7 @@ public class SbbImmFromRm32Handler : Group1BaseHandler
|
||||
byte rm = (byte)(modRM & 0x07);
|
||||
|
||||
// Decode the destination operand
|
||||
string destOperand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
string destOperand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
|
||||
// Read the immediate value
|
||||
if (position + 3 >= Length)
|
||||
|
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group1;
|
||||
/// <summary>
|
||||
/// Handler for SBB r/m32, imm8 (sign-extended) instruction (0x83 /3)
|
||||
/// </summary>
|
||||
public class SbbImmFromRm32SignExtendedHandler : Group1BaseHandler
|
||||
public class SbbImmFromRm32SignExtendedHandler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the SbbImmFromRm32SignExtendedHandler class
|
||||
@ -65,7 +65,7 @@ public class SbbImmFromRm32SignExtendedHandler : Group1BaseHandler
|
||||
byte rm = (byte)(modRM & 0x07);
|
||||
|
||||
// Decode the destination operand
|
||||
string destOperand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
string destOperand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
|
||||
// Read the immediate value (sign-extended from 8 to 32 bits)
|
||||
if (position >= Length)
|
||||
|
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group1;
|
||||
/// <summary>
|
||||
/// Handler for SUB r/m32, imm32 instruction (0x81 /5)
|
||||
/// </summary>
|
||||
public class SubImmFromRm32Handler : Group1BaseHandler
|
||||
public class SubImmFromRm32Handler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the SubImmFromRm32Handler class
|
||||
@ -65,7 +65,7 @@ public class SubImmFromRm32Handler : Group1BaseHandler
|
||||
byte rm = (byte)(modRM & 0x07);
|
||||
|
||||
// Decode the destination operand
|
||||
string destOperand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
string destOperand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
|
||||
// Read the immediate value
|
||||
if (position + 3 >= Length)
|
||||
|
@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.Group1;
|
||||
/// <summary>
|
||||
/// Handler for SUB r/m32, imm8 (sign-extended) instruction (0x83 /5)
|
||||
/// </summary>
|
||||
public class SubImmFromRm32SignExtendedHandler : Group1BaseHandler
|
||||
public class SubImmFromRm32SignExtendedHandler : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the SubImmFromRm32SignExtendedHandler class
|
||||
@ -65,7 +65,7 @@ public class SubImmFromRm32SignExtendedHandler : Group1BaseHandler
|
||||
byte rm = (byte)(modRM & 0x07);
|
||||
|
||||
// Decode the destination operand
|
||||
string destOperand = _modRMDecoder.DecodeModRM(mod, rm, false);
|
||||
string destOperand = ModRMDecoder.DecodeModRM(mod, rm, false);
|
||||
|
||||
// Read the immediate value
|
||||
if (position >= Length)
|
||||
|
Reference in New Issue
Block a user