From 6b58a92c301252d8284f8c3836e52f420a288bcc Mon Sep 17 00:00:00 2001 From: kudzu_cp <6d05c8c8ef5431987001abfdb2eadc9593ac9498> Date: Wed, 9 Sep 2009 16:37:21 +0000 Subject: [PATCH] --- source2/IL2PCU/Cosmos.IL2CPU.X86/IL/Branch.cs | 16 +++++++++++++++- .../IL2PCU/Cosmos.IL2CPU/Assembler/Assembler.cs | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-) 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);