0
mirror of https://github.com/sampletext32/ParkanPlayground.git synced 2025-06-20 08:18:36 +03:00

add misc handlers, cleanup and fixes

This commit is contained in:
bird_egop
2025-04-17 20:47:51 +03:00
parent 124493cd94
commit a9d4c39717
22 changed files with 1086 additions and 63 deletions

View File

@ -148,43 +148,4 @@ public class PrefixDecoder
{
return _repnePrefix;
}
/// <summary>
/// Applies the segment override prefix to the operands string if applicable
/// </summary>
/// <param name="operands">The operands string</param>
/// <returns>The operands string with segment override applied</returns>
public string ApplySegmentOverride(string operands)
{
if (_segmentOverridePrefix && !string.IsNullOrEmpty(operands))
{
// If the instruction has memory operands, add the segment override
if (operands.Contains("["))
{
// Replace the first '[' with the segment override
return operands.Replace("[", $"{_segmentOverride}:[" );
}
}
return operands;
}
/// <summary>
/// Applies the REP/REPNE prefix to the mnemonic if applicable
/// </summary>
/// <param name="mnemonic">The mnemonic</param>
/// <returns>The mnemonic with REP/REPNE prefix applied</returns>
public string ApplyRepPrefix(string mnemonic)
{
if (_repnePrefix && !mnemonic.StartsWith("repne"))
{
return $"repne {mnemonic}";
}
else if (_repPrefix && !mnemonic.StartsWith("rep"))
{
return $"rep {mnemonic}";
}
return mnemonic;
}
}