OpCodeMov.cs 983 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. namespace ARMeilleure.Decoders
  2. {
  3. class OpCodeMov : OpCode
  4. {
  5. public int Rd { get; }
  6. public long Immediate { get; }
  7. public int Bit { get; }
  8. public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCodeMov(inst, address, opCode);
  9. public OpCodeMov(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
  10. {
  11. int p1 = (opCode >> 22) & 1;
  12. int sf = (opCode >> 31) & 1;
  13. if (sf == 0 && p1 != 0)
  14. {
  15. Instruction = InstDescriptor.Undefined;
  16. return;
  17. }
  18. Rd = (opCode >> 0) & 0x1f;
  19. Immediate = (opCode >> 5) & 0xffff;
  20. Bit = (opCode >> 21) & 0x3;
  21. Bit <<= 4;
  22. Immediate <<= Bit;
  23. RegisterSize = (opCode >> 31) != 0
  24. ? RegisterSize.Int64
  25. : RegisterSize.Int32;
  26. }
  27. }
  28. }