mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-31 05:11:08 +00:00
49 lines
No EOL
2.2 KiB
C#
49 lines
No EOL
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace Indy.IL2CPU.Assembler.X86 {
|
|
[OpCode("add")]
|
|
public class Add: InstructionWithDestinationAndSourceAndSize {
|
|
public static void InitializeEncodingData(Instruction.InstructionData aData) {
|
|
aData.EncodingOptions.Add(new InstructionData.InstructionEncodingOption {
|
|
OpCode = new byte[] { 0x04 },
|
|
AllowedSizes = InstructionSizes.Word | InstructionSizes.DWord,
|
|
DefaultSize = InstructionSize.DWord,
|
|
OperandSizeByte = 0,
|
|
DestinationReg = Registers.EAX,
|
|
SourceImmediate = true
|
|
}); // immediate to reg, shortcut for EAX/AX/AL
|
|
aData.EncodingOptions.Add(new InstructionData.InstructionEncodingOption {
|
|
OpCode = new byte[] { 0x80, 0xC0 },
|
|
AllowedSizes = InstructionSizes.Byte | InstructionSizes.Word | InstructionSizes.DWord,
|
|
DefaultSize = InstructionSize.DWord,
|
|
OperandSizeByte = 0,
|
|
DestinationReg = Guid.Empty,
|
|
DestinationRegByte = 1,
|
|
SourceImmediate = true
|
|
}); // immediate to reg
|
|
aData.EncodingOptions.Add(new InstructionData.InstructionEncodingOption {
|
|
OpCode = new byte[] { 0, 0xC0 },
|
|
AllowedSizes = InstructionSizes.DWord,
|
|
DefaultSize = InstructionSize.DWord,
|
|
OperandSizeByte = 0,
|
|
DestinationReg = Guid.Empty,
|
|
DestinationRegByte = 1,
|
|
SourceReg = Guid.Empty,
|
|
SourceRegByte = 1,
|
|
SourceRegBitShiftLeft = 3
|
|
}); // register to register
|
|
aData.EncodingOptions.Add(new InstructionData.InstructionEncodingOption {
|
|
OpCode = new byte[] { 0x80 },
|
|
NeedsModRMByte = true,
|
|
OperandSizeByte = 0,
|
|
AllowedSizes = InstructionSizes.Byte | InstructionSizes.Word | InstructionSizes.DWord,
|
|
DefaultSize = InstructionSize.DWord,
|
|
DestinationMemory = true,
|
|
SourceImmediate = true
|
|
});
|
|
}
|
|
}
|
|
} |