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; }
public void EncodeModRm(Stream buffer, Register reg) { EncodeModRm (buffer, reg.Index); }
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)); }
public IndirectRegister(Register baseReg, ScaledRegister scale) : this(baseReg, 0, scale.Register, scale.Scale, false) { }
public IndirectRegister(Register baseReg, int disp, Register indexReg, byte scale) : this(baseReg, disp, indexReg, scale, false) { }
public IndirectRegister(Register baseReg, int disp) : this(baseReg, disp, null, SCALE_1, false) { }
public IndirectRegister(Register baseReg) : this(baseReg, 0, null, SCALE_1, false) { }
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"); } }