示例#1
0
 public IndirectRegister(Register baseReg, int disp, Register indexReg, byte scale, bool force32)
 {
     if (baseReg == null)
     throw new ArgumentNullException ("BaseReg must be non null");
     if (indexReg == ESP)
     throw new ArgumentException ("IndexReg cannot be ESP");
     this.baseReg = baseReg;
     this.disp = disp;
     this.indexReg = indexReg;
     this.scale = scale;
     this.force32 = force32;
 }
示例#2
0
 public void EncodeModRm(Stream buffer, Register reg)
 {
     EncodeModRm (buffer, reg.Index);
 }
示例#3
0
 void TestEncode(Register a, Register b, byte expected)
 {
     MemoryStream ms = new MemoryStream ();
     a.EncodeModRm (ms, b);
     Assert.AreEqual (1, ms.Length, string.Format ("stream length {0},{1}", a, b));
     ms.Position = 0;
     Assert.AreEqual (expected, (byte)ms.ReadByte (), string.Format ("encoded ModRM {0},{1}", a, b));
 }
示例#4
0
 public IndirectRegister(Register baseReg, ScaledRegister scale)
     : this(baseReg, 0, scale.Register, scale.Scale, false)
 {
 }
示例#5
0
 public IndirectRegister(Register baseReg, int disp, Register indexReg, byte scale)
     : this(baseReg, disp, indexReg, scale, false)
 {
 }
示例#6
0
 public IndirectRegister(Register baseReg, int disp)
     : this(baseReg, disp, null, SCALE_1, false)
 {
 }
示例#7
0
 public IndirectRegister(Register baseReg)
     : this(baseReg, 0, null, SCALE_1, false)
 {
 }
示例#8
0
 public ScaledRegister(Register reg, byte scale)
 {
     this.reg = reg;
     switch (scale) {
     case 1:
     this.scale = 0;
     break;
     case 2:
     this.scale = 1;
     break;
     case 4:
     this.scale = 2;
     break;
     case 8:
     this.scale = 3;
     break;
     default:
     throw new ArgumentException ("Invalid scale value");
     }
 }