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"); }
public override void Emit(MethodDefinition md, Instruction c, AssemblyWriter writer) { writer.Pop("eax"); // address writer.Pop("ebx"); // value writer.Mov("[eax]", "ebx"); }