From ceefce4e05f21c34b8a417b8a21deb0a103fa6ce Mon Sep 17 00:00:00 2001
From: kudzu_cp <6d05c8c8ef5431987001abfdb2eadc9593ac9498>
Date: Tue, 12 Jun 2012 15:06:12 +0000
Subject: [PATCH] X#
---
source2/Compiler/Cosmos.XSharp/Parser.cs | 5 +--
source2/Compiler/Cosmos.XSharp/Token.cs | 2 +-
source2/Users/Kudzu/Kudzu-Notes.html | 9 +++-
.../Playground.Matthijs.Test.csproj | 6 ---
.../Users/Matthijs/MatthijsPlayground/Test.cs | 21 ---------
.../Users/Matthijs/MatthijsPlayground/Test.xs | 43 ++++++++++++++++---
source2/VSIP/Cosmos.VS.XSharp/Scanner.cs | 2 -
7 files changed, 46 insertions(+), 42 deletions(-)
delete mode 100644 source2/Users/Matthijs/MatthijsPlayground/Test.cs
diff --git a/source2/Compiler/Cosmos.XSharp/Parser.cs b/source2/Compiler/Cosmos.XSharp/Parser.cs
index 4a90a7df3..432435cc6 100644
--- a/source2/Compiler/Cosmos.XSharp/Parser.cs
+++ b/source2/Compiler/Cosmos.XSharp/Parser.cs
@@ -22,6 +22,7 @@ namespace Cosmos.Compiler.XSharp {
"EBX", "BX", "BH", "BL",
"ECX", "CX", "CH", "CL",
"EDX", "EX", "DH", "DL",
+ "ESI", "EDI", "ESP", "EBP"
};
protected void NewToken(ref int rPos) {
@@ -46,10 +47,6 @@ namespace Cosmos.Compiler.XSharp {
mStart = rPos;
return;
}
- } else if (xString == "++") {
- xToken.Type = TokenType.Inc;
- } else if (xString == "--") {
- xToken.Type = TokenType.Dec;
} else if (xString == "[") {
xToken.Type = TokenType.BracketLeft;
} else if (xString == "]") {
diff --git a/source2/Compiler/Cosmos.XSharp/Token.cs b/source2/Compiler/Cosmos.XSharp/Token.cs
index 7476ab68c..addd6c905 100644
--- a/source2/Compiler/Cosmos.XSharp/Token.cs
+++ b/source2/Compiler/Cosmos.XSharp/Token.cs
@@ -10,7 +10,7 @@ namespace Cosmos.Compiler.XSharp {
//
Register, Label, OpCode, ValueNumber,
// Symbols
- Assignment, BracketLeft, BracketRight, Plus, Minus, Inc, Dec,
+ Assignment, BracketLeft, BracketRight, Plus, Minus,
//
WhiteSpace,
// For now used during scanning while user is typing, but in future could be user methods we have to find etc
diff --git a/source2/Users/Kudzu/Kudzu-Notes.html b/source2/Users/Kudzu/Kudzu-Notes.html
index 59f1713d2..700fdc69f 100644
--- a/source2/Users/Kudzu/Kudzu-Notes.html
+++ b/source2/Users/Kudzu/Kudzu-Notes.html
@@ -9,7 +9,14 @@
Comsmos.VS.Windows - use vsix reg tool
Convert current DB from FB to SQL Compact
- Installer as part of bat: how do we get it to stop asking UAC every time?
+ Installer as part of bat: how do we get it to stop asking UAC every time?
+
Dynamic load/unload IL2CPU and other parts so we dont need to exit and run
install.bat every time for changes
diff --git a/source2/Users/Matthijs/MatthijsPlayground/Playground.Matthijs.Test.csproj b/source2/Users/Matthijs/MatthijsPlayground/Playground.Matthijs.Test.csproj
index 7bc835ca3..c7c6ce3da 100644
--- a/source2/Users/Matthijs/MatthijsPlayground/Playground.Matthijs.Test.csproj
+++ b/source2/Users/Matthijs/MatthijsPlayground/Playground.Matthijs.Test.csproj
@@ -42,11 +42,6 @@
-
- True
- True
- Test.xs
-
@@ -73,7 +68,6 @@
CosmosXSharpGenerator
- Test.cs
diff --git a/source2/Users/Matthijs/MatthijsPlayground/Test.cs b/source2/Users/Matthijs/MatthijsPlayground/Test.cs
deleted file mode 100644
index cf592d0c6..000000000
--- a/source2/Users/Matthijs/MatthijsPlayground/Test.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-using System.Linq;
-using Cosmos.Assembler;
-using Cosmos.Assembler.x86;
-
-namespace MatthijsPlayground
-{
- public class Test: Cosmos.IL2CPU.Plugs.AssemblerMethod
- {
- public override void AssembleNew(object aAssembler, object aMethodInfo)
- {
-new Comment("This is a comment");
-new Comment("This next line allows emission of standard yucky Intel mnemonics");
-new LiteralAssemblerCode("Mov EAX, 1");
-new Comment("This is X# code");
-new Move{DestinationReg = RegistersEnum.EAX, SourceValue = 1};
-new Move{DestinationReg = RegistersEnum.EDX, SourceValue = 2};
-new Move{DestinationReg = RegistersEnum.EDX, SourceValue = 2};
- }
- }
-}
diff --git a/source2/Users/Matthijs/MatthijsPlayground/Test.xs b/source2/Users/Matthijs/MatthijsPlayground/Test.xs
index a047b4160..30b07474f 100644
--- a/source2/Users/Matthijs/MatthijsPlayground/Test.xs
+++ b/source2/Users/Matthijs/MatthijsPlayground/Test.xs
@@ -1,9 +1,38 @@
-# This is a comment
+# From Entry.CS
-# This next line allows emission of standard yucky Intel mnemonics
-! Mov EAX, 1
+# EBP is restored by PopAll, but SendFrame uses it. Could
+# get it from the PushAll data, but this is easier.
+CallerEBP = EBP
-# This is X# code
-EAX = 1
-EDX = 2
-EDX = 2
+# Could get ESP from PushAll but this is easier.
+# Also allows us to use the stack before PushAll if we ever need it.
+
+# We cant modify any registers since we havent done PushAll yet
+# Maybe we could do a sub(4) on memory direct..
+# But for now we remove from ESP which the Int3 produces,
+# store ESP, then restore ESP so we don't cause stack corruption.
+# 12 bytes for EFLAGS, CS, EIP
+ESP + 12
+CallerESP = ESP
+ESP - 12
+
+PushAll
+
+# Save current ESP so we can look at the results of PushAll later
+PushAllPtr = ESP
+
+# Get current ESP and add 32. This will skip over the PushAll and point us at the call data from Int3.
+EBP = ESP
+EBP + 32
+
+# Caller EIP
+EAX = EBP[0]
+
+# EIP is pointer to op after our call. Int3 is 1 byte so we subtract 1.
+# Note - when we used call it was 5 (the size of our call + address)
+# so we get the EIP as IL2CPU records it. Its also useful for when we will
+# be changing ops that call this stub.
+EAX - 1
+
+# Store it for later use.
+CallerEIP = EAX
diff --git a/source2/VSIP/Cosmos.VS.XSharp/Scanner.cs b/source2/VSIP/Cosmos.VS.XSharp/Scanner.cs
index f5c46c872..00714b800 100644
--- a/source2/VSIP/Cosmos.VS.XSharp/Scanner.cs
+++ b/source2/VSIP/Cosmos.VS.XSharp/Scanner.cs
@@ -39,8 +39,6 @@ namespace Cosmos.VS.XSharp {
mTokenMap[(int)XSC.TokenType.BracketRight] = new TokenData { Type = TokenType.Delimiter , Color = TokenColor.Text };
mTokenMap[(int)XSC.TokenType.Plus] = new TokenData { Type = TokenType.Operator , Color = TokenColor.Text };
mTokenMap[(int)XSC.TokenType.Minus] = new TokenData { Type = TokenType.Operator , Color = TokenColor.Text };
- mTokenMap[(int)XSC.TokenType.Inc] = new TokenData { Type = TokenType.Operator , Color = TokenColor.Text };
- mTokenMap[(int)XSC.TokenType.Dec] = new TokenData { Type = TokenType.Operator, Color = TokenColor.Text };
mTokenMap[(int)XSC.TokenType.WhiteSpace] = new TokenData { Type = TokenType.WhiteSpace, Color = TokenColor.Text };
mTokenMap[(int)XSC.TokenType.Unknown] = new TokenData { Type = TokenType.Unknown, Color = TokenColor.Text };
}