mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-10 02:02:30 +00:00
produces valid output now
This commit is contained in:
parent
066ae93575
commit
e1a1b54b67
4 changed files with 28 additions and 30 deletions
|
|
@ -88,28 +88,34 @@ namespace Indy.IL2CPU.Assembler {
|
|||
mOutputWriter.WriteLine("include '{0}'", xInclude);
|
||||
}
|
||||
mOutputWriter.WriteLine();
|
||||
mOutputWriter.WriteLine("section '.data' data readable writeable");
|
||||
mOutputWriter.WriteLine();
|
||||
foreach (DataMember xMember in mDataMembers) {
|
||||
mOutputWriter.WriteLine("\t" + xMember);
|
||||
}
|
||||
mOutputWriter.WriteLine();
|
||||
mOutputWriter.WriteLine("section '.code' code readable executable");
|
||||
mOutputWriter.WriteLine();
|
||||
mOutputWriter.WriteLine(" " + EntryPointLabelName + ":");
|
||||
foreach (Instruction x in mInstructions) {
|
||||
string prefix = "\t";
|
||||
if (x is Label) {
|
||||
mOutputWriter.WriteLine();
|
||||
prefix = " ";
|
||||
if (mDataMembers.Count > 0) {
|
||||
mOutputWriter.WriteLine("section '.data' data readable writeable");
|
||||
mOutputWriter.WriteLine();
|
||||
foreach (DataMember xMember in mDataMembers) {
|
||||
mOutputWriter.WriteLine("\t" + xMember);
|
||||
}
|
||||
mOutputWriter.WriteLine(prefix + x);
|
||||
mOutputWriter.WriteLine();
|
||||
}
|
||||
mOutputWriter.WriteLine();
|
||||
mOutputWriter.WriteLine("section '.idata' import data readable writeable");
|
||||
mOutputWriter.WriteLine();
|
||||
foreach (ImportMember xImportMember in mImportMembers) {
|
||||
mOutputWriter.WriteLine("\t" + xImportMember);
|
||||
if (mInstructions.Count > 0) {
|
||||
mOutputWriter.WriteLine("section '.code' code readable executable");
|
||||
mOutputWriter.WriteLine();
|
||||
mOutputWriter.WriteLine("\t" + EntryPointLabelName + ":");
|
||||
foreach (Instruction x in mInstructions) {
|
||||
string prefix = "\t\t";
|
||||
if (x is Label) {
|
||||
mOutputWriter.WriteLine();
|
||||
prefix = " ";
|
||||
}
|
||||
mOutputWriter.WriteLine(prefix + x);
|
||||
}
|
||||
mOutputWriter.WriteLine();
|
||||
}
|
||||
if (mImportMembers.Count > 0) {
|
||||
mOutputWriter.WriteLine("section '.idata' import data readable writeable");
|
||||
mOutputWriter.WriteLine();
|
||||
foreach (ImportMember xImportMember in mImportMembers) {
|
||||
mOutputWriter.WriteLine("\t" + xImportMember);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectView>ProjectFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -80,6 +80,8 @@ namespace Indy.IL2CPU {
|
|||
IL.Op.QueueMethod += QueueMethod;
|
||||
try {
|
||||
mMethods.Add(mCrawledAssembly.EntryPoint, false);
|
||||
// first instructions are for calling the entrypoint
|
||||
mAssembler.Add(new JumpAlways(new Label(mCrawledAssembly.EntryPoint).Name));
|
||||
ProcessAllMethods();
|
||||
} finally {
|
||||
mAssembler.Flush();
|
||||
|
|
|
|||
Loading…
Reference in a new issue