diff --git a/source2/IL2PCU/Cosmos.IL2CPU.X86/Cosmos.IL2CPU.X86.csproj b/source2/IL2PCU/Cosmos.IL2CPU.X86/Cosmos.IL2CPU.X86.csproj index d17c01e30..cd7a11bc4 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU.X86/Cosmos.IL2CPU.X86.csproj +++ b/source2/IL2PCU/Cosmos.IL2CPU.X86/Cosmos.IL2CPU.X86.csproj @@ -347,6 +347,7 @@ + diff --git a/source2/IL2PCU/Cosmos.IL2CPU.X86/X86/Scas.cs b/source2/IL2PCU/Cosmos.IL2CPU.X86/X86/Scas.cs new file mode 100644 index 000000000..f491471bb --- /dev/null +++ b/source2/IL2PCU/Cosmos.IL2CPU.X86/X86/Scas.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Cosmos.IL2CPU.X86 +{ + [OpCode("scas")] + public class Scas: InstructionWithSize, IInstructionWithPrefix + { + public static void InitializeEncodingData(Instruction.InstructionData aData) + { + } + + public InstructionPrefixes Prefixes + { + get; + set; + } + + public override void WriteText(Cosmos.IL2CPU.Assembler aAssembler, System.IO.TextWriter aOutput) + { + if ((Prefixes & InstructionPrefixes.RepeatTillNotEqual) != 0) + { + aOutput.Write("repne "); + } + switch (Size) + { + case 32: + aOutput.Write("scasd"); + return; + case 16: + aOutput.Write("scasw"); + return; + case 8: + aOutput.Write("scasb"); + return; + default: throw new Exception("Size not supported!"); + } + } + } +} diff --git a/source2/IL2PCU/Cosmos.IL2CPU.X86/X86/_Infra/IInstructionWithPrefix.cs b/source2/IL2PCU/Cosmos.IL2CPU.X86/X86/_Infra/IInstructionWithPrefix.cs index ffd7667e4..896697e9a 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU.X86/X86/_Infra/IInstructionWithPrefix.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU.X86/X86/_Infra/IInstructionWithPrefix.cs @@ -9,7 +9,7 @@ namespace Cosmos.IL2CPU.X86 { None, Lock, Repeat, - RepeatNotEqual + RepeatTillNotEqual } public interface IInstructionWithPrefix {