Exemple #1
0
 public override void Compile(Instruction i, AsmBuilder ab, List <string> Offsets, MethodDefinition md)
 {
     if (!char.IsDigit(i.OpCode.Name.Split('.').Last()[0]))
     {
         ab.Push(i.Operand.ToString());
     }
     else
     {
         ab.Push(i.OpCode.Name.Split('.').Last());
     }
 }
Exemple #2
0
 public override void Compile(Instruction i, AsmBuilder ab, List <string> Offsets, MethodDefinition md)
 {
     ab.Pop("eax"); //value a
     ab.Pop("ebx"); //value b
     ab.Cmp("eax", "ebx");
     ab.Jl(Utils.SafeName(md.FullName) + i.ToString().Split(':')[0] + "_1CLT");
     ab.Push("1");
     ab.Jmp(Utils.SafeName(md.FullName) + i.ToString().Split(':')[0] + "_0CLT");
     ab.Label(Utils.SafeName(md.FullName) + i.ToString().Split(':')[0] + "_1CLT");
     ab.Push("0");
     ab.Label(Utils.SafeName(md.FullName) + i.ToString().Split(':')[0] + "_0CLT");
 }
Exemple #3
0
 public override void Compile(Instruction i, AsmBuilder ab, List <string> Offsets, MethodDefinition md)
 {
     if (!char.IsDigit(i.OpCode.Name.Split('.').Last()[0]))
     {
         ab.Mov("eax", "dword[ebp - " + (4 * (Convert.ToInt32(i.Operand.ToString().Split('_').Last()) + 1)) + "]");
         ab.Push("eax");
     }
     else
     {
         ab.Mov("eax", "dword[ebp - " + (4 * (Convert.ToInt32(i.OpCode.Name.Split('.').Last()) + 1)) + "]");
         ab.Push("eax");
     }
 }
Exemple #4
0
 public override void Compile(Instruction i, AsmBuilder ab, List <string> Offsets, MethodDefinition md)
 {
     if (!char.IsDigit(i.OpCode.Name.Split('.').Last()[0]))
     {
         ab.Mov("eax", "[ebp + " + (8 + ((int)i.Operand * 4)) + "]");
         ab.Push("eax");
     }
     else
     {
         ab.Mov("eax", "[ebp + " + (8 + (int.Parse(i.OpCode.Name.Split('.').Last()) * 4)) + "]");
         ab.Push("eax");
     }
 }
Exemple #5
0
 public override void Compile(Instruction i, AsmBuilder ab, List <string> Offsets, MethodDefinition md)
 {
     ab.Pop("eax");  //value a
     ab.Pop("ebx");  //value b
     ab.Imul("ebx"); // imul ecx, eax, ebx; result in ecx
     ab.Push("EAX");
 }
Exemple #6
0
 public override void Compile(Instruction i, AsmBuilder ab, List <string> Offsets, MethodDefinition md)
 {
     ab.Pop("eax"); //value a
     ab.Pop("ebx"); //value b
     ab.Or("eax", "ebx");
     ab.Push("eax");
 }
Exemple #7
0
 public override void Compile(Instruction i, AsmBuilder ab, List <string> Offsets, MethodDefinition md)
 {
     if (!Compiler.ConstantIndex.Contains(i.Operand.ToString()))
     {
         string constant = "";
         foreach (var z in i.Operand.ToString())
         {
             constant += (byte)z + ", ";
         }
         constant = constant.Trim().TrimEnd(',');
         ab.GlobalVar(Utils.SafeName("STR" + i.Operand.ToString()), (i.Operand.ToString().Length - 1) + ",0 ,0 ,0 , " + constant, "db");
         Compiler.ConstantIndex.Add(i.Operand.ToString());
     }
     ab.Mov("eax", "dword " + Utils.SafeName("STR" + i.Operand.ToString()) + "");
     ab.Push("eax");
 }
Exemple #8
0
        public override void Compile(Instruction i, AsmBuilder ab, List <string> Offsets, MethodDefinition md)
        {
            if (Compiler.PlugIndex.ContainsKey(Utils.SafeName(i.Operand.ToString())))
            {
                ab.Comment("Pluged");
                ab.Call(Compiler.PlugIndex[Utils.SafeName(i.Operand.ToString())]);
            }
            else
            {
                ab.Call(Utils.SafeName(i.Operand.ToString()));
            }

            if ((i.Operand as MethodReference).ReturnType.ToString() != typeof(void).ToString())
            {
                ab.Push("eax");
            }
        }
Exemple #9
0
 public override void Compile(Instruction i, AsmBuilder ab, List <string> Offsets, MethodDefinition md)
 {
     ab.Pop("ebx"); //addres
     ab.Mov("al", "byte[ebx]");
     ab.Push("eax");
 }
Exemple #10
0
 public override void Compile(Instruction i, AsmBuilder ab, List <string> Offsets, MethodDefinition md)
 {
     ab.Mov("eax", "dword [" + Utils.SafeName(i.Operand.ToString()) + "]");
     ab.Push("eax");
 }