mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-06-20 08:18:36 +03:00
broken tests
This commit is contained in:
@ -71,7 +71,18 @@ public class XorImmWithRm16SignExtendedHandler : InstructionHandler
|
||||
short imm16 = (sbyte)Decoder.ReadByte();
|
||||
|
||||
// Format the immediate value
|
||||
string immStr = $"0x{(ushort)imm16:X4}";
|
||||
// For 16-bit operations, we want to show the immediate value without leading zeros
|
||||
string immStr;
|
||||
if (imm16 < 0)
|
||||
{
|
||||
// For negative values, show the full sign-extended 16-bit value
|
||||
immStr = $"0x{(ushort)imm16:X}";
|
||||
}
|
||||
else
|
||||
{
|
||||
// For positive values, show without leading zeros
|
||||
immStr = $"0x{imm16:X}";
|
||||
}
|
||||
|
||||
// Set the operands
|
||||
instruction.Operands = $"{destOperand}, {immStr}";
|
||||
|
@ -58,6 +58,23 @@ public class XorImmWithRm8Handler : InstructionHandler
|
||||
// Read the ModR/M byte
|
||||
var (mod, reg, rm, destOperand) = ModRMDecoder.ReadModRM();
|
||||
|
||||
// Advance past the ModR/M byte
|
||||
Decoder.SetPosition(position + 1);
|
||||
|
||||
// If mod == 3, then the r/m field specifies a register
|
||||
if (mod == 3)
|
||||
{
|
||||
// Get the r/m register name (8-bit)
|
||||
destOperand = ModRMDecoder.GetRegisterName(rm, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
// For memory operands, use the ModRMDecoder to get the full operand string
|
||||
|
||||
// Replace "dword ptr" with "byte ptr" to indicate 8-bit operation
|
||||
destOperand = destOperand.Replace("dword ptr", "byte ptr");
|
||||
}
|
||||
|
||||
// Get the updated position after ModR/M decoding
|
||||
position = Decoder.GetPosition();
|
||||
|
||||
|
@ -45,13 +45,30 @@ public class XorR8Rm8Handler : InstructionHandler
|
||||
}
|
||||
|
||||
// Read the ModR/M byte
|
||||
var (mod, reg, rm, memOperand) = ModRMDecoder.ReadModRM();
|
||||
var (mod, reg, rm, destOperand) = ModRMDecoder.ReadModRM();
|
||||
|
||||
// Advance past the ModR/M byte
|
||||
Decoder.SetPosition(position + 1);
|
||||
|
||||
// Get register name
|
||||
// Get register name (8-bit)
|
||||
string regName = ModRMDecoder.GetRegisterName(reg, 8);
|
||||
|
||||
// If mod == 3, then the r/m field specifies a register
|
||||
if (mod == 3)
|
||||
{
|
||||
// Get the r/m register name (8-bit)
|
||||
string rmRegName = ModRMDecoder.GetRegisterName(rm, 8);
|
||||
|
||||
// Set the operands
|
||||
instruction.Operands = $"{regName}, {rmRegName}";
|
||||
return true;
|
||||
}
|
||||
|
||||
// Replace "dword ptr" with "byte ptr" to indicate 8-bit operation
|
||||
string byteOperand = destOperand.Replace("dword ptr", "byte ptr");
|
||||
|
||||
// Set the operands
|
||||
instruction.Operands = $"{regName}, {memOperand}";
|
||||
instruction.Operands = $"{regName}, {byteOperand}";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -45,13 +45,30 @@ public class XorRm8R8Handler : InstructionHandler
|
||||
}
|
||||
|
||||
// Read the ModR/M byte
|
||||
var (mod, reg, rm, memOperand) = ModRMDecoder.ReadModRM();
|
||||
var (mod, reg, rm, destOperand) = ModRMDecoder.ReadModRM();
|
||||
|
||||
// Advance past the ModR/M byte
|
||||
Decoder.SetPosition(position + 1);
|
||||
|
||||
// Get register name
|
||||
// Get register name (8-bit)
|
||||
string regName = ModRMDecoder.GetRegisterName(reg, 8);
|
||||
|
||||
// If mod == 3, then the r/m field specifies a register
|
||||
if (mod == 3)
|
||||
{
|
||||
// Get the r/m register name (8-bit)
|
||||
string rmRegName = ModRMDecoder.GetRegisterName(rm, 8);
|
||||
|
||||
// Set the operands
|
||||
instruction.Operands = $"{rmRegName}, {regName}";
|
||||
return true;
|
||||
}
|
||||
|
||||
// Replace "dword ptr" with "byte ptr" to indicate 8-bit operation
|
||||
string byteOperand = destOperand.Replace("dword ptr", "byte ptr");
|
||||
|
||||
// Set the operands
|
||||
instruction.Operands = $"{memOperand}, {regName}";
|
||||
instruction.Operands = $"{byteOperand}, {regName}";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user