mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-20 04:48:53 +00:00
29 lines
915 B
C#
29 lines
915 B
C#
|
|
using XSharp.Common;
|
|
using static XSharp.Common.XSRegisters;
|
|
|
|
namespace Cosmos.IL2CPU.X86.IL
|
|
{
|
|
[OpCode(ILOpCode.Code.Dup)]
|
|
public class Dup : ILOp
|
|
{
|
|
public Dup(Cosmos.Assembler.Assembler aAsmblr)
|
|
: base(aAsmblr)
|
|
{
|
|
}
|
|
|
|
public override void Execute(_MethodInfo aMethod, ILOpCode aOpCode)
|
|
{
|
|
var xStackContent = aOpCode.StackPopTypes[0];
|
|
var xStackContentSize = SizeOfType(xStackContent);
|
|
var StackSize = (int)((xStackContentSize / 4) + (xStackContentSize % 4 == 0 ? 0 : 1));
|
|
|
|
for (int i = StackSize; i > 0; i--)
|
|
{
|
|
XS.Push(ESP, true, (StackSize - 1) * 4);
|
|
//new CPUx86.Push { DestinationReg = CPUx86.RegistersEnum.ESP, DestinationIsIndirect = true, DestinationDisplacement = (int)((StackSize - 1) * 4) };
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|