Cosmos/source/Playgrounds/Matthijs/TestApp/Program.cs
mterwoord_cp a212e9fa11
2008-12-25 09:34:10 +00:00

69 lines
No EOL
3.7 KiB
C#

//#define GenerateTests
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Indy.IL2CPU.Assembler.X86;
using System.IO;
using System.Reflection;
using Indy.IL2CPU.Assembler.X86.X;
using Indy.IL2CPU.Tests.AssemblerTests.X86;
namespace TestApp {
class Program {
class Renderer : Y86 {
public void DoRender() {
new Movs { Prefixes = InstructionPrefixes.None, Size = 32 };
new Movs { Prefixes = InstructionPrefixes.None, Size = 16 };
new Movs { Prefixes = InstructionPrefixes.None, Size = 8 };
}
}
static void Main(string[] args) {
try {
#if !GenerateTests
var xAsm = new Assembler();
xAsm.Initialize();
//xAsm.DataMembers.Add(new Indy.IL2CPU.Assembler.DataMember("TestData", new byte[] { 65, 66, 67, 68, 69, 70, 71, 72, 73, 74 }));
xAsm.Instructions.Clear();
xAsm.DataMembers.Clear();
var xRenderer = new Renderer();
xRenderer.DoRender();
if (!Directory.Exists(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location),
"Output"))) {
Directory.CreateDirectory(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location),
"Output"));
}
using (var xOutput = new StreamWriter(Path.Combine(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location),
"Output"),
"TheOutput.asm"))) {
xAsm.FlushText(xOutput);
}
using (Stream xOutput = new FileStream(Path.Combine(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location),
"Output"),
"TheOutput.bin"), FileMode.Create)) {
xAsm.FlushBinary(xOutput, 0x200000);
}
#else
TestCodeGenerator.Execute();
#endif
//InvalidOpcodeTester.Initialize();
//InvalidOpcodeTester.ExecuteSingle(typeof(Move), 0);
//InvalidOpcodeTester.GenerateHtml(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location),
// "Output.html"));
//InvalidOpcodeTester.GenerateXml(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location),
// "Output.xml"));
}catch(InvalidOpcodeTester.AbortException){
InvalidOpcodeTester.GenerateHtml(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location),
"Output.html"));
InvalidOpcodeTester.GenerateXml(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location),
"Output.xml"));
} catch (Exception E) { Console.WriteLine(E.ToString()); }
finally {
Console.WriteLine("Finished");
Console.ReadLine();
Console.ReadLine();
}
}
}
}