mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-06-21 00:28:36 +03:00
Added flag manipulation instruction handlers (STC, CLC, CMC, STD, CLD, STI, CLI, SAHF, LAHF)
This commit is contained in:
@ -3,15 +3,15 @@ namespace X86Disassembler.X86.Handlers.FloatingPoint.Arithmetic;
|
||||
using X86Disassembler.X86.Operands;
|
||||
|
||||
/// <summary>
|
||||
/// Handler for FDIV ST(i), ST instruction (DC F0-F7)
|
||||
/// Handler for FDIVR ST(i), ST instruction (DC F8-FF)
|
||||
/// </summary>
|
||||
public class FdivStiStHandler : InstructionHandler
|
||||
public class FdivrStiStHandler_FDIVStiSt : InstructionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the FdivStiStHandler class
|
||||
/// Initializes a new instance of the FdivrStiStHandler class
|
||||
/// </summary>
|
||||
/// <param name="decoder">The instruction decoder that owns this handler</param>
|
||||
public FdivStiStHandler(InstructionDecoder decoder)
|
||||
public FdivrStiStHandler_FDIVStiSt(InstructionDecoder decoder)
|
||||
: base(decoder)
|
||||
{
|
||||
}
|
||||
@ -23,7 +23,7 @@ public class FdivStiStHandler : InstructionHandler
|
||||
/// <returns>True if this handler can decode the opcode</returns>
|
||||
public override bool CanHandle(byte opcode)
|
||||
{
|
||||
// FDIV ST(i), ST is DC F0-F7
|
||||
// FDIVR ST(i), ST is DC F8-FF
|
||||
if (opcode != 0xDC) return false;
|
||||
|
||||
if (!Decoder.CanReadByte())
|
||||
@ -34,12 +34,12 @@ public class FdivStiStHandler : InstructionHandler
|
||||
// Check second opcode byte
|
||||
byte secondOpcode = Decoder.PeakByte();
|
||||
|
||||
// Only handle F0-F7
|
||||
return secondOpcode is >= 0xF0 and <= 0xF7;
|
||||
// Only handle F8-FF
|
||||
return secondOpcode is >= 0xF8 and <= 0xFF;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decodes a FDIV ST(i), ST instruction
|
||||
/// Decodes a FDIVR ST(i), ST instruction
|
||||
/// </summary>
|
||||
/// <param name="opcode">The opcode of the instruction</param>
|
||||
/// <param name="instruction">The instruction object to populate</param>
|
||||
@ -52,10 +52,10 @@ public class FdivStiStHandler : InstructionHandler
|
||||
}
|
||||
|
||||
// Read the ModR/M byte and calculate ST(i) index
|
||||
var stIndex = (FpuRegisterIndex)(Decoder.ReadByte() - 0xF0);
|
||||
var stIndex = (FpuRegisterIndex)(Decoder.ReadByte() - 0xF8);
|
||||
|
||||
// Set the instruction type
|
||||
instruction.Type = InstructionType.Fdiv;
|
||||
instruction.Type = InstructionType.Fdivr;
|
||||
|
||||
// Create the FPU register operands
|
||||
var stiOperand = OperandFactory.CreateFPURegisterOperand(stIndex);
|
||||
|
Reference in New Issue
Block a user