mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-12 11:11:45 +00:00
This commit is contained in:
parent
396f36eee7
commit
3ef5ecd323
5 changed files with 15 additions and 8 deletions
|
|
@ -10,6 +10,7 @@ Mov ECX, EAX
|
|||
Mov EAX, 0
|
||||
Call DebugStub_ComReadAL
|
||||
|
||||
Mov EBX, DebugBPs
|
||||
SHL EAX, 2
|
||||
Add EBX, EAX
|
||||
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ function BreakOnAddress2 {
|
|||
ComReadAL()
|
||||
|
||||
// Calculate location in table
|
||||
// Mov [EBX + EAX * 4], ECX would be better, but our asm doesn't handle this yet
|
||||
//EBX = @.DebugBPs
|
||||
// Mov [EBX + EAX * 4], ECX would be better, but our X# doesn't handle this yet
|
||||
EBX = @..DebugBPs
|
||||
EAX << 2
|
||||
EBX + EAX
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ namespace Cosmos.Compiler.XSharp {
|
|||
+ ",BYTE"
|
||||
+ ",CALL,CONST"
|
||||
+ ",DWORD"
|
||||
+ ",exit"
|
||||
+ ",function"
|
||||
+ ",GOTO,GROUP"
|
||||
+ ",IF,INTERRUPT,iret"
|
||||
|
|
|
|||
|
|
@ -27,6 +27,11 @@ namespace Cosmos.Compiler.XSharp {
|
|||
return Value;
|
||||
}
|
||||
|
||||
|
||||
static public implicit operator string(Token aToken) {
|
||||
return aToken.Value;
|
||||
}
|
||||
|
||||
public bool Matches(string aText) {
|
||||
return string.Equals(Value, aText, StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ namespace Cosmos.Compiler.XSharp {
|
|||
return FuncLabel("Block" + mBlockLabel + aLabel);
|
||||
}
|
||||
protected string GetLabel(Token aToken) {
|
||||
if (aToken.Type != TokenType.AlphaNum) {
|
||||
if (aToken.Type != TokenType.AlphaNum && !aToken.Matches("exit")) {
|
||||
throw new Exception("Label must be AlphaNum.");
|
||||
}
|
||||
|
||||
|
|
@ -179,7 +179,7 @@ namespace Cosmos.Compiler.XSharp {
|
|||
return "[" + xToken1 + " + " + aTokens[rIdx - 2] + "]";
|
||||
}
|
||||
rIdx += 1;
|
||||
return xToken1.ToString();
|
||||
return xToken1;
|
||||
|
||||
} else if (xToken1.Type == TokenType.AlphaNum) {
|
||||
rIdx += 1;
|
||||
|
|
@ -187,7 +187,7 @@ namespace Cosmos.Compiler.XSharp {
|
|||
|
||||
} else if (xToken1.Type == TokenType.ValueInt) {
|
||||
rIdx += 1;
|
||||
return xToken1.ToString();
|
||||
return xToken1;
|
||||
|
||||
} else if (xToken1.Value == "#") {
|
||||
rIdx += 2;
|
||||
|
|
@ -430,12 +430,12 @@ namespace Cosmos.Compiler.XSharp {
|
|||
AddPattern("_REG = _REGADDR[-1]", "Mov {0}, [{2} - {5}]");
|
||||
|
||||
AddPattern("_REG = _ABC", delegate(TokenList aTokens, Assembler aAsm) {
|
||||
aAsm += "Mov {0}, [" + GetLabel(aTokens[2]) + "]";
|
||||
aAsm.Mov(aTokens[0], "[" + GetLabel(aTokens[2]) + "]");
|
||||
});
|
||||
// why not [var] like registers? Because its less frequent to access th ptr
|
||||
// why not [var] like registers? Because its less frequent to access the ptr
|
||||
// and it is like a reg.. without [] to get the value...
|
||||
AddPattern("_REG = @_ABC", delegate(TokenList aTokens, Assembler aAsm) {
|
||||
aAsm += "Mov {0}, " + GetLabel(aTokens[3]);
|
||||
aAsm.Mov(aTokens[0], GetLabel(aTokens[3]));
|
||||
});
|
||||
|
||||
AddPattern(new string[] {
|
||||
|
|
|
|||
Loading…
Reference in a new issue