Пример #1
0
 private void decodeArg(VMPreparedOperand op, bool byteMode)
 {
     int data = GetBits();
     if ((data & 0x8000) != 0)
     {
         op.Type = VMOpType.VM_OPREG;
         op.Data = (data >> 12) & 7;
         op.Offset = op.Data;
         AddBits(4);
     }
     else
     {
         if ((data & 0xc000) == 0)
         {
             op.Type = VMOpType.VM_OPINT;
             if (byteMode)
             {
                 op.Data = (data >> 6) & 0xff;
                 AddBits(10);
             }
             else
             {
                 AddBits(2);
                 op.Data = ReadData(this);
             }
         }
         else
         {
             op.Type = VMOpType.VM_OPREGMEM;
             if ((data & 0x2000) == 0)
             {
                 op.Data = (data >> 10) & 7;
                 op.Offset = op.Data;
                 op.Base = 0;
                 AddBits(6);
             }
             else
             {
                 if ((data & 0x1000) == 0)
                 {
                     op.Data = (data >> 9) & 7;
                     op.Offset = op.Data;
                     AddBits(7);
                 }
                 else
                 {
                     op.Data = 0;
                     AddBits(4);
                 }
                 op.Base = ReadData(this);
             }
         }
     }
 }
Пример #2
0
 private int GetOperand(VMPreparedOperand cmdOp)
 {
     int ret = 0;
     if (cmdOp.Type == VMOpType.VM_OPREGMEM)
     {
         int pos = (cmdOp.Offset + cmdOp.Base) & VM_MEMMASK;
         ret = Utilities.readIntLittleEndian(Mem, pos);
     }
     else
     {
         int pos = cmdOp.Offset;
         ret = Utilities.readIntLittleEndian(Mem, pos);
     }
     return ret;
 }