Ejemplo n.º 1
0
 public void ConvertInlineAssemblyTest()
 {
     Assert.AreEqual("ret",
                     X86Assembly.FromInline(ASM.ret, new object[] { }));
     Assert.AreEqual("mov eax, 10",
                     X86Assembly.FromInline(ASM.mov, new object[] { REG.EAX, 10 }));
     Assert.AreEqual("mov byte ptr [eax], 10",
                     X86Assembly.FromInline(ASM.mov, new object[] { REG.EAX.Ptr.Byte, 10 }));
     Assert.AreEqual("mov word ptr [eax], 10",
                     X86Assembly.FromInline(ASM.mov, new object[] { REG.EAX.Ptr.Word, 10 }));
     Assert.AreEqual("mov dword ptr [eax], 10",
                     X86Assembly.FromInline(ASM.mov, new object[] { REG.EAX.Ptr, 10 }));
     Assert.AreEqual("mov dword ptr [eax], 10",
                     X86Assembly.FromInline(ASM.mov, new object[] { REG.EAX.Ptr.DWord, 10 }));
     Assert.AreEqual("mov qword ptr [eax], 10",
                     X86Assembly.FromInline(ASM.mov, new object[] { REG.EAX.Ptr.QWord, 10 }));
     Assert.AreEqual("mov dword ptr [eax+4], 10",
                     X86Assembly.FromInline(ASM.mov, new object[] { (REG.EAX + 4).Ptr, 10 }));
     Assert.AreEqual("mov dword ptr [eax+ebx], 10",
                     X86Assembly.FromInline(ASM.mov, new object[] { (REG.EAX + REG.EBX).Ptr, 10 }));
     Assert.AreEqual("mov dword ptr [eax+ebx*8+128], eax",
                     X86Assembly.FromInline(ASM.mov, new object[] { (REG.EAX + REG.EBX * 8 + 128).Ptr.DWord, REG.EAX }));
     Assert.AreEqual("mov dword ptr [ebx*8+128], eax",
                     X86Assembly.FromInline(ASM.mov, new object[] { (REG.EBX * 8 + 128).Ptr.DWord, REG.EAX }));
     Assert.AreEqual("mov dword ptr [ebx*2], eax",
                     X86Assembly.FromInline(ASM.mov, new object[] { (REG.EBX * 2).Ptr.DWord, REG.EAX }));
     Assert.AreEqual("mov eax, dword ptr [ebx+4]",
                     X86Assembly.FromInline(ASM.mov, new object[] { REG.EAX, (REG.EBX + 4).Ptr }));
 }
Ejemplo n.º 2
0
        public void ConvertInlineAssemblyRawCodeTest()
        {
            string code = "Nobody care this project";

            Assert.AreEqual(code, X86Assembly.FromInline(new object[]
            {
                new RawAssemblyCode(code)
            }));
        }