mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-22 22:09:12 +00:00
29 lines
No EOL
877 B
C#
29 lines
No EOL
877 B
C#
using System;
|
|
using System.IO;
|
|
using Mono.Cecil;
|
|
using Mono.Cecil.Cil;
|
|
using CPU = Indy.IL2CPU.Assembler.X86;
|
|
|
|
namespace Indy.IL2CPU.IL.X86 {
|
|
[OpCode(Code.Starg)]
|
|
public class Starg: Op {
|
|
private string mAddress;
|
|
protected void SetArgIndex(int aIndex, MethodInformation aMethodInfo) {
|
|
mAddress = aMethodInfo.Arguments[aIndex].VirtualAddress;
|
|
}
|
|
public Starg(Mono.Cecil.Cil.Instruction aInstruction, MethodInformation aMethodInfo)
|
|
: base(aInstruction, aMethodInfo) {
|
|
ParameterDefinition xParam = aInstruction.Operand as ParameterDefinition;
|
|
if (xParam != null) {
|
|
SetArgIndex(xParam.Sequence - 1, aMethodInfo);
|
|
}
|
|
}
|
|
public override void DoAssemble() {
|
|
if (String.IsNullOrEmpty(mAddress)) {
|
|
throw new Exception("No Address Specified!");
|
|
}
|
|
Pop("eax");
|
|
Move(Assembler, "[" + mAddress + "]", "eax");
|
|
}
|
|
}
|
|
} |