public void EnSegAccessArray() { Identifier bx = m.Local16("bx"); Identifier ds = m.Local(PrimitiveType.SegmentSelector, "ds"); Expression e = m.SegMem(PrimitiveType.Int16, ds, m.IAdd(m.IMul(bx, 2), 0x42)); Assert.AreEqual("Mem0[ds:bx * 0x0002 + 0x0042:int16]", e.ToString()); e = e.Accept(aen); Assert.AreEqual("SEQ(ds, 0x0042)[bx * 0x0002]", e.ToString()); }
public void TrcoArrayAccess() { ProcedureBuilder m = new ProcedureBuilder(); Identifier ds = m.Local(PrimitiveType.SegmentSelector, "ds"); Identifier bx = m.Local16("bx"); Expression e = m.Array(PrimitiveType.Word32, m.Seq(ds, m.Word16(0x300)), m.IMul(bx, 8)); coll = CreateCollector(); e.Accept(eqb); e.Accept(coll); StringWriter sb = new StringWriter(); handler.Traits.Write(sb); string sExp = "T_1 (in ds : selector)" + nl + "\ttrait_primitive(selector)" + nl + "\ttrait_mem_array(300, 8, 0, T_7)" + nl + "T_2 (in 0x0300 : word16)" + nl + " trait_primitive(word16)"+ nl + "T_3 (in SEQ(ds, 0x0300) : ptr32)" + nl + " trait_primitive(ptr32)"+ nl + "T_4 (in bx : word16)" + nl + " trait_primitive(word16)"+ nl + " trait_primitive(ui16)"+ nl + "T_5 (in 0x0008 : word16)" + nl + " trait_primitive(word16)"+ nl + " trait_primitive(ui16)"+ nl + "T_6 (in bx * 0x0008 : word16)" + nl + " trait_primitive(ui16)"+ nl + "T_7 (in SEQ(ds, 0x0300)[bx * 0x0008] : word32)" + nl + " trait_primitive(word32)"+ nl; Assert.AreEqual(sExp, sb.ToString()); }
public void PprMemberPointers() { ProgramBuilder mock = new ProgramBuilder(); ProcedureBuilder m = new ProcedureBuilder(); Identifier ds = m.Local(PrimitiveType.SegmentSelector, "ds"); m.SegStore(ds, m.Word32(7000), m.SegMemW(ds, m.SegMemW(ds, m.Word32(0x5321)))); mock.Add(m); RunTest(mock.BuildProgram(), "Typing/PprMemberPointers.txt"); }
public void DtbArrayAccess2() { ProcedureBuilder m = new ProcedureBuilder(); Identifier ds = m.Local(PrimitiveType.SegmentSelector, "ds"); Identifier bx = m.Local16("bx"); Expression e = m.Array(PrimitiveType.Word32, m.Seq(ds, m.Word16(0x300)), m.IMul(bx, 8)); e.Accept(eqb); TraitCollector coll = new TraitCollector(factory, store, dtb, program); e.Accept(coll); Verify("Typing/DtbArrayAccess2.txt"); }
public void FindId() { Assert.AreEqual(1, UsedIdentifierFinder.Find(null, m.Local(PrimitiveType.Word16, "loc3")).Count); }