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

@ -30,8 +30,7 @@ public class DivRm32Handler : InstructionHandler
if (!Decoder.CanReadByte())
return false;
byte modRM = Decoder.PeakByte();
byte reg = (byte) ((modRM & 0x38) >> 3);
var reg = ModRMDecoder.PeakModRMReg();
return reg == 6; // 6 = DIV
}
@ -55,7 +54,7 @@ public class DivRm32Handler : InstructionHandler
// Read the ModR/M byte
// For DIV r/m32 (0xF7 /6):
// - The r/m field with mod specifies the operand (register or memory)
var (mod, reg, rm, operand) = ModRMDecoder.ReadModRM();
var (_, reg, _, operand) = ModRMDecoder.ReadModRM();
// Verify this is a DIV instruction
// The reg field should be 6 (DIV), which maps to RegisterIndex.Si in our enum

View File

@ -30,8 +30,7 @@ public class IdivRm32Handler : InstructionHandler
if (!Decoder.CanReadByte())
return false;
byte modRM = Decoder.PeakByte();
byte reg = (byte) ((modRM & 0x38) >> 3);
var reg = ModRMDecoder.PeakModRMReg();
return reg == 7; // 7 = IDIV
}
@ -55,7 +54,7 @@ public class IdivRm32Handler : InstructionHandler
// Read the ModR/M byte
// For IDIV r/m32 (0xF7 /7):
// - The r/m field with mod specifies the operand (register or memory)
var (mod, reg, rm, operand) = ModRMDecoder.ReadModRM();
var (_, reg, _, operand) = ModRMDecoder.ReadModRM();
// Verify this is an IDIV instruction
// The reg field should be 7 (IDIV)

View File

@ -30,8 +30,7 @@ public class ImulRm32Handler : InstructionHandler
if (!Decoder.CanReadByte())
return false;
byte modRM = Decoder.PeakByte();
byte reg = (byte) ((modRM & 0x38) >> 3);
var reg = ModRMDecoder.PeakModRMReg();
return reg == 5; // 5 = IMUL
}
@ -55,7 +54,7 @@ public class ImulRm32Handler : InstructionHandler
// Read the ModR/M byte
// For IMUL r/m32 (0xF7 /5):
// - The r/m field with mod specifies the operand (register or memory)
var (mod, reg, rm, operand) = ModRMDecoder.ReadModRM();
var (_, reg, _, operand) = ModRMDecoder.ReadModRM();
// Verify this is an IMUL instruction
// The reg field should be 5 (IMUL), which maps to RegisterIndex.Bp in our enum

View File

@ -30,8 +30,7 @@ public class MulRm32Handler : InstructionHandler
if (!Decoder.CanReadByte())
return false;
byte modRM = Decoder.PeakByte();
byte reg = (byte) ((modRM & 0x38) >> 3);
var reg = ModRMDecoder.PeakModRMReg();
return reg == 4; // 4 = MUL
}
@ -55,7 +54,7 @@ public class MulRm32Handler : InstructionHandler
// Read the ModR/M byte
// For MUL r/m32 (0xF7 /4):
// - The r/m field with mod specifies the operand (register or memory)
var (mod, reg, rm, operand) = ModRMDecoder.ReadModRM();
var (_, reg, _, operand) = ModRMDecoder.ReadModRM();
// Verify this is a MUL instruction
// The reg field should be 4 (MUL), which maps to RegisterIndex.Sp in our enum

View File

@ -30,8 +30,7 @@ public class NegRm32Handler : InstructionHandler
if (!Decoder.CanReadByte())
return false;
byte modRM = Decoder.PeakByte();
byte reg = (byte) ((modRM & 0x38) >> 3);
var reg = ModRMDecoder.PeakModRMReg();
return reg == 3; // 3 = NEG
}
@ -55,7 +54,7 @@ public class NegRm32Handler : InstructionHandler
// Read the ModR/M byte
// For NEG r/m32 (0xF7 /3):
// - The r/m field with mod specifies the operand (register or memory)
var (mod, reg, rm, operand) = ModRMDecoder.ReadModRM();
var (_, reg, _, operand) = ModRMDecoder.ReadModRM();
// Verify this is a NEG instruction
// The reg field should be 3 (NEG), which maps to RegisterIndex.B in our enum

View File

@ -31,8 +31,7 @@ public class NotRm32Handler : InstructionHandler
if (!Decoder.CanReadByte())
return false;
byte modRM = Decoder.PeakByte();
byte reg = (byte) ((modRM & 0x38) >> 3);
var reg = ModRMDecoder.PeakModRMReg();
return reg == 2; // 2 = NOT
}
@ -56,7 +55,7 @@ public class NotRm32Handler : InstructionHandler
// Read the ModR/M byte
// For NOT r/m32 (0xF7 /2):
// - The r/m field with mod specifies the operand (register or memory)
var (mod, reg, rm, operand) = ModRMDecoder.ReadModRM();
var (_, reg, _, operand) = ModRMDecoder.ReadModRM();
// Verify this is a NOT instruction
// The reg field should be 2 (NOT), which maps to RegisterIndex.D in our enum