mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-05-19 20:01:17 +03:00
Removed two-byte instruction handling from FloatingPointHandler. Simplified the code by removing the TwoByteInstructions dictionary and related methods since we now have dedicated handlers for specific instructions.
This commit is contained in:
parent
6ed6a7bd00
commit
a6b6cc1149
@ -8,16 +8,12 @@ public class FloatingPointHandler : InstructionHandler
|
|||||||
// Floating-point instruction mnemonics based on opcode and ModR/M reg field
|
// Floating-point instruction mnemonics based on opcode and ModR/M reg field
|
||||||
private static readonly string[][] FpuMnemonics = new string[8][];
|
private static readonly string[][] FpuMnemonics = new string[8][];
|
||||||
|
|
||||||
// Two-byte floating-point instructions
|
|
||||||
private static readonly Dictionary<ushort, string> TwoByteInstructions = new Dictionary<ushort, string>();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Static constructor to initialize the FPU mnemonic tables
|
/// Static constructor to initialize the FPU mnemonic tables
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static FloatingPointHandler()
|
static FloatingPointHandler()
|
||||||
{
|
{
|
||||||
InitializeFpuMnemonics();
|
InitializeFpuMnemonics();
|
||||||
InitializeTwoByteInstructions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -109,17 +105,6 @@ public class FloatingPointHandler : InstructionHandler
|
|||||||
FpuMnemonics[7][7] = "fistp";
|
FpuMnemonics[7][7] = "fistp";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes the two-byte floating-point instructions
|
|
||||||
/// </summary>
|
|
||||||
private static void InitializeTwoByteInstructions()
|
|
||||||
{
|
|
||||||
// We no longer need to handle FNSTSW AX (DF E0) here since we have a dedicated FnstswHandler
|
|
||||||
// that is registered before this handler in the InstructionHandlerFactory
|
|
||||||
|
|
||||||
// Add other two-byte instructions as needed
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the FloatingPointHandler class
|
/// Initializes a new instance of the FloatingPointHandler class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -156,21 +141,6 @@ public class FloatingPointHandler : InstructionHandler
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for two-byte instructions
|
|
||||||
if (position < Length)
|
|
||||||
{
|
|
||||||
// Create a two-byte opcode by combining the primary opcode with the next byte
|
|
||||||
ushort twoByteOpcode = (ushort)((opcode << 8) | CodeBuffer[position]);
|
|
||||||
|
|
||||||
// Check if this is a known two-byte instruction
|
|
||||||
if (TwoByteInstructions.TryGetValue(twoByteOpcode, out string? mnemonic) && mnemonic != null)
|
|
||||||
{
|
|
||||||
instruction.Mnemonic = mnemonic;
|
|
||||||
Decoder.SetPosition(position + 1); // Skip the second byte
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The opcode index in our tables (0-7 for D8-DF)
|
// The opcode index in our tables (0-7 for D8-DF)
|
||||||
int opcodeIndex = opcode - 0xD8;
|
int opcodeIndex = opcode - 0xD8;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user