mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-20 12:58:39 +00:00
X#
This commit is contained in:
parent
3868b2aafd
commit
ceefce4e05
7 changed files with 46 additions and 42 deletions
|
|
@ -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 == "]") {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,14 @@
|
|||
</li>
|
||||
<li>Comsmos.VS.Windows - use vsix reg tool</li>
|
||||
<li>Convert current DB from FB to SQL Compact</li>
|
||||
<li>Installer as part of bat: how do we get it to stop asking UAC every time?</li>
|
||||
<li>Installer as part of bat: how do we get it to stop asking UAC every time?<ul>
|
||||
<li><a href="http://msmvps.com/blogs/martinzugec/archive/2008/05/16/ignore-uac-for-specific-programs.aspx">
|
||||
http://msmvps.com/blogs/martinzugec/archive/2008/05/16/ignore-uac-for-specific-programs.aspx</a></li>
|
||||
<li><a href="http://hardforum.com/archive/index.php/t-1611290.html">
|
||||
http://hardforum.com/archive/index.php/t-1611290.html</a></li>
|
||||
<li><a href="http://www.prnwatch.com/prio.html">http://www.prnwatch.com/prio.html</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Dynamic load/unload IL2CPU and other parts so we dont need to exit and run
|
||||
install.bat every time for changes</li>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -42,11 +42,6 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="Kernel.cs" />
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="Test.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Test.xs</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Kernel\Common\Cosmos.Common.Extensions\Cosmos.Common.Extensions.csproj">
|
||||
|
|
@ -73,7 +68,6 @@
|
|||
<ItemGroup>
|
||||
<None Include="Test.xs">
|
||||
<Generator>CosmosXSharpGenerator</Generator>
|
||||
<LastGenOutput>Test.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
|
|
|||
|
|
@ -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};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 };
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue