mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-06-20 00:18:02 +03:00
more cleanup
This commit is contained in:
@ -36,8 +36,7 @@ public class SubImmFromRm16Handler : InstructionHandler
|
||||
}
|
||||
|
||||
// Check if the reg field is 5 (SUB)
|
||||
byte modRM = Decoder.PeakByte();
|
||||
byte reg = (byte)((modRM & 0x38) >> 3);
|
||||
var reg = ModRMDecoder.PeakModRMReg();
|
||||
|
||||
return reg == 5; // 5 = SUB
|
||||
}
|
||||
@ -63,7 +62,7 @@ public class SubImmFromRm16Handler : InstructionHandler
|
||||
// For SUB r/m16, imm16 (0x81 /5 with 0x66 prefix):
|
||||
// - The r/m field with mod specifies the destination operand (register or memory)
|
||||
// - The immediate value is the source operand
|
||||
var (mod, reg, rm, destinationOperand) = ModRMDecoder.ReadModRM();
|
||||
var (_, _, _, destinationOperand) = ModRMDecoder.ReadModRM();
|
||||
|
||||
// Adjust the operand size to 16-bit
|
||||
destinationOperand.Size = 16;
|
||||
|
@ -36,8 +36,7 @@ public class SubImmFromRm16SignExtendedHandler : InstructionHandler
|
||||
}
|
||||
|
||||
// Check if the reg field is 5 (SUB)
|
||||
byte modRM = Decoder.PeakByte();
|
||||
byte reg = (byte)((modRM & 0x38) >> 3);
|
||||
var reg = ModRMDecoder.PeakModRMReg();
|
||||
|
||||
return reg == 5; // 5 = SUB
|
||||
}
|
||||
@ -63,7 +62,7 @@ public class SubImmFromRm16SignExtendedHandler : InstructionHandler
|
||||
// For SUB r/m16, imm8 (0x83 /5 with 0x66 prefix and sign extension):
|
||||
// - The r/m field with mod specifies the destination operand (register or memory)
|
||||
// - The immediate value is the source operand (sign-extended from 8 to 16 bits)
|
||||
var (mod, reg, rm, destinationOperand) = ModRMDecoder.ReadModRM();
|
||||
var (_, _, _, destinationOperand) = ModRMDecoder.ReadModRM();
|
||||
|
||||
// Adjust the operand size to 16-bit
|
||||
destinationOperand.Size = 16;
|
||||
|
@ -30,8 +30,7 @@ public class SubImmFromRm32Handler : InstructionHandler
|
||||
if (!Decoder.CanReadByte())
|
||||
return false;
|
||||
|
||||
byte modRM = Decoder.PeakByte();
|
||||
byte reg = (byte) ((modRM & 0x38) >> 3);
|
||||
var reg = ModRMDecoder.PeakModRMReg();
|
||||
|
||||
return reg == 5; // 5 = SUB
|
||||
}
|
||||
@ -53,7 +52,7 @@ public class SubImmFromRm32Handler : InstructionHandler
|
||||
}
|
||||
|
||||
// Read the ModR/M byte
|
||||
var (mod, reg, rm, destinationOperand) = ModRMDecoder.ReadModRM();
|
||||
var (_, _, _, destinationOperand) = ModRMDecoder.ReadModRM();
|
||||
|
||||
// Read the immediate value
|
||||
if (!Decoder.CanReadUInt())
|
||||
|
@ -30,8 +30,7 @@ public class SubImmFromRm32SignExtendedHandler : InstructionHandler
|
||||
if (!Decoder.CanReadByte())
|
||||
return false;
|
||||
|
||||
byte modRM = Decoder.PeakByte();
|
||||
byte reg = (byte) ((modRM & 0x38) >> 3);
|
||||
var reg = ModRMDecoder.PeakModRMReg();
|
||||
|
||||
return reg == 5; // 5 = SUB
|
||||
}
|
||||
@ -54,7 +53,7 @@ public class SubImmFromRm32SignExtendedHandler : InstructionHandler
|
||||
}
|
||||
|
||||
// Extract the fields from the ModR/M byte
|
||||
var (mod, reg, rm, destinationOperand) = ModRMDecoder.ReadModRM();
|
||||
var (_, _, _, destinationOperand) = ModRMDecoder.ReadModRM();
|
||||
|
||||
// Check if we have enough bytes for the immediate value
|
||||
if (!Decoder.CanReadByte())
|
||||
|
@ -30,8 +30,7 @@ public class SubImmFromRm8Handler : InstructionHandler
|
||||
if (!Decoder.CanReadByte())
|
||||
return false;
|
||||
|
||||
byte modRM = Decoder.PeakByte();
|
||||
byte reg = (byte) ((modRM & 0x38) >> 3);
|
||||
var reg = ModRMDecoder.PeakModRMReg();
|
||||
|
||||
return reg == 5; // 5 = SUB
|
||||
}
|
||||
@ -48,7 +47,7 @@ public class SubImmFromRm8Handler : InstructionHandler
|
||||
instruction.Type = InstructionType.Sub;
|
||||
|
||||
// Read the ModR/M byte, specifying that we're dealing with 8-bit operands
|
||||
var (mod, reg, rm, destinationOperand) = ModRMDecoder.ReadModRM8();
|
||||
var (_, _, _, destinationOperand) = ModRMDecoder.ReadModRM8();
|
||||
|
||||
// Ensure the destination operand has the correct size (8-bit)
|
||||
destinationOperand.Size = 8;
|
||||
|
@ -44,7 +44,7 @@ public class SubR16Rm16Handler : InstructionHandler
|
||||
}
|
||||
|
||||
// Read the ModR/M byte
|
||||
var (mod, reg, rm, sourceOperand) = ModRMDecoder.ReadModRM();
|
||||
var (_, reg, _, sourceOperand) = ModRMDecoder.ReadModRM();
|
||||
|
||||
// Ensure the source operand has the correct size (16-bit)
|
||||
sourceOperand.Size = 16;
|
||||
|
@ -40,7 +40,7 @@ public class SubR32Rm32Handler : InstructionHandler
|
||||
}
|
||||
|
||||
// Read the ModR/M byte
|
||||
var (mod, reg, rm, sourceOperand) = ModRMDecoder.ReadModRM();
|
||||
var (_, reg, _, sourceOperand) = ModRMDecoder.ReadModRM();
|
||||
|
||||
// Set the instruction type
|
||||
instruction.Type = InstructionType.Sub;
|
||||
|
@ -43,7 +43,7 @@ public class SubR8Rm8Handler : InstructionHandler
|
||||
}
|
||||
|
||||
// Read the ModR/M byte, specifying that we're dealing with 8-bit operands
|
||||
var (mod, reg, rm, sourceOperand) = ModRMDecoder.ReadModRM8();
|
||||
var (_, reg, _, sourceOperand) = ModRMDecoder.ReadModRM8();
|
||||
|
||||
// Ensure the source operand has the correct size (8-bit)
|
||||
sourceOperand.Size = 8;
|
||||
|
@ -44,7 +44,7 @@ public class SubRm16R16Handler : InstructionHandler
|
||||
}
|
||||
|
||||
// Read the ModR/M byte
|
||||
var (mod, reg, rm, destinationOperand) = ModRMDecoder.ReadModRM();
|
||||
var (_, reg, _, destinationOperand) = ModRMDecoder.ReadModRM();
|
||||
|
||||
// Ensure the destination operand has the correct size (16-bit)
|
||||
destinationOperand.Size = 16;
|
||||
|
@ -43,7 +43,7 @@ public class SubRm32R32Handler : InstructionHandler
|
||||
instruction.Type = InstructionType.Sub;
|
||||
|
||||
// Read the ModR/M byte
|
||||
var (mod, reg, rm, destinationOperand) = ModRMDecoder.ReadModRM();
|
||||
var (_, reg, _, destinationOperand) = ModRMDecoder.ReadModRM();
|
||||
|
||||
// Create the source register operand (32-bit)
|
||||
var sourceOperand = OperandFactory.CreateRegisterOperand((RegisterIndex)reg, 32);
|
||||
|
@ -38,7 +38,7 @@ public class SubRm8R8Handler : InstructionHandler
|
||||
instruction.Type = InstructionType.Sub;
|
||||
|
||||
// Read the ModR/M byte, specifying that we're dealing with 8-bit operands
|
||||
var (mod, reg, rm, destinationOperand) = ModRMDecoder.ReadModRM8();
|
||||
var (_, reg, _, destinationOperand) = ModRMDecoder.ReadModRM8();
|
||||
|
||||
// Ensure the destination operand has the correct size (8-bit)
|
||||
destinationOperand.Size = 8;
|
||||
|
Reference in New Issue
Block a user