From 9fa84dcf5f59bfca048fd6f2b05ce120d1074c8b Mon Sep 17 00:00:00 2001 From: kudzu_cp <6d05c8c8ef5431987001abfdb2eadc9593ac9498> Date: Sun, 26 Jul 2009 19:06:27 +0000 Subject: [PATCH] --- .../{Assembler.cs => AssemblerBin.cs} | 2 +- source2/IL2PCU/Cosmos.IL2CPU.X86/AssemblerNasm.cs | 14 ++++++++++++++ .../Cosmos.IL2CPU.X86/Cosmos.IL2CPU.X86.csproj | 3 ++- source2/IL2PCU/Cosmos.IL2CPU.X86/IL/Beq.cs | 12 ++++-------- source2/Users/Kudzu/HelloWorld/Program.cs | 2 +- 5 files changed, 22 insertions(+), 11 deletions(-) rename source2/IL2PCU/Cosmos.IL2CPU.X86/{Assembler.cs => AssemblerBin.cs} (74%) create mode 100644 source2/IL2PCU/Cosmos.IL2CPU.X86/AssemblerNasm.cs diff --git a/source2/IL2PCU/Cosmos.IL2CPU.X86/Assembler.cs b/source2/IL2PCU/Cosmos.IL2CPU.X86/AssemblerBin.cs similarity index 74% rename from source2/IL2PCU/Cosmos.IL2CPU.X86/Assembler.cs rename to source2/IL2PCU/Cosmos.IL2CPU.X86/AssemblerBin.cs index 39a3ddba9..009ba72af 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU.X86/Assembler.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU.X86/AssemblerBin.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; namespace Cosmos.IL2CPU.X86 { - public class Assembler : Cosmos.IL2CPU.Assembler { + public class AssemblerBin : Cosmos.IL2CPU.Assembler { protected override void InitILOps() { InitILOps(typeof(ILOp)); diff --git a/source2/IL2PCU/Cosmos.IL2CPU.X86/AssemblerNasm.cs b/source2/IL2PCU/Cosmos.IL2CPU.X86/AssemblerNasm.cs new file mode 100644 index 000000000..17a2057b1 --- /dev/null +++ b/source2/IL2PCU/Cosmos.IL2CPU.X86/AssemblerNasm.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Cosmos.IL2CPU.X86 { + public class AssemblerNasm : Cosmos.IL2CPU.Assembler { + + protected override void InitILOps() { + InitILOps(typeof(ILOp)); + } + + } +} diff --git a/source2/IL2PCU/Cosmos.IL2CPU.X86/Cosmos.IL2CPU.X86.csproj b/source2/IL2PCU/Cosmos.IL2CPU.X86/Cosmos.IL2CPU.X86.csproj index 4e7f1f427..5c7873669 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU.X86/Cosmos.IL2CPU.X86.csproj +++ b/source2/IL2PCU/Cosmos.IL2CPU.X86/Cosmos.IL2CPU.X86.csproj @@ -49,7 +49,8 @@ - + + diff --git a/source2/IL2PCU/Cosmos.IL2CPU.X86/IL/Beq.cs b/source2/IL2PCU/Cosmos.IL2CPU.X86/IL/Beq.cs index 608239e64..3776246b3 100644 --- a/source2/IL2PCU/Cosmos.IL2CPU.X86/IL/Beq.cs +++ b/source2/IL2PCU/Cosmos.IL2CPU.X86/IL/Beq.cs @@ -5,19 +5,15 @@ using CPU = Indy.IL2CPU.Assembler.X86; namespace Cosmos.IL2CPU.X86.IL { [Cosmos.IL2CPU.OpCode(ILOpCode.Code.Beq)] - public class Beq: ILOp - { + public class Beq: ILOp { - public Beq(Cosmos.IL2CPU.Assembler aAsmblr) : base(aAsmblr) - { + public Beq(Cosmos.IL2CPU.Assembler aAsmblr) : base(aAsmblr) { } - public override void Execute(uint aMethodUID, ILOpCode aOpCode) - { + public override void Execute(uint aMethodUID, ILOpCode aOpCode) { var xStackContent = OldAsmblr.StackContents.Pop(); OldAsmblr.StackContents.Pop(); - if (xStackContent.Size > 8) - { + if (xStackContent.Size > 8) { throw new Exception("StackSize>8 not supported"); } string BaseLabel = "_" + aMethodUID + "_" + ((ILOpCodes.OpBranch)aOpCode).Value + "__"; diff --git a/source2/Users/Kudzu/HelloWorld/Program.cs b/source2/Users/Kudzu/HelloWorld/Program.cs index 25068053f..ef24a881c 100644 --- a/source2/Users/Kudzu/HelloWorld/Program.cs +++ b/source2/Users/Kudzu/HelloWorld/Program.cs @@ -18,7 +18,7 @@ namespace HelloWorld { //TODO: Move new build logic into new sort. // Build stuff is all UI, launching QEMU, making ISO etc. // IL2CPU should only contain scanning and assembling of binary files - var xAsmblr = new Cosmos.IL2CPU.X86.Assembler(); + var xAsmblr = new Cosmos.IL2CPU.X86.AssemblerNasm(); var xScanner = new ILScanner(xAsmblr); var xEntryPoint = typeof(Program).GetMethod("Init", BindingFlags.Public | BindingFlags.Static);