mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-06 16:22:40 +00:00
Merge remote-tracking branch 'refs/remotes/CosmosOS/master' into crypto
This commit is contained in:
commit
cc62959dec
20 changed files with 119 additions and 158 deletions
|
|
@ -17,7 +17,7 @@ namespace DebugCompiler
|
||||||
var xEngine = new Engine();
|
var xEngine = new Engine();
|
||||||
// Sets the time before an error is registered. For example if set to 60 then if a kernel runs for more than 60 seconds then
|
// Sets the time before an error is registered. For example if set to 60 then if a kernel runs for more than 60 seconds then
|
||||||
// that kernel will be marked as a failiure and terminated
|
// that kernel will be marked as a failiure and terminated
|
||||||
xEngine.AllowedSecondsInKernel = 600;
|
xEngine.AllowedSecondsInKernel = 30;
|
||||||
|
|
||||||
// If you want to test only specific platforms, add them to the list, like next line. By default, all platforms are run.
|
// If you want to test only specific platforms, add them to the list, like next line. By default, all platforms are run.
|
||||||
xEngine.RunTargets.Add(RunTargetEnum.Bochs);
|
xEngine.RunTargets.Add(RunTargetEnum.Bochs);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
; Generated at 6/12/2016 3:34:04 PM
|
; Generated at 6/14/2016 12:11:29 PM
|
||||||
|
|
||||||
DebugStub_AsmBreakEIP dd 0
|
DebugStub_AsmBreakEIP dd 0
|
||||||
DebugStub_AsmOrigByte dd 0
|
DebugStub_AsmOrigByte dd 0
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
; Generated at 6/12/2016 3:34:04 PM
|
; Generated at 6/14/2016 12:11:29 PM
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
; Generated at 6/12/2016 3:34:04 PM
|
; Generated at 6/14/2016 12:11:29 PM
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
; Generated at 6/12/2016 3:34:04 PM
|
; Generated at 6/14/2016 12:11:29 PM
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
; Generated at 6/12/2016 3:34:04 PM
|
; Generated at 6/14/2016 12:11:29 PM
|
||||||
|
|
||||||
|
|
||||||
DebugStub_Const_Signature equ 427034631
|
DebugStub_Const_Signature equ 427034631
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
; Generated at 6/12/2016 3:34:04 PM
|
; Generated at 6/14/2016 12:11:29 PM
|
||||||
|
|
||||||
DebugStub_CallerEBP dd 0
|
DebugStub_CallerEBP dd 0
|
||||||
DebugStub_CallerEIP dd 0
|
DebugStub_CallerEIP dd 0
|
||||||
|
|
|
||||||
|
|
@ -1,66 +1,2 @@
|
||||||
; Generated at 6/12/2016 3:34:04 PM
|
|
||||||
|
|
||||||
DebugStub_MaxBPId dd 0
|
Object reference not set to an instance of an object.
|
||||||
|
|
||||||
DebugStub_DebugBPs: TIMES 256 dd 0
|
|
||||||
|
|
||||||
DebugStub_Init:
|
|
||||||
Call DebugStub_Cls
|
|
||||||
Call DebugStub_DisplayWaitMsg
|
|
||||||
Call DebugStub_InitSerial
|
|
||||||
Call DebugStub_WaitForDbgHandshake
|
|
||||||
Call DebugStub_Cls
|
|
||||||
|
|
||||||
DebugStub_Init_Exit:
|
|
||||||
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_Init_Exit
|
|
||||||
Ret
|
|
||||||
|
|
||||||
|
|
||||||
DebugStub_WaitForSignature:
|
|
||||||
mov dword EBX, 0x0
|
|
||||||
|
|
||||||
DebugStub_WaitForSignature_Block1_Begin:
|
|
||||||
cmp dword EBX, DebugStub_Const_Signature
|
|
||||||
JE near DebugStub_WaitForSignature_Block1_End
|
|
||||||
Call DebugStub_ComReadAL
|
|
||||||
mov byte BL, AL
|
|
||||||
ror dword EBX, 0x8
|
|
||||||
Jmp DebugStub_WaitForSignature_Block1_Begin
|
|
||||||
|
|
||||||
DebugStub_WaitForSignature_Block1_End:
|
|
||||||
|
|
||||||
DebugStub_WaitForSignature_Exit:
|
|
||||||
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_WaitForSignature_Exit
|
|
||||||
Ret
|
|
||||||
|
|
||||||
|
|
||||||
DebugStub_WaitForDbgHandshake:
|
|
||||||
mov byte AL, 0x0
|
|
||||||
Call DebugStub_ComWriteAL
|
|
||||||
mov byte AL, 0x0
|
|
||||||
Call DebugStub_ComWriteAL
|
|
||||||
mov byte AL, 0x0
|
|
||||||
Call DebugStub_ComWriteAL
|
|
||||||
push dword DebugStub_Const_Signature
|
|
||||||
mov dword ESI, ESP
|
|
||||||
Call DebugStub_ComWrite32
|
|
||||||
pop dword EAX
|
|
||||||
mov byte AL, DebugStub_Const_Ds2Vs_Started
|
|
||||||
Call DebugStub_ComWriteAL
|
|
||||||
Call DebugStub_WaitForSignature
|
|
||||||
Call DebugStub_ProcessCommandBatch
|
|
||||||
Call DebugStub_Hook_OnHandshakeCompleted
|
|
||||||
|
|
||||||
DebugStub_WaitForDbgHandshake_Exit:
|
|
||||||
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_WaitForDbgHandshake_Exit
|
|
||||||
Ret
|
|
||||||
|
|
||||||
%ifndef Exclude_Dummy_Hooks
|
|
||||||
|
|
||||||
DebugStub_Hook_OnHandshakeCompleted:
|
|
||||||
|
|
||||||
DebugStub_Hook_OnHandshakeCompleted_Exit:
|
|
||||||
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_Hook_OnHandshakeCompleted_Exit
|
|
||||||
Ret
|
|
||||||
|
|
||||||
%endif
|
|
||||||
|
|
|
||||||
|
|
@ -1,47 +1,49 @@
|
||||||
; Generated at 6/12/2016 3:34:04 PM
|
; Generated at 14-6-2016 12:37:38
|
||||||
|
|
||||||
DebugWaitMsg db 96, 87, 97, 105, 116, 105, 110, 103, 32, 102, 111, 114, 32, 100, 101, 98, 117, 103, 103, 101, 114, 32, 99, 111, 110, 110, 101, 99, 116, 105, 111, 110, 46, 46, 46, 96, 0
|
|
||||||
|
|
||||||
%ifndef Exclude_Memory_Based_Console
|
|
||||||
DebugStub_Const_VidBase equ 753664
|
|
||||||
|
|
||||||
DebugStub_Cls:
|
|
||||||
mov dword ESI, DebugStub_Const_VidBase
|
|
||||||
|
|
||||||
DebugStub_Cls_Block1_Begin:
|
|
||||||
cmp dword ESI, 0xB8FA0
|
|
||||||
JNB near DebugStub_Cls_Block1_End
|
|
||||||
mov dword [ESI], 0x0
|
|
||||||
inc dword ESI
|
|
||||||
mov dword [ESI], 0xA
|
|
||||||
inc dword ESI
|
|
||||||
Jmp DebugStub_Cls_Block1_Begin
|
|
||||||
|
|
||||||
DebugStub_Cls_Block1_End:
|
|
||||||
|
|
||||||
DebugStub_Cls_Exit:
|
|
||||||
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_Cls_Exit
|
|
||||||
Ret
|
|
||||||
|
|
||||||
|
|
||||||
DebugStub_DisplayWaitMsg:
|
DebugWaitMsg db 87, 97, 105, 116, 105, 110, 103, 32, 102, 111, 114, 32, 100, 101, 98, 117, 103, 103, 101, 114, 32, 99, 111, 110, 110, 101, 99, 116, 105, 111, 110, 46, 46, 46, 0
|
||||||
mov dword ESI, DebugWaitMsg
|
|
||||||
mov dword EDI, DebugStub_Const_VidBase
|
|
||||||
add dword EDI, 0x668
|
|
||||||
|
|
||||||
DebugStub_DisplayWaitMsg_Block1_Begin:
|
%ifndef Exclude_Memory_Based_Console
|
||||||
cmp dword [ESI], 0x0
|
DebugStub_Const_VidBase equ 753664
|
||||||
JE near DebugStub_DisplayWaitMsg_Block1_End
|
|
||||||
mov byte AL, [ESI]
|
|
||||||
mov byte [EDI], AL
|
|
||||||
inc dword ESI
|
|
||||||
add dword EDI, 0x2
|
|
||||||
Jmp DebugStub_DisplayWaitMsg_Block1_Begin
|
|
||||||
|
|
||||||
DebugStub_DisplayWaitMsg_Block1_End:
|
DebugStub_Cls:
|
||||||
|
mov dword ESI, DebugStub_Const_VidBase
|
||||||
|
|
||||||
DebugStub_DisplayWaitMsg_Exit:
|
DebugStub_Cls_Block1_Begin:
|
||||||
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_DisplayWaitMsg_Exit
|
cmp dword ESI, 0xB8FA0
|
||||||
Ret
|
JNB near DebugStub_Cls_Block1_End
|
||||||
|
mov dword [ESI], 0x0
|
||||||
|
inc dword ESI
|
||||||
|
mov dword [ESI], 0xA
|
||||||
|
inc dword ESI
|
||||||
|
Jmp DebugStub_Cls_Block1_Begin
|
||||||
|
|
||||||
|
DebugStub_Cls_Block1_End:
|
||||||
|
|
||||||
|
DebugStub_Cls_Exit:
|
||||||
|
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_Cls_Exit
|
||||||
|
Ret
|
||||||
|
|
||||||
|
|
||||||
|
DebugStub_DisplayWaitMsg:
|
||||||
|
mov dword ESI, DebugWaitMsg
|
||||||
|
mov dword EDI, DebugStub_Const_VidBase
|
||||||
|
add dword EDI, 0x668
|
||||||
|
|
||||||
|
DebugStub_DisplayWaitMsg_Block1_Begin:
|
||||||
|
cmp byte [ESI], 0x0
|
||||||
|
JE near DebugStub_DisplayWaitMsg_Block1_End
|
||||||
|
mov byte AL, [ESI]
|
||||||
|
mov byte [EDI], AL
|
||||||
|
inc dword ESI
|
||||||
|
add dword EDI, 0x2
|
||||||
|
Jmp DebugStub_DisplayWaitMsg_Block1_Begin
|
||||||
|
|
||||||
|
DebugStub_DisplayWaitMsg_Block1_End:
|
||||||
|
|
||||||
|
DebugStub_DisplayWaitMsg_Exit:
|
||||||
|
mov dword [static_field__Cosmos_Core_INTs_mLastKnownAddress], DebugStub_DisplayWaitMsg_Exit
|
||||||
|
Ret
|
||||||
|
|
||||||
|
%endif
|
||||||
|
|
||||||
%endif
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ const VidBase = $B8000
|
||||||
|
|
||||||
function Cls {
|
function Cls {
|
||||||
ESI = #VidBase
|
ESI = #VidBase
|
||||||
|
|
||||||
// End of Video Area
|
// End of Video Area
|
||||||
// VidBase + 25 * 80 * 2 = B8FA0
|
// VidBase + 25 * 80 * 2 = B8FA0
|
||||||
while ESI < $B8FA0 {
|
while ESI < $B8FA0 {
|
||||||
|
|
@ -38,4 +38,4 @@ function DisplayWaitMsg {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
! %endif
|
! %endif
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
; Generated at 6/12/2016 3:34:04 PM
|
; Generated at 6/14/2016 12:11:29 PM
|
||||||
|
|
||||||
|
|
||||||
%ifndef Exclude_IOPort_Based_SerialInit
|
%ifndef Exclude_IOPort_Based_SerialInit
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
; Generated at 6/12/2016 3:34:04 PM
|
; Generated at 6/14/2016 12:11:29 PM
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
; Generated at 6/12/2016 3:34:04 PM
|
; Generated at 6/14/2016 12:11:29 PM
|
||||||
|
|
||||||
DebugStub_ComAddr dd 1016
|
DebugStub_ComAddr dd 1016
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
; Generated at 6/12/2016 3:34:04 PM
|
; Generated at 6/14/2016 12:11:29 PM
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
; Generated at 6/12/2016 3:34:04 PM
|
; Generated at 6/14/2016 12:11:29 PM
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,28 +13,27 @@ namespace XSharp.Compiler {
|
||||||
|
|
||||||
var xGenerator = new AsmGenerator();
|
var xGenerator = new AsmGenerator();
|
||||||
|
|
||||||
string[] xFiles;
|
//string[] xFiles;
|
||||||
if (Directory.Exists(xSrc))
|
//if (Directory.Exists(xSrc))
|
||||||
{
|
//{
|
||||||
xFiles = Directory.GetFiles(xSrc, "*.xs");
|
// xFiles = Directory.GetFiles(xSrc, "*.xs");
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
xFiles = new string[] { xSrc };
|
|
||||||
}
|
|
||||||
foreach (var xFile in xFiles)
|
|
||||||
{
|
|
||||||
xGenerator.GenerateToFiles(xFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
// var xAsm = new Assembler();
|
|
||||||
// var xStreamReader = new StringReader(@"namespace Test
|
|
||||||
// var CallerEBP
|
|
||||||
// while ESI != .CallerEBP {
|
|
||||||
// ! nop
|
|
||||||
//}
|
//}
|
||||||
// ");
|
//else
|
||||||
// var xResult = xGenerator.Generate(xStreamReader);
|
//{
|
||||||
|
// xFiles = new string[] { xSrc };
|
||||||
|
//}
|
||||||
|
//foreach (var xFile in xFiles)
|
||||||
|
//{
|
||||||
|
// xGenerator.GenerateToFiles(xFile);
|
||||||
|
//}
|
||||||
|
|
||||||
|
var xAsm = new Assembler();
|
||||||
|
var xStreamReader = new StringReader(@"namespace Test
|
||||||
|
while byte ESI[0] != 0 {
|
||||||
|
! nop
|
||||||
|
}
|
||||||
|
");
|
||||||
|
var xResult = xGenerator.Generate(xStreamReader);
|
||||||
Console.WriteLine("done");
|
Console.WriteLine("done");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Console.WriteLine(ex.ToString());
|
Console.WriteLine(ex.ToString());
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,7 @@ namespace XSharp.Compiler {
|
||||||
switch (value)
|
switch (value)
|
||||||
{
|
{
|
||||||
case "byte":
|
case "byte":
|
||||||
return RegisterSize.Int32;
|
return RegisterSize.Byte8;
|
||||||
case "word":
|
case "word":
|
||||||
return RegisterSize.Short16;
|
return RegisterSize.Short16;
|
||||||
case "dword":
|
case "dword":
|
||||||
|
|
@ -450,12 +450,6 @@ namespace XSharp.Compiler {
|
||||||
#region Handle all comparisons
|
#region Handle all comparisons
|
||||||
foreach (var xSize in xSizes)
|
foreach (var xSize in xSizes)
|
||||||
{
|
{
|
||||||
RegisterSize? xTypedSize = null;
|
|
||||||
if (xSize != "")
|
|
||||||
{
|
|
||||||
xTypedSize = GetSize(xSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var xComparison in mCompareOps)
|
foreach (var xComparison in mCompareOps)
|
||||||
{
|
{
|
||||||
var xComparisonToken = new Token(-1);
|
var xComparisonToken = new Token(-1);
|
||||||
|
|
@ -467,8 +461,10 @@ namespace XSharp.Compiler {
|
||||||
(tokenOffset, tokenList) =>
|
(tokenOffset, tokenList) =>
|
||||||
{
|
{
|
||||||
var xOffset = tokenOffset;
|
var xOffset = tokenOffset;
|
||||||
|
RegisterSize? xTypedSize = null;
|
||||||
if (tokenList[xOffset].Type != TokenType.Register)
|
if (tokenList[xOffset].Type != TokenType.Register)
|
||||||
{
|
{
|
||||||
|
xTypedSize = GetSize(tokenList[xOffset]);
|
||||||
xOffset += 1;
|
xOffset += 1;
|
||||||
}
|
}
|
||||||
XS.Compare(tokenList[xOffset + 0].Register, tokenList[xOffset + 2].IntValue, size: xTypedSize);
|
XS.Compare(tokenList[xOffset + 0].Register, tokenList[xOffset + 2].IntValue, size: xTypedSize);
|
||||||
|
|
@ -478,8 +474,10 @@ namespace XSharp.Compiler {
|
||||||
(tokenOffset, tokenList) =>
|
(tokenOffset, tokenList) =>
|
||||||
{
|
{
|
||||||
var xOffset = tokenOffset;
|
var xOffset = tokenOffset;
|
||||||
|
RegisterSize? xTypedSize = null;
|
||||||
if (tokenList[xOffset].Type != TokenType.Register)
|
if (tokenList[xOffset].Type != TokenType.Register)
|
||||||
{
|
{
|
||||||
|
xTypedSize = GetSize(tokenList[xOffset]);
|
||||||
xOffset += 1;
|
xOffset += 1;
|
||||||
}
|
}
|
||||||
XS.Compare(tokenList[xOffset + 0].Register, tokenList[xOffset + 2].Register);
|
XS.Compare(tokenList[xOffset + 0].Register, tokenList[xOffset + 2].Register);
|
||||||
|
|
@ -533,8 +531,10 @@ namespace XSharp.Compiler {
|
||||||
(tokenOffset, tokenList) =>
|
(tokenOffset, tokenList) =>
|
||||||
{
|
{
|
||||||
var xOffset = tokenOffset;
|
var xOffset = tokenOffset;
|
||||||
|
RegisterSize? xTypedSize = null;
|
||||||
if (tokenList[xOffset].Type != TokenType.Register)
|
if (tokenList[xOffset].Type != TokenType.Register)
|
||||||
{
|
{
|
||||||
|
xTypedSize = GetSize(tokenList[xOffset]);
|
||||||
xOffset += 1;
|
xOffset += 1;
|
||||||
}
|
}
|
||||||
XS.Compare(tokenList[xOffset + 0].Register, tokenList[xOffset + 5].IntValue, destinationDisplacement: (int)tokenList[xOffset + 2].IntValue, size: xTypedSize);
|
XS.Compare(tokenList[xOffset + 0].Register, tokenList[xOffset + 5].IntValue, destinationDisplacement: (int)tokenList[xOffset + 2].IntValue, size: xTypedSize);
|
||||||
|
|
@ -544,8 +544,10 @@ namespace XSharp.Compiler {
|
||||||
(tokenOffset, tokenList) =>
|
(tokenOffset, tokenList) =>
|
||||||
{
|
{
|
||||||
var xOffset = tokenOffset;
|
var xOffset = tokenOffset;
|
||||||
|
RegisterSize? xTypedSize = null;
|
||||||
if (tokenList[xOffset].Type != TokenType.Register)
|
if (tokenList[xOffset].Type != TokenType.Register)
|
||||||
{
|
{
|
||||||
|
xTypedSize = GetSize(tokenList[xOffset]);
|
||||||
xOffset += 1;
|
xOffset += 1;
|
||||||
}
|
}
|
||||||
XS.Compare(tokenList[xOffset + 0].Register, tokenList[xOffset + 2].IntValue, destinationDisplacement: -(int)tokenList[xOffset + 1].IntValue, size: xTypedSize);
|
XS.Compare(tokenList[xOffset + 0].Register, tokenList[xOffset + 2].IntValue, destinationDisplacement: -(int)tokenList[xOffset + 1].IntValue, size: xTypedSize);
|
||||||
|
|
@ -577,8 +579,10 @@ namespace XSharp.Compiler {
|
||||||
(tokenOffset, tokenList) =>
|
(tokenOffset, tokenList) =>
|
||||||
{
|
{
|
||||||
var xOffset = tokenOffset;
|
var xOffset = tokenOffset;
|
||||||
|
RegisterSize? xTypedSize = null;
|
||||||
if (tokenList[xOffset].Type != TokenType.Register)
|
if (tokenList[xOffset].Type != TokenType.Register)
|
||||||
{
|
{
|
||||||
|
xTypedSize = GetSize(tokenList[xOffset]);
|
||||||
xOffset += 1;
|
xOffset += 1;
|
||||||
}
|
}
|
||||||
XS.Compare(tokenList[xOffset + 0].Register, ConstLabel(tokenList[xOffset + 2]), destinationDisplacement: (int)tokenList[xOffset + 1].IntValue, sourceIsIndirect: true, size: xTypedSize);
|
XS.Compare(tokenList[xOffset + 0].Register, ConstLabel(tokenList[xOffset + 2]), destinationDisplacement: (int)tokenList[xOffset + 1].IntValue, sourceIsIndirect: true, size: xTypedSize);
|
||||||
|
|
@ -588,8 +592,10 @@ namespace XSharp.Compiler {
|
||||||
(tokenOffset, tokenList) =>
|
(tokenOffset, tokenList) =>
|
||||||
{
|
{
|
||||||
var xOffset = tokenOffset;
|
var xOffset = tokenOffset;
|
||||||
|
RegisterSize? xTypedSize = null;
|
||||||
if (tokenList[xOffset].Type != TokenType.Register)
|
if (tokenList[xOffset].Type != TokenType.Register)
|
||||||
{
|
{
|
||||||
|
xTypedSize = GetSize(tokenList[xOffset]);
|
||||||
xOffset += 1;
|
xOffset += 1;
|
||||||
}
|
}
|
||||||
XS.Compare(tokenList[xOffset + 0].Register, ConstLabel(tokenList[xOffset + 2]), destinationDisplacement: (int)tokenList[xOffset + 1].IntValue, size: xTypedSize);
|
XS.Compare(tokenList[xOffset + 0].Register, ConstLabel(tokenList[xOffset + 2]), destinationDisplacement: (int)tokenList[xOffset + 1].IntValue, size: xTypedSize);
|
||||||
|
|
@ -599,8 +605,10 @@ namespace XSharp.Compiler {
|
||||||
(tokenOffset, tokenList) =>
|
(tokenOffset, tokenList) =>
|
||||||
{
|
{
|
||||||
var xOffset = tokenOffset;
|
var xOffset = tokenOffset;
|
||||||
if (tokenList[xOffset + 2].Type != TokenType.Register)
|
RegisterSize? xTypedSize = null;
|
||||||
|
if (tokenList[xOffset].Type != TokenType.Register)
|
||||||
{
|
{
|
||||||
|
xTypedSize = GetSize(tokenList[xOffset]);
|
||||||
xOffset += 1;
|
xOffset += 1;
|
||||||
}
|
}
|
||||||
XS.Compare(GetLabel(tokenList[xOffset + 0]), tokenList[xOffset + 2].IntValue, destinationIsIndirect: true, size: xTypedSize.GetValueOrDefault(RegisterSize.Int32));
|
XS.Compare(GetLabel(tokenList[xOffset + 0]), tokenList[xOffset + 2].IntValue, destinationIsIndirect: true, size: xTypedSize.GetValueOrDefault(RegisterSize.Int32));
|
||||||
|
|
@ -621,8 +629,10 @@ namespace XSharp.Compiler {
|
||||||
(tokenOffset, tokenList) =>
|
(tokenOffset, tokenList) =>
|
||||||
{
|
{
|
||||||
var xOffset = tokenOffset;
|
var xOffset = tokenOffset;
|
||||||
if (tokenList[xOffset + 2].Type != TokenType.Register)
|
RegisterSize? xTypedSize = null;
|
||||||
|
if (tokenList[xOffset].Type != TokenType.Register)
|
||||||
{
|
{
|
||||||
|
xTypedSize = GetSize(tokenList[xOffset]);
|
||||||
xOffset += 1;
|
xOffset += 1;
|
||||||
}
|
}
|
||||||
XS.Compare(GetSimpleRef(tokenList[xOffset + 0]), ConstLabel(tokenList[xOffset + 3]), destinationIsIndirect: true, size: xTypedSize.GetValueOrDefault(RegisterSize.Int32));
|
XS.Compare(GetSimpleRef(tokenList[xOffset + 0]), ConstLabel(tokenList[xOffset + 3]), destinationIsIndirect: true, size: xTypedSize.GetValueOrDefault(RegisterSize.Int32));
|
||||||
|
|
|
||||||
|
|
@ -379,7 +379,7 @@ namespace XSharp.Compiler
|
||||||
|
|
||||||
public static void DataMember(string name, string value)
|
public static void DataMember(string name, string value)
|
||||||
{
|
{
|
||||||
Assembler.CurrentInstance.DataMembers.Add(new DataMember(name, "`" + value + "`"));
|
Assembler.CurrentInstance.DataMembers.Add(new DataMember(name, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DataMember(string name, uint elementCount, string size, string value)
|
public static void DataMember(string name, uint elementCount, string size, string value)
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,10 @@
|
||||||
<None Include="source.extension.vsixmanifest" />
|
<None Include="source.extension.vsixmanifest" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Cosmos.Assembler\Cosmos.Assembler.csproj">
|
||||||
|
<Project>{1116130E-28E0-428A-A597-F4B3B676C0CA}</Project>
|
||||||
|
<Name>Cosmos.Assembler</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\XSharp.Compiler\XSharp.Compiler.csproj">
|
<ProjectReference Include="..\XSharp.Compiler\XSharp.Compiler.csproj">
|
||||||
<Project>{A281A1B1-C718-4BCB-A7BE-ED840A70449A}</Project>
|
<Project>{A281A1B1-C718-4BCB-A7BE-ED840A70449A}</Project>
|
||||||
<Name>XSharp.Compiler</Name>
|
<Name>XSharp.Compiler</Name>
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ using Microsoft.VisualStudio.Shell.Interop;
|
||||||
using Microsoft.VisualStudio;
|
using Microsoft.VisualStudio;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Cosmos.Assembler;
|
||||||
|
|
||||||
namespace XSharp.VS {
|
namespace XSharp.VS {
|
||||||
// This class generates .asm files from .xs files.
|
// This class generates .asm files from .xs files.
|
||||||
|
|
@ -26,13 +27,22 @@ namespace XSharp.VS {
|
||||||
string xResult;
|
string xResult;
|
||||||
using (var xInput = new StringReader(aInputFileContents)) {
|
using (var xInput = new StringReader(aInputFileContents)) {
|
||||||
using (var xOut = new StringWriter()) {
|
using (var xOut = new StringWriter()) {
|
||||||
try {
|
try
|
||||||
var xGen = new XSharp.Compiler.AsmGenerator();
|
{
|
||||||
xGen.Generate(xInput, xOut);
|
new Assembler();
|
||||||
xResult =
|
try
|
||||||
"; Generated at " + DateTime.Now.ToString() + "\r\n"
|
{
|
||||||
+ "\r\n"
|
var xGen = new XSharp.Compiler.AsmGenerator();
|
||||||
+ xOut.ToString() + "\r\n";
|
xGen.Generate(xInput, xOut);
|
||||||
|
xResult =
|
||||||
|
"; Generated at " + DateTime.Now.ToString() + "\r\n"
|
||||||
|
+ "\r\n"
|
||||||
|
+ xOut.ToString() + "\r\n";
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Assembler.ClearCurrentInstance();
|
||||||
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
var xSB = new StringBuilder();
|
var xSB = new StringBuilder();
|
||||||
xSB.Append(xOut);
|
xSB.Append(xOut);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue