mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-22 22:09:12 +00:00
.
This commit is contained in:
parent
e4a89f11bc
commit
64ada17c2d
16 changed files with 118 additions and 54 deletions
|
|
@ -1,4 +1,4 @@
|
|||
; Generated at 6/12/2016 9:54:11 AM
|
||||
; Generated at 6/12/2016 10:15:07 AM
|
||||
|
||||
DebugStub_AsmBreakEIP dd 0
|
||||
DebugStub_AsmOrigByte dd 0
|
||||
|
|
@ -48,9 +48,9 @@ DebugStub_SetINT1_TrapFLAG:
|
|||
push dword EBP
|
||||
push dword EAX
|
||||
Mov EBP, [DebugStub_CallerESP]
|
||||
Sub EBP, 4
|
||||
sub dword EBP, 0x4
|
||||
Mov EAX, [EBP]
|
||||
Or EAX, 0x0100
|
||||
or dword EAX, 0x100
|
||||
Mov [EBP], EAX
|
||||
pop dword EAX
|
||||
pop dword EBP
|
||||
|
|
@ -64,9 +64,9 @@ DebugStub_ResetINT1_TrapFLAG:
|
|||
push dword EBP
|
||||
push dword EAX
|
||||
Mov EBP, [DebugStub_CallerESP]
|
||||
Sub EBP, 4
|
||||
sub dword EBP, 0x4
|
||||
Mov EAX, [EBP]
|
||||
And EAX, 0xFEFF
|
||||
and dword EAX, 0xFEFF
|
||||
Mov [EBP], EAX
|
||||
pop dword EAX
|
||||
pop dword EBP
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
; Generated at 6/12/2016 9:54:11 AM
|
||||
; Generated at 6/12/2016 10:15:07 AM
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
; Generated at 6/12/2016 9:54:11 AM
|
||||
; Generated at 6/12/2016 10:15:07 AM
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
; Generated at 6/12/2016 9:54:11 AM
|
||||
; Generated at 6/12/2016 10:15:07 AM
|
||||
|
||||
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ Mov AL, DebugStub_Const_Ds2Vs_Stack
|
|||
Call DebugStub_ComWriteAL
|
||||
Mov ESI, [DebugStub_CallerESP]
|
||||
Mov EAX, [DebugStub_CallerEBP]
|
||||
Sub EAX, ESI
|
||||
sub dword EAX, ESI
|
||||
Call DebugStub_ComWriteAX
|
||||
Mov ESI, [DebugStub_CallerESP]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
; Generated at 6/12/2016 9:54:11 AM
|
||||
; Generated at 6/12/2016 10:15:07 AM
|
||||
|
||||
|
||||
DebugStub_Const_Signature equ 427034631
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
; Generated at 6/12/2016 9:54:11 AM
|
||||
; Generated at 6/12/2016 10:15:07 AM
|
||||
|
||||
DebugStub_CallerEBP dd 0
|
||||
DebugStub_CallerEIP dd 0
|
||||
|
|
@ -98,10 +98,10 @@ Ret
|
|||
|
||||
DebugStub_Executing:
|
||||
MOV EAX, DR6
|
||||
And EAX, 0x4000
|
||||
and dword EAX, 0x4000
|
||||
Cmp EAX, 0x4000
|
||||
JNE near DebugStub_Executing_Block1_End
|
||||
And EAX, 0xBFFF
|
||||
and dword EAX, 0xBFFF
|
||||
MOV DR6, EAX
|
||||
Call DebugStub_ResetINT1_TrapFLAG
|
||||
Call DebugStub_Break
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
; Generated at 6/12/2016 9:54:11 AM
|
||||
; Generated at 6/12/2016 10:15:08 AM
|
||||
|
||||
DebugStub_MaxBPId dd 0
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
; Generated at 6/12/2016 9:54:11 AM
|
||||
; Generated at 6/12/2016 10:15:08 AM
|
||||
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
; Generated at 6/12/2016 9:54:11 AM
|
||||
; Generated at 6/12/2016 10:15:08 AM
|
||||
|
||||
|
||||
%ifndef Exclude_IOPort_Based_SerialInit
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
; Generated at 6/12/2016 9:54:11 AM
|
||||
; Generated at 6/12/2016 10:15:08 AM
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
; Generated at 6/12/2016 9:54:11 AM
|
||||
; Generated at 6/12/2016 10:15:08 AM
|
||||
|
||||
DebugStub_ComAddr dd 1016
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
; Generated at 6/12/2016 9:54:11 AM
|
||||
; Generated at 6/12/2016 10:15:08 AM
|
||||
|
||||
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ add dword EBP, 0xC
|
|||
Mov [DebugStub_CallerESP], EBP
|
||||
Mov EBX, EAX
|
||||
MOV EAX, DR6
|
||||
And EAX, 0x4000
|
||||
and dword EAX, 0x4000
|
||||
Cmp EAX, 0x4000
|
||||
JE near DebugStub_TracerEntry_Block1_End
|
||||
dec dword EBX
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
; Generated at 6/12/2016 9:54:11 AM
|
||||
; Generated at 6/12/2016 10:15:08 AM
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -787,9 +787,13 @@ namespace XSharp.Compiler {
|
|||
});
|
||||
AddPattern(new string[] {
|
||||
"_REG - 1",
|
||||
}, delegate (TokenList aTokens) {
|
||||
XS.Sub(aTokens[0].Register, aTokens[2].IntValue);
|
||||
});
|
||||
AddPattern(new string[] {
|
||||
"_REG - _REG"
|
||||
}, delegate(TokenList aTokens) {
|
||||
XS.SubLiteral(GetSimpleRef(aTokens[0]), GetSimpleRef(aTokens[2]));
|
||||
}, delegate (TokenList aTokens) {
|
||||
XS.Sub(aTokens[0].Register, aTokens[2].Register);
|
||||
});
|
||||
AddPattern(new string[] {
|
||||
"_REG * 1",
|
||||
|
|
@ -829,21 +833,33 @@ namespace XSharp.Compiler {
|
|||
|
||||
AddPattern(new string[] {
|
||||
"_REG & 1",
|
||||
"_REG & _REG"
|
||||
}, delegate(TokenList aTokens) {
|
||||
XS.AndLiteral(GetSimpleRef(aTokens[0]), GetSimpleRef(aTokens[2]));
|
||||
XS.And(aTokens[0].Register, aTokens[2].IntValue);
|
||||
});
|
||||
AddPattern(new string[] {
|
||||
"_REG & _REG"
|
||||
}, delegate (TokenList aTokens) {
|
||||
XS.And(aTokens[0].Register, aTokens[2].Register);
|
||||
});
|
||||
AddPattern(new string[] {
|
||||
"_REG | 1",
|
||||
"_REG | _REG"
|
||||
}, delegate(TokenList aTokens) {
|
||||
XS.OrLiteral(GetSimpleRef(aTokens[0]), GetSimpleRef(aTokens[2]));
|
||||
XS.Or(aTokens[0].Register, aTokens[2].IntValue);
|
||||
});
|
||||
AddPattern(new string[] {
|
||||
"_REG | _REG"
|
||||
}, delegate (TokenList aTokens) {
|
||||
XS.Or(aTokens[0].Register, aTokens[2].Register);
|
||||
});
|
||||
AddPattern(new string[] {
|
||||
"_REG ^ 1",
|
||||
"_REG ^ _REG"
|
||||
}, delegate(TokenList aTokens) {
|
||||
XS.XorLiteral(GetSimpleRef(aTokens[0]), GetSimpleRef(aTokens[2]));
|
||||
XS.Xor(aTokens[0].Register, aTokens[2].IntValue);
|
||||
});
|
||||
AddPattern(new string[] {
|
||||
"_REG ^ _REG"
|
||||
}, delegate (TokenList aTokens) {
|
||||
XS.Xor(aTokens[0].Register, aTokens[2].Register);
|
||||
});
|
||||
|
||||
// End block. This handle both terminating a standard block as well as a function or an
|
||||
|
|
|
|||
|
|
@ -11,31 +11,6 @@ namespace XSharp.Compiler
|
|||
new LiteralAssemblerCode(code);
|
||||
}
|
||||
|
||||
public static void AddLiteral(string left, string right)
|
||||
{
|
||||
LiteralCode("Add " + left + ", " + right);
|
||||
}
|
||||
|
||||
public static void SubLiteral(string left, string right)
|
||||
{
|
||||
LiteralCode("Sub " + left + ", " + right);
|
||||
}
|
||||
|
||||
public static void AndLiteral(string left, string right)
|
||||
{
|
||||
LiteralCode("And " + left + ", " + right);
|
||||
}
|
||||
|
||||
public static void OrLiteral(string left, string right)
|
||||
{
|
||||
LiteralCode("Or " + left + ", " + right);
|
||||
}
|
||||
|
||||
public static void XorLiteral(string left, string right)
|
||||
{
|
||||
LiteralCode("xor " + left + ", " + right);
|
||||
}
|
||||
|
||||
public static void IntegerMultiplyLiteral(string left, string right)
|
||||
{
|
||||
LiteralCode("imul " + left + ", " + right);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using Cosmos.Assembler;
|
||||
using Cosmos.Assembler.x86;
|
||||
using Cosmos.Assembler.x86.x87;
|
||||
using static XSharp.Compiler.XSRegisters;
|
||||
|
||||
namespace XSharp.Compiler
|
||||
|
|
@ -217,5 +218,77 @@ namespace XSharp.Compiler
|
|||
SourceReg = valueToAdd.RegEnum
|
||||
};
|
||||
}
|
||||
|
||||
public static void Sub(Register register, uint valueToAdd)
|
||||
{
|
||||
new Sub
|
||||
{
|
||||
DestinationReg = register.RegEnum,
|
||||
SourceValue = valueToAdd
|
||||
};
|
||||
}
|
||||
|
||||
public static void Sub(Register register, Register valueToAdd)
|
||||
{
|
||||
new Sub
|
||||
{
|
||||
DestinationReg = register.RegEnum,
|
||||
SourceReg = valueToAdd.RegEnum
|
||||
};
|
||||
}
|
||||
|
||||
public static void And(Register register, uint valueToAdd)
|
||||
{
|
||||
new And
|
||||
{
|
||||
DestinationReg = register.RegEnum,
|
||||
SourceValue = valueToAdd
|
||||
};
|
||||
}
|
||||
|
||||
public static void And(Register register, Register valueToAdd)
|
||||
{
|
||||
new And
|
||||
{
|
||||
DestinationReg = register.RegEnum,
|
||||
SourceReg = valueToAdd.RegEnum
|
||||
};
|
||||
}
|
||||
|
||||
public static void Or(Register register, uint valueToAdd)
|
||||
{
|
||||
new Or
|
||||
{
|
||||
DestinationReg = register.RegEnum,
|
||||
SourceValue = valueToAdd
|
||||
};
|
||||
}
|
||||
|
||||
public static void Or(Register register, Register valueToAdd)
|
||||
{
|
||||
new Or
|
||||
{
|
||||
DestinationReg = register.RegEnum,
|
||||
SourceReg = valueToAdd.RegEnum
|
||||
};
|
||||
}
|
||||
|
||||
public static void Xor(Register register, uint valueToAdd)
|
||||
{
|
||||
new Xor
|
||||
{
|
||||
DestinationReg = register.RegEnum,
|
||||
SourceValue = valueToAdd
|
||||
};
|
||||
}
|
||||
|
||||
public static void Xor(Register register, Register valueToAdd)
|
||||
{
|
||||
new Xor
|
||||
{
|
||||
DestinationReg = register.RegEnum,
|
||||
SourceReg = valueToAdd.RegEnum
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue