0
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:
bird_egop
2025-04-16 01:10:33 +03:00
parent 46592d4877
commit e06ea2beb3
12 changed files with 148 additions and 53 deletions

View File

@ -51,7 +51,7 @@ public class AddR8Rm8Handler : InstructionHandler
var (_, reg, _, sourceOperand) = ModRMDecoder.ReadModRM8();
// Create the destination register operand
var destinationOperand = OperandFactory.CreateRegisterOperand(reg, 8);
var destinationOperand = OperandFactory.CreateRegisterOperand8(reg);
// Set the structured operands
instruction.StructuredOperands =

View File

@ -50,9 +50,8 @@ public class AddRm8R8Handler : InstructionHandler
// - The r/m field with mod specifies the destination operand (register or memory)
var (_, reg, _, destinationOperand) = ModRMDecoder.ReadModRM8();
// Create the source register operand
// For high registers, we need to set the IsHighRegister flag
var sourceOperand = OperandFactory.CreateRegisterOperand(reg, 8);
// Create the source register operand using the 8-bit register type
var sourceOperand = OperandFactory.CreateRegisterOperand8(reg);
// Set the structured operands
instruction.StructuredOperands =

View File

@ -56,8 +56,8 @@ public class OrRm8R8Handler : InstructionHandler
// Adjust the operand size to 8-bit
destinationOperand.Size = 8;
// Create the source register operand (8-bit)
var sourceOperand = OperandFactory.CreateRegisterOperand(reg, 8);
// Create the source register operand using the 8-bit register type
var sourceOperand = OperandFactory.CreateRegisterOperand8(reg);
// Set the structured operands
instruction.StructuredOperands =

View File

@ -48,8 +48,8 @@ public class SubR8Rm8Handler : InstructionHandler
// Ensure the source operand has the correct size (8-bit)
sourceOperand.Size = 8;
// Create the destination register operand
var destinationOperand = OperandFactory.CreateRegisterOperand(reg, 8);
// Create the destination register operand using the 8-bit register type
var destinationOperand = OperandFactory.CreateRegisterOperand8(reg);
// Set the structured operands
instruction.StructuredOperands =

View File

@ -43,8 +43,8 @@ public class SubRm8R8Handler : InstructionHandler
// Ensure the destination operand has the correct size (8-bit)
destinationOperand.Size = 8;
// Create the source register operand
var sourceOperand = OperandFactory.CreateRegisterOperand(reg, 8);
// Create the source register operand using the 8-bit register type
var sourceOperand = OperandFactory.CreateRegisterOperand8(reg);
// Set the structured operands
instruction.StructuredOperands =

View File

@ -49,14 +49,14 @@ public class TestRegMem8Handler : InstructionHandler
// Ensure the destination operand has the correct size (8-bit)
destOperand.Size = 8;
// Create the register operand for the reg field (8-bit)
var regOperand = OperandFactory.CreateRegisterOperand(reg, 8);
// Create the register operand for the reg field using the 8-bit register type
var regOperand = OperandFactory.CreateRegisterOperand8(reg);
// Set the structured operands based on addressing mode
if (mod == 3) // Direct register addressing
{
// Create the register operand for the r/m field (8-bit)
var rmOperand = OperandFactory.CreateRegisterOperand(rm, 8);
// Create the register operand for the r/m field using the 8-bit register type
var rmOperand = OperandFactory.CreateRegisterOperand8(rm);
// Set the structured operands
instruction.StructuredOperands =

View File

@ -43,8 +43,8 @@ public class XorR8Rm8Handler : InstructionHandler
// Ensure the source operand has the correct size (8-bit)
sourceOperand.Size = 8;
// Create the destination register operand
var destinationOperand = OperandFactory.CreateRegisterOperand(reg, 8);
// Create the destination register operand using the 8-bit register type
var destinationOperand = OperandFactory.CreateRegisterOperand8(reg);
// Set the structured operands
instruction.StructuredOperands =

View File

@ -43,8 +43,8 @@ public class XorRm8R8Handler : InstructionHandler
// Ensure the destination operand has the correct size (8-bit)
destinationOperand.Size = 8;
// Create the source register operand
var sourceOperand = OperandFactory.CreateRegisterOperand(reg, 8);
// Create the source register operand using the 8-bit register type
var sourceOperand = OperandFactory.CreateRegisterOperand8(reg);
// Set the structured operands
instruction.StructuredOperands =