0
mirror of https://github.com/sampletext32/ParkanPlayground.git synced 2025-06-20 08:18:36 +03:00
This commit is contained in:
bird_egop
2025-04-12 23:40:48 +03:00
parent 3cc6d27e33
commit f658f4384c
9 changed files with 16 additions and 158 deletions

View File

@ -3,7 +3,7 @@ namespace X86Disassembler.X86;
/// <summary>
/// Provides mapping between opcodes and their mnemonics
/// </summary>
public class OpcodeMap
public static class OpcodeMap
{
// One-byte opcode map
private static readonly string[] OneByteOpcodes = new string[256];
@ -14,16 +14,6 @@ public class OpcodeMap
"s", "ns", "p", "np", "l", "ge", "le", "g"
};
// Group 1 operations (used with opcodes 0x80, 0x81, 0x83)
public static readonly string[] Group1Operations = {
"add", "or", "adc", "sbb", "and", "sub", "xor", "cmp"
};
// Group 3 operations (used with opcodes 0xF6, 0xF7)
public static readonly string[] Group3Operations = {
"test", "???", "not", "neg", "mul", "imul", "div", "idiv"
};
// Static constructor to initialize the opcode maps
static OpcodeMap()
{
@ -138,34 +128,4 @@ public class OpcodeMap
{
return OneByteOpcodes[opcode];
}
/// <summary>
/// Checks if the opcode is a Group 1 opcode
/// </summary>
/// <param name="opcode">The opcode to check</param>
/// <returns>True if the opcode is a Group 1 opcode</returns>
public static bool IsGroup1Opcode(byte opcode)
{
return opcode == 0x80 || opcode == 0x81 || opcode == 0x83;
}
/// <summary>
/// Checks if the opcode is a Group 3 opcode
/// </summary>
/// <param name="opcode">The opcode to check</param>
/// <returns>True if the opcode is a Group 3 opcode</returns>
public static bool IsGroup3Opcode(byte opcode)
{
return opcode == 0xF6 || opcode == 0xF7;
}
/// <summary>
/// Checks if the opcode is a floating-point instruction
/// </summary>
/// <param name="opcode">The opcode to check</param>
/// <returns>True if the opcode is a floating-point instruction</returns>
public static bool IsFloatingPointOpcode(byte opcode)
{
return opcode >= 0xD8 && opcode <= 0xDF;
}
}