Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AddressBlock"/> class.
 /// </summary>
 /// <param name="cpu">The processor that is creating the AddressBlock.</param>
 /// <param name="bytes">The 8 bytes from which the AddressBlock will be created.</param>
 public AddressBlock(Processor cpu, ulong bytes)
 {
     this.owner = cpu;
     this.Type = (AddressType)(bytes >> 48);
     this.IsPointer = (bytes & (1 << 47)) != 0 ? true : false;
     this.Length = (uint)(bytes & 0x00007FFF00000000UL);
     this.Address = (uint)(bytes & 0x00000000FFFFFFFFUL);
 }
Exemple #2
0
 public Operand(Processor cpu, OperandType optype)
 {
     Type = optype;
     switch (Type)
     {
         case OperandType.AddressBlock:
             Address = new AddressBlock(cpu, cpu.ReadULong());
             break;
         case OperandType.Register:
             // add
             break;
         case OperandType.StackIndex:
             // add
             break;
         case OperandType.NumericByte:
             Value = new ByteBlock(cpu.ReadByte());
             break;
         case OperandType.NumericSByte:
             Value = new ByteBlock(cpu.ReadSByte());
             break;
         case OperandType.NumericShort:
             Value = new ByteBlock(cpu.ReadShort());
             break;
         case OperandType.NumericUShort:
             Value = new ByteBlock(cpu.ReadUShort());
             break;
         case OperandType.NumericInt:
             Value = new ByteBlock(cpu.ReadInt());
             break;
         case OperandType.NumericUInt:
             Value = new ByteBlock(cpu.ReadUInt());
             break;
         case OperandType.NumericLong:
             Value = new ByteBlock(cpu.ReadLong());
             break;
         case OperandType.NumericULong:
             Value = new ByteBlock(cpu.ReadULong());
             break;
         case OperandType.NumericFloat:
             Value = new ByteBlock(cpu.ReadFloat());
             break;
         case OperandType.NumericDouble:
             Value = new ByteBlock(cpu.ReadDouble());
             break;
         case OperandType.LPString:
             uint length = cpu.ReadUInt();
             ByteBlock bytes = cpu.Read(length);
             Value = new ByteBlock(System.Text.Encoding.UTF8.GetString(bytes.ToByteArray()));
             break;
         default:
             break;
     }
 }