Ejemplo n.º 1
0
        public override void Emit(MethodDefinition md, Instruction c, AssemblyWriter writer)
        {
            int num = 0;

            if (c.OpCode == OpCodes.Stloc)
            {
                num = (int)c.Operand;
            }
            else
            {
                num = int.Parse(c.OpCode.Name.Split('.').Last());
            }

            var offset = 0;

            /*
             * for (int i = 0; i < num + 1; i++)
             * {
             *  offset += Marshal.SizeOf(Type.GetType(md.Body.Variables[i].VariableType.FullName));
             * }*/
            offset = md.Body.Variables.Count * 4;

            writer.Pop("eax");
            writer.Mov($"[ebp-{offset}]", "eax");
        }
Ejemplo n.º 2
0
 public override void Emit(MethodDefinition md, Instruction c, AssemblyWriter writer)
 {
     writer.Pop("eax"); // address
     writer.Pop("ebx"); // value
     writer.Mov("[eax]", "ebx");
 }