diff --git a/source2/IL2PCU/Cosmos.IL2CPU.X86/IL/Branch.cs b/source2/IL2PCU/Cosmos.IL2CPU.X86/IL/Branch.cs index faab81865..a097cf290 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU.X86/IL/Branch.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU.X86/IL/Branch.cs @@ -23,7 +23,21 @@ namespace Cosmos.IL2CPU.X86.IL { public override void Execute(MethodInfo aMethod, ILOpCode aOpCode) { var xStackContent = Assembler.Stack.Pop(); - Assembler.Stack.Pop(); + switch (aOpCode.OpCode) { + case ILOpCode.Code.Beq: + case ILOpCode.Code.Bge: + case ILOpCode.Code.Bgt: + case ILOpCode.Code.Bge_Un: + case ILOpCode.Code.Bgt_Un: + case ILOpCode.Code.Ble: + case ILOpCode.Code.Ble_Un: + case ILOpCode.Code.Bne_Un: + case ILOpCode.Code.Blt: + case ILOpCode.Code.Blt_Un: + Assembler.Stack.Pop(); + break; + } + if (xStackContent.Size > 8) { throw new Exception("StackSize > 8 not supported"); } diff --git a/source2/IL2PCU/Cosmos.IL2CPU/Assembler/Assembler.cs b/source2/IL2PCU/Cosmos.IL2CPU/Assembler/Assembler.cs index 94cc0c0f5..ba1ba3fe2 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU/Assembler/Assembler.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU/Assembler/Assembler.cs @@ -140,7 +140,8 @@ namespace Cosmos.IL2CPU { } else { xILOp = mILOpsHi[xOpCodeVal & 0xFF]; } - //mLog.Write ( "[" + xILOp.ToString() + "] \t Stack start: " + Stack.Count.ToString() ); + mLog.WriteLine ( "[" + xILOp.ToString() + "] \t Stack start: " + Stack.Count.ToString() ); + mLog.Flush(); new Comment(this, "ILOp: " + xILOp.ToString()); new Comment(this, "ILOpCode: " + xOpCode.OpCode.ToString()); BeforeOp(aMethod, xOpCode);