0
mirror of https://github.com/sampletext32/ParkanPlayground.git synced 2025-05-19 03:41:18 +03:00

Fix FsubrStiStHandler to correctly use FSUB instruction type for DC E8-EF opcodes

This commit is contained in:
bird_egop 2025-04-18 13:31:23 +03:00
parent d25e7e8133
commit 7bb14523e5
2 changed files with 7 additions and 7 deletions

View File

@ -3,7 +3,7 @@ namespace X86Disassembler.X86.Handlers.FloatingPoint.Arithmetic;
using X86Disassembler.X86.Operands; using X86Disassembler.X86.Operands;
/// <summary> /// <summary>
/// Handler for FSUBR ST(i), ST instruction (DC E8-EF) /// Handler for FSUB ST(i), ST instruction (DC E8-EF)
/// </summary> /// </summary>
public class FsubrStiStHandler : InstructionHandler public class FsubrStiStHandler : InstructionHandler
{ {
@ -23,7 +23,7 @@ public class FsubrStiStHandler : InstructionHandler
/// <returns>True if this handler can decode the opcode</returns> /// <returns>True if this handler can decode the opcode</returns>
public override bool CanHandle(byte opcode) public override bool CanHandle(byte opcode)
{ {
// FSUBR ST(i), ST is DC E8-EF // FSUB ST(i), ST is DC E8-EF
if (opcode != 0xDC) return false; if (opcode != 0xDC) return false;
if (!Decoder.CanReadByte()) if (!Decoder.CanReadByte())
@ -39,7 +39,7 @@ public class FsubrStiStHandler : InstructionHandler
} }
/// <summary> /// <summary>
/// Decodes a FSUBR ST(i), ST instruction /// Decodes a FSUB ST(i), ST instruction
/// </summary> /// </summary>
/// <param name="opcode">The opcode of the instruction</param> /// <param name="opcode">The opcode of the instruction</param>
/// <param name="instruction">The instruction object to populate</param> /// <param name="instruction">The instruction object to populate</param>
@ -55,7 +55,7 @@ public class FsubrStiStHandler : InstructionHandler
var stIndex = (FpuRegisterIndex)(Decoder.ReadByte() - 0xE8); var stIndex = (FpuRegisterIndex)(Decoder.ReadByte() - 0xE8);
// Set the instruction type // Set the instruction type
instruction.Type = InstructionType.Fsubr; instruction.Type = InstructionType.Fsub;
// Create the FPU register operands // Create the FPU register operands
var stiOperand = OperandFactory.CreateFPURegisterOperand(stIndex); var stiOperand = OperandFactory.CreateFPURegisterOperand(stIndex);

View File

@ -471,9 +471,9 @@ public class InstructionHandlerFactory
_handlers.Add(new FloatingPoint.Arithmetic.FmulStiStHandler(_decoder)); // FMUL ST(i), ST (DC C8-CF) _handlers.Add(new FloatingPoint.Arithmetic.FmulStiStHandler(_decoder)); // FMUL ST(i), ST (DC C8-CF)
_handlers.Add(new FloatingPoint.Comparison.FcomRegisterHandler(_decoder)); // FCOM ST(i), ST(0) (DC D0-D7) _handlers.Add(new FloatingPoint.Comparison.FcomRegisterHandler(_decoder)); // FCOM ST(i), ST(0) (DC D0-D7)
_handlers.Add(new FloatingPoint.Arithmetic.FsubStiStHandler(_decoder)); // FSUB ST(i), ST (DC E0-E7) _handlers.Add(new FloatingPoint.Arithmetic.FsubStiStHandler(_decoder)); // FSUB ST(i), ST (DC E0-E7)
_handlers.Add(new FloatingPoint.Arithmetic.FsubrStiStHandler(_decoder)); // FSUBR ST(i), ST (DC E8-EF) _handlers.Add(new FloatingPoint.Arithmetic.FsubrStiStHandler(_decoder)); // FSUB ST(i), ST (DC E8-EF)
_handlers.Add(new FloatingPoint.Arithmetic.FdivrStiStHandler(_decoder)); // FDIV ST(i), ST (DC F0-F7) _handlers.Add(new FloatingPoint.Arithmetic.FdivrStiStHandler(_decoder)); // FDIVR ST(i), ST (DC F0-F7)
_handlers.Add(new FloatingPoint.Arithmetic.FdivStiStHandler(_decoder)); // FDIVR ST(i), ST (DC F8-FF) _handlers.Add(new FloatingPoint.Arithmetic.FdivStiStHandler(_decoder)); // FDIV ST(i), ST (DC F8-FF)
_handlers.Add(new FloatingPoint.Comparison.FcompRegisterHandler(_decoder)); // FCOMP ST(i), ST(0) (DC D8-DF) _handlers.Add(new FloatingPoint.Comparison.FcompRegisterHandler(_decoder)); // FCOMP ST(i), ST(0) (DC D8-DF)
// DD opcode handlers (register operations) // DD opcode handlers (register operations)