aboutsummaryrefslogtreecommitdiff
path: root/src/ARMeilleure/Decoders/OpCodeT16MemReg.cs
blob: 17d6966b244d0ed875fcee7a9136c9bc32f45a39 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
namespace ARMeilleure.Decoders
{
    class OpCodeT16MemReg : OpCodeT16, IOpCode32MemReg
    {
        public int Rm { get; }
        public int Rt { get; }
        public int Rn { get; }

        public bool WBack => false;
        public bool IsLoad { get; }
        public bool Index => true;
        public bool Add => true;

        public int Immediate => throw new System.InvalidOperationException();

        public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCodeT16MemReg(inst, address, opCode);

        public OpCodeT16MemReg(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
        {
            Rt = (opCode >> 0) & 7;
            Rn = (opCode >> 3) & 7;
            Rm = (opCode >> 6) & 7;

            IsLoad = ((opCode >> 9) & 7) >= 3;
        }
    }
}