Exemplo n.º 1
0
        public StoreRegisterToAddressOpcode(uint[] blocks)
        {
            BitWidth        = (BitWidthType)GetNibble(blocks[0], 2);
            SourceRegister  = GetNibble(blocks[0], 3);
            AddressRegister = GetNibble(blocks[0], 4);
            IncrementFlag   = GetNibble(blocks[0], 5) == 1;
            OffsetType      = GetNibble(blocks[0], 6);
            switch (OffsetType)
            {
            case 1:
                OffsetRegister = GetNibble(blocks[0], 7);
                break;

            case 2:
                RelativeAddress = ((UInt64)(blocks[0] & 0xF) << 32) + blocks[1];
                break;

            case 3:
                MemType = (MemoryAccessType)GetNibble(blocks[0], 7);
                break;

            case 4:
                MemType         = (MemoryAccessType)GetNibble(blocks[0], 7);
                RelativeAddress = ((UInt64)(blocks[0] & 0xF) << 32) + blocks[1];
                break;

            case 5:
                MemType         = (MemoryAccessType)GetNibble(blocks[0], 7);
                RelativeAddress = ((UInt64)(blocks[0] & 0xF) << 32) + blocks[1];
                break;
            }
        }
Exemplo n.º 2
0
        public ArithmeticOpcode(uint[] blocks)
        {
            BitWidth     = (BitWidthType)GetNibble(blocks[0], 2);
            MathType     = (RegisterArithmeticType)GetNibble(blocks[0], 3);
            RegisterDest = GetNibble(blocks[0], 4);
            RegisterLeft = GetNibble(blocks[0], 5);

            if (GetNibble(blocks[0], 6) == 0)
            {
                RightHandRegister = true;
                RegisterRight     = GetNibble(blocks[0], 7);
            }
            else
            {
                RightHandRegister = false;
                if (BitWidth == BitWidthType.q)
                {
                    Value = ((UInt64)blocks[1] << 32) | blocks[2];
                }
                else
                {
                    Value = blocks[1];
                }
            }
        }
Exemplo n.º 3
0
 public LegacyArithmeticOpcode(uint[] blocks)
 {
     BitWidth      = (BitWidthType)GetNibble(blocks[0], 2);
     RegisterIndex = GetNibble(blocks[0], 4);
     MathType      = (RegisterArithmeticType)GetNibble(blocks[0], 5);
     Value         = blocks[1];
 }
Exemplo n.º 4
0
 public StoreStaticToAddressOpcode(UInt32[] blocks)
 {
     BitWidth         = (BitWidthType)GetNibble(blocks[0], 2);
     RegisterIndex    = GetNibble(blocks[0], 4);
     IncrementFlag    = GetNibble(blocks[0], 5) == 1;
     OffsetEnableFlag = GetNibble(blocks[0], 6) == 1;
     OffsetRegister   = GetNibble(blocks[0], 7);
     Value            = ((UInt64)blocks[1] << 32) + blocks[2];
 }
Exemplo n.º 5
0
 public StoreStaticOpcode(UInt32[] blocks)
 {
     BitWidth        = (BitWidthType)GetNibble(blocks[0], 2);
     MemType         = (MemoryAccessType)GetNibble(blocks[0], 3);
     OffsetRegister  = GetNibble(blocks[0], 4);
     RelativeAddress = blocks[1];
     if (BitWidth == BitWidthType.q)
     {
         Value = ((UInt64)blocks[2] << 32) | blocks[3];
     }
     else
     {
         Value = blocks[2];
     }
 }
Exemplo n.º 6
0
 public LoadRegisterMemoryOpcode(uint[] blocks)
 {
     BitWidth      = (BitWidthType)GetNibble(blocks[0], 2);
     MemType       = (MemoryAccessType)GetNibble(blocks[0], 3);
     RegisterIndex = GetNibble(blocks[0], 4);
     UseReg        = GetNibble(blocks[0], 5) == 1;
     if (UseReg)
     {
         Immediate = ((UInt64)(blocks[0] & 0xFF) << 32) + blocks[1];
     }
     else
     {
         Immediate = blocks[1];
     }
 }
Exemplo n.º 7
0
        public ConditionalOpcode(uint[] blocks)
        {
            BitWidth  = (BitWidthType)GetNibble(blocks[0], 2);
            MemType   = (MemoryAccessType)GetNibble(blocks[0], 3);
            Condition = (ConditionalComparisonType)GetNibble(blocks[0], 4);
            Immediate = ((UInt64)(blocks[0] & 0xFF) << 32) + blocks[1];

            if (BitWidth == BitWidthType.q)
            {
                Value = ((UInt64)blocks[2] << 32) + blocks[3];
            }
            else
            {
                Value = blocks[2];
            }
        }
Exemplo n.º 8
0
        public RegisterConditionalOpcode(uint[] blocks)
        {
            /* C0TcSX## */
            /* C0TcS0Ma aaaaaaaa */
            /* C0TcS1Mr */
            /* C0TcS2Ra aaaaaaaa */
            /* C0TcS3Rr */
            /* C0TcS400 VVVVVVVV (VVVVVVVV) */
            /* C0 = opcode 0xC0 */
            /* T = bit width */
            /* c = condition type. */
            /* S = source register. */
            /* X = value operand type, 0 = main/heap with relative offset, 1 = main/heap with offset register, */
            /*     2 = register with relative offset, 3 = register with offset register, 4 = static value. */
            /* M = memory type. */
            /* a = relative address. */
            /* r = offset register. */
            /* V = value */

            BitWidth       = (BitWidthType)GetNibble(blocks[0], 3);
            Condition      = (ConditionalComparisonType)GetNibble(blocks[0], 4);
            SourceRegister = GetNibble(blocks[0], 5);
            OperandType    = GetNibble(blocks[0], 6);
            switch (OperandType)
            {
            case 0:
                MemType         = (MemoryAccessType)GetNibble(blocks[0], 7);
                RelativeAddress = ((ulong)(blocks[0] & 0xF) << 32) | blocks[1];
                break;

            case 1:
                MemType        = (MemoryAccessType)GetNibble(blocks[0], 7);
                OffsetRegister = GetNibble(blocks[0], 8);
                break;

            case 2:
                AddressRegister = GetNibble(blocks[0], 7);
                RelativeAddress = ((ulong)(blocks[0] & 0xF) << 32) | blocks[1];
                break;

            case 3:
                AddressRegister = GetNibble(blocks[0], 7);
                OffsetRegister  = GetNibble(blocks[0], 8);
                break;

            case 4:
                if (BitWidth == BitWidthType.q)
                {
                    Value = (((ulong)blocks[1]) << 32) | blocks[2];
                }
                else
                {
                    Value = blocks[1];
                }
                break;

            case 5:
                OtherRegister = GetNibble(blocks[0], 7);
                break;
            }
        }