This commit is contained in:
kudzu_cp 2009-07-26 19:06:27 +00:00
parent e88adb857a
commit 9fa84dcf5f
5 changed files with 22 additions and 11 deletions

View file

@ -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));

View file

@ -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));
}
}
}

View file

@ -49,7 +49,8 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Assembler.cs" />
<Compile Include="AssemblerBin.cs" />
<Compile Include="AssemblerNasm.cs" />
<Compile Include="ILOp.cs" />
<Compile Include="IL\Add.cs" />
<Compile Include="IL\Add_Ovf.cs" />

View file

@ -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 + "__";

View file

@ -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);