1
mirror of https://github.com/sampletext32/ParkanPlayground.git synced 2025-12-10 08:01:21 +04:00

move handlers, remove bases

This commit is contained in:
bird_egop
2025-04-12 23:03:07 +03:00
parent acccf5169a
commit bb695cf3bb
30 changed files with 74 additions and 482 deletions

View File

@@ -45,4 +45,26 @@ public abstract class InstructionHandler : IInstructionHandler
/// <param name="instruction">The instruction object to populate</param>
/// <returns>True if the instruction was successfully decoded</returns>
public abstract bool Decode(byte opcode, Instruction instruction);
/// <summary>
/// Gets the 32-bit register name for the given register index
/// </summary>
/// <param name="reg">The register index</param>
/// <returns>The register name</returns>
protected static string GetRegister32(byte reg)
{
string[] registerNames = { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi" };
return registerNames[reg & 0x07];
}
/// <summary>
/// Gets the 8-bit register name for the given register index
/// </summary>
/// <param name="reg">The register index</param>
/// <returns>The register name</returns>
protected static string GetRegister8(byte reg)
{
string[] registerNames = { "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh" };
return registerNames[reg & 0x07];
}
}