aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/Decoders/OpCodeT16Adr.cs
blob: ef14791d93375e119df2c055cce74c44a36f4f1e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
namespace ARMeilleure.Decoders
{
    class OpCodeT16Adr : OpCodeT16, IOpCode32Adr
    {
        public int Rd { get; }

        public bool Add => true;
        public int Immediate { get; }

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

        public OpCodeT16Adr(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
        {
            Rd  = (opCode >> 8) & 7;

            int imm = (opCode & 0xff) << 2;
            Immediate = (int)(GetPc() & 0xfffffffc) + imm;
        }
    }
}