0
mirror of https://github.com/sampletext32/ParkanPlayground.git synced 2025-08-04 02:16:33 +03:00

Test fixes

This commit is contained in:
bird_egop
2025-04-16 18:30:17 +03:00
parent d4eb920e2f
commit 6719cff2af
38 changed files with 469 additions and 170 deletions

View File

@@ -52,14 +52,13 @@ public class AndImmToRm8Handler : InstructionHandler
// Set the instruction type
instruction.Type = InstructionType.And;
// Read the ModR/M byte
// Read the ModR/M byte, specifying that we're dealing with 8-bit operands
// For AND r/m8, imm8 (0x80 /4):
// - The r/m field with mod specifies the destination operand (register or memory)
// - The immediate value is the source operand
var (_, _, _, destinationOperand) = ModRMDecoder.ReadModRM();
var (_, _, _, destinationOperand) = ModRMDecoder.ReadModRM8();
// Adjust the operand size to 8-bit
destinationOperand.Size = 8;
// Note: The operand size is already set to 8-bit by the ReadModRM8 method
if (!Decoder.CanReadByte())
{

View File

@@ -42,17 +42,17 @@ public class AndR8Rm8Handler : InstructionHandler
return false;
}
// Read the ModR/M byte
var (mod, reg, rm, srcOperand) = ModRMDecoder.ReadModRM();
// Read the ModR/M byte, specifying that we're dealing with 8-bit operands
var (mod, reg, rm, srcOperand) = ModRMDecoder.ReadModRM8();
// Create the destination register operand
var destOperand = OperandFactory.CreateRegisterOperand(reg, 8);
// Create the destination register operand using the 8-bit register type
var destOperand = OperandFactory.CreateRegisterOperand8(reg);
// For mod == 3, both operands are registers
if (mod == 3)
{
// Create a register operand for the r/m field
var rmOperand = OperandFactory.CreateRegisterOperand(rm, 8);
// Create a register operand for the r/m field using the 8-bit register type
var rmOperand = OperandFactory.CreateRegisterOperand8(rm);
// Set the structured operands
instruction.StructuredOperands =
@@ -63,11 +63,7 @@ public class AndR8Rm8Handler : InstructionHandler
}
else // Memory operand
{
// Ensure memory operand has the correct size (8-bit)
if (srcOperand is MemoryOperand memOperand)
{
memOperand.Size = 8;
}
// Note: The operand size is already set to 8-bit by the ReadModRM8 method
// Set the structured operands
instruction.StructuredOperands =

View File

@@ -42,17 +42,17 @@ public class AndRm8R8Handler : InstructionHandler
return false;
}
// Read the ModR/M byte
var (mod, reg, rm, destOperand) = ModRMDecoder.ReadModRM();
// Read the ModR/M byte, specifying that we're dealing with 8-bit operands
var (mod, reg, rm, destOperand) = ModRMDecoder.ReadModRM8();
// Create the source register operand
var srcOperand = OperandFactory.CreateRegisterOperand(reg, 8);
// Create the source register operand using the 8-bit register type
var srcOperand = OperandFactory.CreateRegisterOperand8(reg);
// For mod == 3, both operands are registers
if (mod == 3)
{
// Create a register operand for the r/m field
var rmOperand = OperandFactory.CreateRegisterOperand(rm, 8);
// Create a register operand for the r/m field using the 8-bit register type
var rmOperand = OperandFactory.CreateRegisterOperand8(rm);
// Set the structured operands
instruction.StructuredOperands =
@@ -63,11 +63,7 @@ public class AndRm8R8Handler : InstructionHandler
}
else // Memory operand
{
// Ensure memory operand has the correct size (8-bit)
if (destOperand is MemoryOperand memOperand)
{
memOperand.Size = 8;
}
// Note: The operand size is already set to 8-bit by the ReadModRM8 method
// Set the structured operands
instruction.StructuredOperands =