mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-27 14:02:19 +00:00
40 lines
1.5 KiB
C#
40 lines
1.5 KiB
C#
using System;
|
|
using System.Linq;
|
|
|
|
namespace Cosmos.IL2CPU.X86
|
|
{
|
|
/// <summary>
|
|
/// Subtracts the source operand from the destination operand and
|
|
/// replaces the destination operand with the result.
|
|
/// </summary>
|
|
[OpCode("sbb")]
|
|
public class SubWithCarry : InstructionWithDestinationAndSourceAndSize
|
|
{
|
|
public static void InitializeEncodingData(Instruction.InstructionData aData) {
|
|
aData.EncodingOptions.Add(new InstructionData.InstructionEncodingOption {
|
|
OpCode = new byte[] { 0x18 },
|
|
NeedsModRMByte = true,
|
|
InitialModRMByteValue = 0xC0,
|
|
DestinationRegAny = true,
|
|
SourceRegAny = true,
|
|
OperandSizeByte = 0,
|
|
ReverseRegisters = true
|
|
}); // reg to reg
|
|
aData.EncodingOptions.Add(new InstructionData.InstructionEncodingOption {
|
|
OpCode = new byte[] { 0x1A },
|
|
NeedsModRMByte = true,
|
|
SourceMemory = true,
|
|
DestinationRegAny = true,
|
|
OperandSizeByte = 0
|
|
}); // mem to reg
|
|
aData.EncodingOptions.Add(new InstructionData.InstructionEncodingOption {
|
|
OpCode = new byte[] { 0x18 },
|
|
NeedsModRMByte = true,
|
|
DestinationMemory = true,
|
|
SourceRegAny = true,
|
|
OperandSizeByte = 0,
|
|
ReverseRegisters = true
|
|
}); // reg to mem
|
|
}
|
|
}
|
|
}
|