From b8669c55d73ceb3cad5046068ced2223aa92576a Mon Sep 17 00:00:00 2001
From: kudzu_cp <6d05c8c8ef5431987001abfdb2eadc9593ac9498>
Date: Tue, 19 Jun 2012 12:38:16 +0000
Subject: [PATCH]
---
.../Cosmos.Debug.DebugStub.csproj | 9 +++++
.../Cosmos.Compiler.DebugStub/Init.cs | 37 +++++++++++++++++++
.../Cosmos.Compiler.DebugStub/Init.xs | 10 +++++
.../Cosmos.Compiler.DebugStub/Old/Init.cs | 11 ------
.../Cosmos.IL2CPU.X86/CosmosAssembler.cs | 2 +-
5 files changed, 57 insertions(+), 12 deletions(-)
create mode 100644 source2/Compiler/Cosmos.Compiler.DebugStub/Init.cs
create mode 100644 source2/Compiler/Cosmos.Compiler.DebugStub/Init.xs
diff --git a/source2/Compiler/Cosmos.Compiler.DebugStub/Cosmos.Debug.DebugStub.csproj b/source2/Compiler/Cosmos.Compiler.DebugStub/Cosmos.Debug.DebugStub.csproj
index 6fc36a21e..52731b37b 100644
--- a/source2/Compiler/Cosmos.Compiler.DebugStub/Cosmos.Debug.DebugStub.csproj
+++ b/source2/Compiler/Cosmos.Compiler.DebugStub/Cosmos.Debug.DebugStub.csproj
@@ -64,6 +64,11 @@
+
+ True
+ True
+ Init.xs
+
@@ -110,6 +115,10 @@
+
+ CosmosXSharpGenerator
+ Init.cs
+
CosmosXSharpGenerator
Screen.cs
diff --git a/source2/Compiler/Cosmos.Compiler.DebugStub/Init.cs b/source2/Compiler/Cosmos.Compiler.DebugStub/Init.cs
new file mode 100644
index 000000000..191fe145e
--- /dev/null
+++ b/source2/Compiler/Cosmos.Compiler.DebugStub/Init.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Linq;
+using Cosmos.Assembler;
+using Cosmos.Assembler.x86;
+
+namespace Cosmos.Debug.DebugStub {
+ public class Init : Cosmos.Assembler.Code {
+ public override void Assemble() {
+ new Comment("X#: Group DebugStub");
+
+ new Comment("Called before Kernel runs. Inits debug stub, etc");
+
+ new Comment("X#: procedure Init {");
+ new Label("DebugStub_Init");
+
+ new Comment("X#: Call .Cls");
+ new Call { DestinationLabel = "DebugStub_Cls" };
+
+ new Comment("X#: Call .DisplayWaitMsg");
+ new Call { DestinationLabel = "DebugStub_DisplayWaitMsg" };
+
+ new Comment("X#: Call .InitSerial");
+ new Call { DestinationLabel = "DebugStub_InitSerial" };
+
+ new Comment("X#: Call .WaitForDbgHandshake");
+ new Call { DestinationLabel = "DebugStub_WaitForDbgHandshake" };
+
+ new Comment("X#: Call .Cls");
+ new Call { DestinationLabel = "DebugStub_Cls" };
+
+ new Comment("X#: }");
+ new Label("DebugStub_Init_Exit");
+ new Return();
+
+ }
+ }
+}
diff --git a/source2/Compiler/Cosmos.Compiler.DebugStub/Init.xs b/source2/Compiler/Cosmos.Compiler.DebugStub/Init.xs
new file mode 100644
index 000000000..caeb5b2b7
--- /dev/null
+++ b/source2/Compiler/Cosmos.Compiler.DebugStub/Init.xs
@@ -0,0 +1,10 @@
+Group DebugStub
+
+# Called before Kernel runs. Inits debug stub, etc
+procedure Init {
+ Call .Cls
+ Call .DisplayWaitMsg
+ Call .InitSerial
+ Call .WaitForDbgHandshake
+ Call .Cls
+}
diff --git a/source2/Compiler/Cosmos.Compiler.DebugStub/Old/Init.cs b/source2/Compiler/Cosmos.Compiler.DebugStub/Old/Init.cs
index 3db9ebb2f..ad83b4c99 100644
--- a/source2/Compiler/Cosmos.Compiler.DebugStub/Old/Init.cs
+++ b/source2/Compiler/Cosmos.Compiler.DebugStub/Old/Init.cs
@@ -23,17 +23,6 @@ namespace Cosmos.Debug.DebugStub {
});
}
- // Called before Kernel runs. Inits debug stub, etc
- public class Init : CodeBlock {
- public override void Assemble() {
- Call("DebugStub_Cls");
- Call("DebugStub_DisplayWaitMsg");
- Call();
- Call();
- Call("DebugStub_Cls");
- }
- }
-
public class WaitForSignature : CodeBlock {
public override void Assemble() {
EBX = 0;
diff --git a/source2/IL2CPU/Cosmos.IL2CPU.X86/CosmosAssembler.cs b/source2/IL2CPU/Cosmos.IL2CPU.X86/CosmosAssembler.cs
index 1c58d5d60..c4b8caeab 100644
--- a/source2/IL2CPU/Cosmos.IL2CPU.X86/CosmosAssembler.cs
+++ b/source2/IL2CPU/Cosmos.IL2CPU.X86/CosmosAssembler.cs
@@ -303,7 +303,7 @@ namespace Cosmos.IL2CPU.X86 {
new Comment(this, "END - SSE Init");
if (mComNumber > 0) {
- CodeBlock.Call();
+ new Call { DestinationLabel = "DebugStub_Init" };
}
// Jump to Kernel entry point