mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-13 03:31:22 +00:00
X#
This commit is contained in:
parent
1491759f7f
commit
96bb89aaf5
11 changed files with 44 additions and 13 deletions
|
|
@ -75,6 +75,11 @@
|
|||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Old\Screen.cs" />
|
||||
<Compile Include="Old\CmdSend.cs" />
|
||||
<Compile Include="Screen.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Screen.xs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Serial.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
|
|
@ -108,6 +113,7 @@
|
|||
<None Include="Cosmos.snk" />
|
||||
<None Include="Screen.xs">
|
||||
<Generator>CosmosXSharpGenerator</Generator>
|
||||
<LastGenOutput>Screen.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="Serial.xs">
|
||||
<Generator>CosmosXSharpGenerator</Generator>
|
||||
|
|
|
|||
|
|
@ -26,11 +26,11 @@ namespace Cosmos.Debug.DebugStub {
|
|||
// Called before Kernel runs. Inits debug stub, etc
|
||||
public class Init : CodeBlock {
|
||||
public override void Assemble() {
|
||||
Call<Cls>();
|
||||
Call("DebugStub_Cls");
|
||||
Call<DisplayWaitMsg>();
|
||||
Call<InitSerial>();
|
||||
Call<WaitForDbgHandshake>();
|
||||
Call<Cls>();
|
||||
Call("DebugStub_Cls");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace Cosmos.Debug.DebugStub {
|
|||
public partial class DebugStub : CodeGroup {
|
||||
protected const uint VidBase = 0xB8000;
|
||||
|
||||
public class Cls : CodeBlock {
|
||||
public class Cls2 : CodeBlock {
|
||||
public override void Assemble() {
|
||||
ESI = VidBase;
|
||||
Label = "DebugStub_Cls_More";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Group DebugStub
|
||||
|
||||
procedure Cls2 {
|
||||
procedure Cls {
|
||||
# VidBase
|
||||
ESI = $B8000
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ BeginLoop:
|
|||
|
||||
# End of Video Area
|
||||
# VidBase + 25 * 80 * 2 = B8FA0
|
||||
ESI < $B8FA0
|
||||
#ESI ? $B8FA0
|
||||
#if < goto BeginLoop
|
||||
# If (ESI < $B8FA0) goto .BeginLoop
|
||||
If (ESI < $B8FA0) goto BeginLoop
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@ namespace Cosmos.Compiler.XSharp {
|
|||
public static string[] mKeywords = (
|
||||
"CALL"
|
||||
+ ",END,EXIT"
|
||||
+ ",GOTO, GROUP"
|
||||
+ ",GOTO,GROUP"
|
||||
+ ",IF,INTERRUPTHANDLER"
|
||||
+ ",JUMP"
|
||||
+ ",POPALL,PUSHALL,PROCEDURE,PORT"
|
||||
|
|
@ -146,6 +146,8 @@ namespace Cosmos.Compiler.XSharp {
|
|||
xToken.Type = TokenType.LessThan;
|
||||
} else if (xString == ">") {
|
||||
xToken.Type = TokenType.GreaterThan;
|
||||
} else if (xString == "?") {
|
||||
xToken.Type = TokenType.Question;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace Cosmos.Compiler.XSharp {
|
|||
// Values
|
||||
, ValueInt
|
||||
// Symbols
|
||||
, Equals, BracketLeft, BracketRight, Plus, Minus, Colon, Dollar, CurlyLeft, CurlyRight, Dot, Comma, LessThan, GreaterThan
|
||||
, Equals, BracketLeft, BracketRight, Plus, Minus, Colon, Dollar, CurlyLeft, CurlyRight, Dot, Comma, LessThan, GreaterThan, Question
|
||||
//
|
||||
, WhiteSpace
|
||||
// For now used during scanning while user is typing, but in future could be user methods we have to find etc
|
||||
|
|
|
|||
|
|
@ -88,8 +88,22 @@ namespace Cosmos.Compiler.XSharp {
|
|||
}
|
||||
);
|
||||
|
||||
// TODO - Combine these to code to scan
|
||||
AddPattern("_REG < 123",
|
||||
AddPattern(new string[] { "if < goto .._ABC", "if < goto ._ABC", "if < goto _ABC" },
|
||||
delegate(TokenList aTokens, ref List<string> rCode) {
|
||||
string xLabel = GetLabel(aTokens, 3);
|
||||
rCode.Add("new ConditionalJump {{ Condition = ConditionalTestEnum.LessThan, DestinationLabel = " + Quoted(xLabel) + " }};");
|
||||
}
|
||||
);
|
||||
|
||||
AddPattern(new string[] { "if (_REG < 123) goto .._ABC", "if (_REG < 123) goto ._ABC", "if (_REG < 123) goto _ABC" },
|
||||
delegate(TokenList aTokens, ref List<string> rCode) {
|
||||
rCode.Add("new Compare {{ DestinationReg = RegistersEnum.{2}, SourceValue = {4} }};");
|
||||
string xLabel = GetLabel(aTokens, 7);
|
||||
rCode.Add("new ConditionalJump {{ Condition = ConditionalTestEnum.LessThan, DestinationLabel = " + Quoted(xLabel) + " }};");
|
||||
}
|
||||
);
|
||||
|
||||
AddPattern("_REG ? 123",
|
||||
"new Compare {{ DestinationReg = RegistersEnum.{0}, SourceValue = {2} }};"
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,10 @@
|
|||
To Do</h3>
|
||||
<ul>
|
||||
<li>X#<ul>
|
||||
<li>Emit X# comment source above each output</li>
|
||||
<li>_LABEL</li>
|
||||
<li>Combine register code</li>
|
||||
<li>Find out why installer doesnt replace XSharp extension without manual uninstall
|
||||
- important for user kit too</li>
|
||||
<li>Complete</li>
|
||||
<li>Code Completion</li>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,11 @@
|
|||
<p>
|
||||
Easy to parse</p>
|
||||
<p>
|
||||
1:1 mapping for debugging, non disconnect</p>
|
||||
Close to
|
||||
1:1 mapping for debugging, non disconnect. No large compounds.</p>
|
||||
<p>
|
||||
All x86 ops have a 1:1 X# op, but there can be more X# ops which have mult x86
|
||||
ops</p>
|
||||
<p>
|
||||
</p>
|
||||
|
||||
|
|
|
|||
|
|
@ -32,10 +32,11 @@ namespace Cosmos.VS.XSharp {
|
|||
}
|
||||
|
||||
private static string DoGenerate(string aInputFileName, string aInputFileContents, string aDefaultNamespace) {
|
||||
string xClassName = Path.GetFileNameWithoutExtension(aInputFileName);
|
||||
using (var xInput = new StringReader(aInputFileContents)) {
|
||||
using (var xOutput = new StringWriter()) {
|
||||
var xGenerator = new Cosmos.Compiler.XSharp.Generator();
|
||||
xGenerator.Execute(aDefaultNamespace, aInputFileName, xInput, xOutput);
|
||||
xGenerator.Execute(aDefaultNamespace, xClassName, xInput, xOutput);
|
||||
return xOutput.ToString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ namespace Cosmos.VS.XSharp {
|
|||
mTokenMap[(int)XSC.TokenType.Dollar] = new TokenData { Type = TokenType.Operator, Color = TokenColor.Text };
|
||||
mTokenMap[(int)XSC.TokenType.LessThan] = new TokenData { Type = TokenType.Operator, Color = TokenColor.Text };
|
||||
mTokenMap[(int)XSC.TokenType.GreaterThan] = new TokenData { Type = TokenType.Operator, Color = TokenColor.Text };
|
||||
mTokenMap[(int)XSC.TokenType.Question] = 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