public void ParseRegisterOperand() { OperandParser opp = Create16BitParser("eax"); ParsedOperand po = opp.ParseOperand(); Assert.AreEqual("RegisterOperand", po.Operand.GetType().Name); Assert.AreEqual("eax", po.Operand.ToString()); }
public void ParseMemoryAccess_IntelSyntax_NegativeOffset() { OperandParser opp = Create16BitParser("[ebp-70h]"); ParsedOperand po = opp.ParseOperand(); var mop = (MemoryOperand)po.Operand; Assert.AreEqual("[ebp-70]", mop.ToString(MachineInstructionRendererOptions.Default)); }
public void ParseImmediate_IntelSyntax() { OperandParser opp = Create16BitParser("21Eh"); ParsedOperand po = opp.ParseOperand(); ImmediateOperand mop = (ImmediateOperand)po.Operand; Assert.AreEqual("021E", mop.ToString(MachineInstructionRendererOptions.Default)); }
public void ParseMemoryOperandWithSpecifiedWidth() { OperandParser opp = Create16BitParser("byte ptr [bx]"); ParsedOperand po = opp.ParseOperand(); MemoryOperand mop = (MemoryOperand)po.Operand; Assert.AreSame(PrimitiveType.Byte, mop.Width); Assert.AreSame(Registers.bx, mop.Base); }
public void ParseMemoryOperandWithUnspecifiedWidth() { OperandParser opp = Create16BitParser("[bx]"); ParsedOperand po = opp.ParseOperand(); MemoryOperand mop = (MemoryOperand)po.Operand; Assert.IsNull(po.Operand.Width, "Operand width should have been null, was " + po.Operand.Width); Assert.AreSame(Registers.bx, mop.Base); }
public void ParseSibMemoryOperand() { OperandParser opp = Create16BitParser("[eax+eax*4]"); ParsedOperand po = opp.ParseOperand(); MemoryOperand mop = (MemoryOperand)po.Operand; Assert.IsNull(mop.Width, "Width should be undefined, but is " + mop.Width); Assert.IsNull(mop.Offset, "Offset should be null, but is " + mop.Offset); Assert.AreEqual("[eax+eax*4]", mop.ToString(MachineInstructionWriterOptions.None)); }
public void ParseNumericMemoryOperand() { OperandParser opp = Create16BitParser("[0x21E]"); ParsedOperand po = opp.ParseOperand(); MemoryOperand mop = (MemoryOperand)po.Operand; Assert.IsNull(mop.Width, "Width should be undefined, but is " + mop.Width); Assert.AreSame(PrimitiveType.Word16, mop.Offset.DataType); Assert.AreEqual("[021E]", mop.ToString(MachineInstructionWriterOptions.None)); }
public void ParseMemorySymbol() { OperandParser opp = Create16BitParser("[foo]"); ParsedOperand po = opp.ParseOperand(); MemoryOperand mop = (MemoryOperand)po.Operand; Assert.IsNull(mop.Width, "Width should be undefined, but is " + mop.Width); Assert.IsNotNull(po.Symbol, "Should have defined symbol foo"); Assert.AreEqual("[0000]", mop.ToString(MachineInstructionWriterOptions.None)); }