0
mirror of https://github.com/sampletext32/ParkanPlayground.git synced 2025-06-20 08:18:36 +03:00

more cleanup

This commit is contained in:
bird_egop
2025-04-15 02:42:47 +03:00
parent 49f1d7d221
commit abe4d38d4b
97 changed files with 160 additions and 219 deletions

View File

@ -1,6 +1,6 @@
namespace X86Disassembler.X86.Handlers.Cmp;
using X86Disassembler.X86.Operands;
using Operands;
/// <summary>
/// Handler for CMP AL, imm8 instruction (0x3C)

View File

@ -30,8 +30,7 @@ public class CmpImmWithRm32Handler : InstructionHandler
if (!Decoder.CanReadByte())
return false;
byte modRM = Decoder.PeakByte();
byte reg = (byte) ((modRM & 0x38) >> 3);
var reg = ModRMDecoder.PeakModRMReg();
return reg == 7; // 7 = CMP
}
@ -48,7 +47,7 @@ public class CmpImmWithRm32Handler : InstructionHandler
instruction.Type = InstructionType.Cmp;
// Read the ModR/M byte
var (mod, reg, rm, destinationOperand) = ModRMDecoder.ReadModRM();
var (_, _, _, destinationOperand) = ModRMDecoder.ReadModRM();
// Read the immediate value
if (!Decoder.CanReadUInt())

View File

@ -1,6 +1,6 @@
namespace X86Disassembler.X86.Handlers.Cmp;
using X86Disassembler.X86.Operands;
using Operands;
/// <summary>
/// Handler for CMP r/m32, imm8 (sign-extended) instruction (0x83 /7)
@ -30,8 +30,7 @@ public class CmpImmWithRm32SignExtendedHandler : InstructionHandler
if (!Decoder.CanReadByte())
return false;
byte modRM = Decoder.PeakByte();
byte reg = (byte) ((modRM & 0x38) >> 3);
var reg = ModRMDecoder.PeakModRMReg();
return reg == 7; // 7 = CMP
}
@ -53,7 +52,7 @@ public class CmpImmWithRm32SignExtendedHandler : InstructionHandler
}
// Read the ModR/M byte
var (mod, reg, rm, destOperand) = ModRMDecoder.ReadModRM();
var (_, _, _, destOperand) = ModRMDecoder.ReadModRM();
// Read the immediate value
if (!Decoder.CanReadByte())

View File

@ -30,8 +30,7 @@ public class CmpImmWithRm8Handler : InstructionHandler
if (!Decoder.CanReadByte())
return false;
byte modRM = Decoder.PeakByte();
byte reg = (byte) ((modRM & 0x38) >> 3);
var reg = ModRMDecoder.PeakModRMReg();
return reg == 7; // 7 = CMP
}
@ -48,7 +47,7 @@ public class CmpImmWithRm8Handler : InstructionHandler
instruction.Type = InstructionType.Cmp;
// Read the ModR/M byte
var (mod, reg, rm, destinationOperand) = ModRMDecoder.ReadModRM();
var (_, _, _, destinationOperand) = ModRMDecoder.ReadModRM();
// Ensure the destination operand has the correct size (8-bit)
destinationOperand.Size = 8;

View File

@ -43,7 +43,7 @@ public class CmpR32Rm32Handler : InstructionHandler
instruction.Type = InstructionType.Cmp;
// Read the ModR/M byte
var (mod, reg, rm, sourceOperand) = ModRMDecoder.ReadModRM();
var (_, reg, _, sourceOperand) = ModRMDecoder.ReadModRM();
// Create the destination register operand (32-bit)
var destinationOperand = OperandFactory.CreateRegisterOperand((RegisterIndex)reg, 32);

View File

@ -46,7 +46,7 @@ public class CmpRm32R32Handler : InstructionHandler
// For CMP r/m32, r32 (0x39):
// - The r/m field with mod specifies the destination operand (register or memory)
// - The reg field specifies the source register
var (mod, reg, rm, destinationOperand) = ModRMDecoder.ReadModRM();
var (_, reg, _, destinationOperand) = ModRMDecoder.ReadModRM();
// Create the source register operand
var sourceOperand = OperandFactory.CreateRegisterOperand(reg, 32);