mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-27 22:12:25 +00:00
22 lines
No EOL
615 B
C#
22 lines
No EOL
615 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.Dup)]
|
|
public class Dup: Op {
|
|
public Dup(Mono.Cecil.Cil.Instruction aInstruction, MethodInformation aMethodInfo)
|
|
: base(aInstruction, aMethodInfo) {
|
|
}
|
|
public override void DoAssemble() {
|
|
int xTheSize = Assembler.StackSizes.Peek();
|
|
for (int i = 0; i < (xTheSize / 4); i++) {
|
|
Move(Assembler, "eax", "[esp + " + (i * 4) + "]");
|
|
Assembler.Add(new CPU.Pushd("eax"));
|
|
}
|
|
Assembler.StackSizes.Push(xTheSize);
|
|
}
|
|
}
|
|
} |