mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-08 01:02:25 +00:00
This commit is contained in:
parent
b543ab5ee9
commit
ef031a2039
7 changed files with 273 additions and 263 deletions
|
|
@ -157,18 +157,16 @@ namespace Cosmos.Compiler.DebugStub {
|
||||||
|
|
||||||
// now ECX contains size of data (count)
|
// now ECX contains size of data (count)
|
||||||
// EAX contains relative to EBP
|
// EAX contains relative to EBP
|
||||||
Label = "DebugStub_SendMethodContext2";
|
|
||||||
ESI = Memory[DebugStub.CallerEBP.Name, 32];
|
ESI = Memory[DebugStub.CallerEBP.Name, 32];
|
||||||
ESI.Add(EAX);
|
ESI.Add(EAX);
|
||||||
|
|
||||||
Label = "DebugStub_SendMethodContext_SendByte";
|
Label = ".SendByte";
|
||||||
new Compare { DestinationReg = Registers.ECX, SourceValue = 0 };
|
ECX.Compare(0);
|
||||||
JumpIf(Flags.Equal, "DebugStub_SendMethodContext_After_SendByte");
|
JumpIf(Flags.Equal, ".AfterSendByte");
|
||||||
Call<WriteByteToComPort>();
|
Call<WriteByteToComPort>();
|
||||||
new Dec { DestinationReg = Registers.ECX };
|
ECX--;
|
||||||
Jump("DebugStub_SendMethodContext_SendByte");
|
Jump(".SendByte");
|
||||||
|
Label = ".AfterSendByte";
|
||||||
Label = "DebugStub_SendMethodContext_After_SendByte";
|
|
||||||
|
|
||||||
PopAll();
|
PopAll();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,7 @@ namespace Cosmos.Compiler.XSharp {
|
||||||
new Move { DestinationReg = GetId(), SourceReg = aAction.Register, SourceDisplacement = aAction.Displacement, SourceIsIndirect = aAction.IsIndirect, SourceRef = aAction.Reference, Size = Registers.GetSize(GetId()) };
|
new Move { DestinationReg = GetId(), SourceReg = aAction.Register, SourceDisplacement = aAction.Displacement, SourceIsIndirect = aAction.IsIndirect, SourceRef = aAction.Reference, Size = Registers.GetSize(GetId()) };
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void Move(RegistersEnum aRegister)
|
protected void Move(RegistersEnum aRegister) {
|
||||||
{
|
|
||||||
new Move { DestinationReg = GetId(), SourceReg = aRegister, Size = Registers.GetSize(GetId()) };
|
new Move { DestinationReg = GetId(), SourceReg = aRegister, Size = Registers.GetSize(GetId()) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ using Cosmos.Compiler.Assembler.X86;
|
||||||
|
|
||||||
namespace Cosmos.Compiler.XSharp {
|
namespace Cosmos.Compiler.XSharp {
|
||||||
public class Register32 : Register {
|
public class Register32 : Register {
|
||||||
|
|
||||||
public Register32() {
|
public Register32() {
|
||||||
mBitSize = 32;
|
mBitSize = 32;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,8 @@ using Cosmos.Compiler.Assembler.X86;
|
||||||
|
|
||||||
namespace Cosmos.Compiler.XSharp {
|
namespace Cosmos.Compiler.XSharp {
|
||||||
public class RegisterEAX : Register32 {
|
public class RegisterEAX : Register32 {
|
||||||
public const string Name = "EAX";
|
|
||||||
public static readonly RegisterEAX Instance = new RegisterEAX();
|
public static readonly RegisterEAX Instance = new RegisterEAX();
|
||||||
|
|
||||||
public override string ToString() {
|
|
||||||
return Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static RegisterEAX operator ++(RegisterEAX aRegister) {
|
public static RegisterEAX operator ++(RegisterEAX aRegister) {
|
||||||
new Inc { DestinationReg = aRegister.GetId() };
|
new Inc { DestinationReg = aRegister.GetId() };
|
||||||
return aRegister;
|
return aRegister;
|
||||||
|
|
@ -56,8 +51,7 @@ namespace Cosmos.Compiler.XSharp {
|
||||||
return Instance;
|
return Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator RegisterEAX(RegisterESI aReg)
|
public static implicit operator RegisterEAX(RegisterESI aReg) {
|
||||||
{
|
|
||||||
Instance.Move(aReg.GetId());
|
Instance.Move(aReg.GetId());
|
||||||
return Instance;
|
return Instance;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,29 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Cosmos.Compiler.Assembler;
|
using Cosmos.Compiler.Assembler;
|
||||||
|
using Cosmos.Compiler.Assembler.X86;
|
||||||
|
|
||||||
namespace Cosmos.Compiler.XSharp {
|
namespace Cosmos.Compiler.XSharp {
|
||||||
public class RegisterECX : Register32 {
|
public class RegisterECX : Register32 {
|
||||||
public static readonly RegisterECX Instance = new RegisterECX();
|
public static readonly RegisterECX Instance = new RegisterECX();
|
||||||
|
|
||||||
|
public static RegisterECX operator ++(RegisterECX aRegister) {
|
||||||
|
new Inc { DestinationReg = aRegister.GetId() };
|
||||||
|
return aRegister;
|
||||||
|
}
|
||||||
|
public static RegisterECX operator --(RegisterECX aRegister) {
|
||||||
|
new Dec { DestinationReg = aRegister.GetId() };
|
||||||
|
return aRegister;
|
||||||
|
}
|
||||||
|
public static RegisterECX operator <<(RegisterECX aRegister, int aCount) {
|
||||||
|
new ShiftLeft { DestinationReg = aRegister.GetId(), SourceValue = (uint)aCount };
|
||||||
|
return aRegister;
|
||||||
|
}
|
||||||
|
public static RegisterECX operator >>(RegisterECX aRegister, int aCount) {
|
||||||
|
new ShiftRight { DestinationReg = aRegister.GetId(), SourceValue = (uint)aCount };
|
||||||
|
return aRegister;
|
||||||
|
}
|
||||||
|
|
||||||
public static implicit operator RegisterECX(ElementReference aReference) {
|
public static implicit operator RegisterECX(ElementReference aReference) {
|
||||||
Instance.Move(aReference);
|
Instance.Move(aReference);
|
||||||
return Instance;
|
return Instance;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue