mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-24 12:35:31 +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();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,57 +6,56 @@ using Cosmos.Compiler.Assembler;
|
||||||
using Cosmos.Compiler.Assembler.X86;
|
using Cosmos.Compiler.Assembler.X86;
|
||||||
|
|
||||||
namespace Cosmos.Compiler.XSharp {
|
namespace Cosmos.Compiler.XSharp {
|
||||||
public abstract class Register {
|
public abstract class Register {
|
||||||
protected byte mBitSize;
|
protected byte mBitSize;
|
||||||
public byte BitSize {
|
public byte BitSize {
|
||||||
get { return mBitSize; }
|
get { return mBitSize; }
|
||||||
}
|
|
||||||
|
|
||||||
public readonly string Name;
|
|
||||||
|
|
||||||
public Register() {
|
|
||||||
Name = GetType().Name.Substring(typeof(Register).Name.Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString() {
|
|
||||||
return Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RegistersEnum GetId() {
|
|
||||||
return Registers.GetRegister(Name).Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Push() {
|
|
||||||
// TODO: This emits Push dword which generates warnings about dword being ignored
|
|
||||||
new Push { DestinationReg = GetId() };
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Pop() {
|
|
||||||
new Pop { DestinationReg = GetId() };
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void Move(uint aAddress) {
|
|
||||||
new Move { DestinationReg = GetId(), SourceValue = aAddress, Size=Registers.GetSize(GetId())};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void Move(MemoryAction aAction) {
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
new Move { DestinationReg = GetId(), SourceReg = aRegister, Size = Registers.GetSize(GetId()) };
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void Move(ElementReference aReference) {
|
|
||||||
new Move { DestinationReg = GetId(), SourceRef = aReference, Size = Registers.GetSize(GetId())};
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool isPort(){
|
|
||||||
if (GetId().Equals(Registers.AX) || GetId().Equals(Registers.AL) || GetId().Equals(Registers.EAX)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public readonly string Name;
|
||||||
|
|
||||||
|
public Register() {
|
||||||
|
Name = GetType().Name.Substring(typeof(Register).Name.Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString() {
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RegistersEnum GetId() {
|
||||||
|
return Registers.GetRegister(Name).Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Push() {
|
||||||
|
// TODO: This emits Push dword which generates warnings about dword being ignored
|
||||||
|
new Push { DestinationReg = GetId() };
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Pop() {
|
||||||
|
new Pop { DestinationReg = GetId() };
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void Move(uint aAddress) {
|
||||||
|
new Move { DestinationReg = GetId(), SourceValue = aAddress, Size = Registers.GetSize(GetId()) };
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void Move(MemoryAction aAction) {
|
||||||
|
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) {
|
||||||
|
new Move { DestinationReg = GetId(), SourceReg = aRegister, Size = Registers.GetSize(GetId()) };
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void Move(ElementReference aReference) {
|
||||||
|
new Move { DestinationReg = GetId(), SourceRef = aReference, Size = Registers.GetSize(GetId()) };
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool isPort() {
|
||||||
|
if (GetId().Equals(Registers.AX) || GetId().Equals(Registers.AL) || GetId().Equals(Registers.EAX)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,46 +6,47 @@ using Cosmos.Compiler.Assembler;
|
||||||
using Cosmos.Compiler.Assembler.X86;
|
using Cosmos.Compiler.Assembler.X86;
|
||||||
|
|
||||||
namespace Cosmos.Compiler.XSharp {
|
namespace Cosmos.Compiler.XSharp {
|
||||||
public class Register32 : Register {
|
public class Register32 : Register {
|
||||||
public Register32() {
|
|
||||||
mBitSize = 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Not all overloads can go here.
|
public Register32() {
|
||||||
// 1- C# overloads specifically by exact class and does not inherit in many cases
|
mBitSize = 32;
|
||||||
// 2- x86 does not support all operations on all registers
|
|
||||||
|
|
||||||
public static AddressIndirect operator+ (Register32 aBaseRegister, Int32 aDisplacement) {
|
|
||||||
return new AddressIndirect(aBaseRegister, aDisplacement);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Add(UInt32 aValue) {
|
|
||||||
new Add { DestinationReg = GetId(), SourceValue = aValue };
|
|
||||||
}
|
|
||||||
public void Add(Register32 aReg) {
|
|
||||||
new Add { DestinationReg = GetId(), SourceReg = aReg.GetId() };
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Sub(UInt32 aValue) {
|
|
||||||
new Sub { DestinationReg = GetId(), SourceValue = aValue };
|
|
||||||
}
|
|
||||||
public void Sub(Register32 aReg) {
|
|
||||||
new Sub { DestinationReg = GetId(), SourceReg = aReg.GetId() };
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Compare(UInt32 aValue) {
|
|
||||||
new Compare { DestinationReg = GetId(), SourceValue = aValue };
|
|
||||||
}
|
|
||||||
public void Compare(MemoryAction aAction) {
|
|
||||||
new Compare {
|
|
||||||
DestinationRef = aAction.Reference,
|
|
||||||
DestinationIsIndirect = true,
|
|
||||||
SourceReg = GetId()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Test(UInt32 aValue) {
|
|
||||||
new Test { DestinationReg = GetId(), SourceValue = aValue, Size = 32 };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Not all overloads can go here.
|
||||||
|
// 1- C# overloads specifically by exact class and does not inherit in many cases
|
||||||
|
// 2- x86 does not support all operations on all registers
|
||||||
|
|
||||||
|
public static AddressIndirect operator +(Register32 aBaseRegister, Int32 aDisplacement) {
|
||||||
|
return new AddressIndirect(aBaseRegister, aDisplacement);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Add(UInt32 aValue) {
|
||||||
|
new Add { DestinationReg = GetId(), SourceValue = aValue };
|
||||||
|
}
|
||||||
|
public void Add(Register32 aReg) {
|
||||||
|
new Add { DestinationReg = GetId(), SourceReg = aReg.GetId() };
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Sub(UInt32 aValue) {
|
||||||
|
new Sub { DestinationReg = GetId(), SourceValue = aValue };
|
||||||
|
}
|
||||||
|
public void Sub(Register32 aReg) {
|
||||||
|
new Sub { DestinationReg = GetId(), SourceReg = aReg.GetId() };
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Compare(UInt32 aValue) {
|
||||||
|
new Compare { DestinationReg = GetId(), SourceValue = aValue };
|
||||||
|
}
|
||||||
|
public void Compare(MemoryAction aAction) {
|
||||||
|
new Compare {
|
||||||
|
DestinationRef = aAction.Reference,
|
||||||
|
DestinationIsIndirect = true,
|
||||||
|
SourceReg = GetId()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Test(UInt32 aValue) {
|
||||||
|
new Test { DestinationReg = GetId(), SourceValue = aValue, Size = 32 };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -6,74 +6,68 @@ using Cosmos.Compiler.Assembler;
|
||||||
using Cosmos.Compiler.Assembler.X86;
|
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) {
|
|
||||||
new Inc { DestinationReg = aRegister.GetId() };
|
|
||||||
return aRegister;
|
|
||||||
}
|
|
||||||
public static RegisterEAX operator-- (RegisterEAX aRegister) {
|
|
||||||
new Dec { DestinationReg = aRegister.GetId() };
|
|
||||||
return aRegister;
|
|
||||||
}
|
|
||||||
public static RegisterEAX operator<< (RegisterEAX aRegister, int aCount) {
|
|
||||||
new ShiftLeft { DestinationReg = aRegister.GetId(), SourceValue = (uint)aCount };
|
|
||||||
return aRegister;
|
|
||||||
}
|
|
||||||
public static RegisterEAX operator>> (RegisterEAX aRegister, int aCount) {
|
|
||||||
new ShiftRight { DestinationReg = aRegister.GetId(), SourceValue = (uint)aCount };
|
|
||||||
return aRegister;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator RegisterEAX(ElementReference aReference) {
|
|
||||||
Instance.Move(aReference);
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator RegisterEAX(MemoryAction aAction) {
|
|
||||||
Instance.Move(aAction);
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator RegisterEAX(UInt32 aValue) {
|
|
||||||
Instance.Move(aValue);
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator RegisterEAX(RegisterEBX aReg) {
|
|
||||||
Instance.Move(aReg.GetId());
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator RegisterEAX(RegisterECX aReg) {
|
|
||||||
Instance.Move(aReg.GetId());
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator RegisterEAX(RegisterESI aReg)
|
|
||||||
{
|
|
||||||
Instance.Move(aReg.GetId());
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator RegisterEAX(RegisterEDX aReg) {
|
|
||||||
Instance.Move(aReg.GetId());
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator PortNumber(RegisterEAX aEAX) {
|
|
||||||
return new PortNumber(aEAX.GetId());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RotateRight(int aCount) {
|
|
||||||
new RotateRight { DestinationReg = Registers.EBX, SourceValue = (uint)aCount };
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public static RegisterEAX operator ++(RegisterEAX aRegister) {
|
||||||
|
new Inc { DestinationReg = aRegister.GetId() };
|
||||||
|
return aRegister;
|
||||||
}
|
}
|
||||||
|
public static RegisterEAX operator --(RegisterEAX aRegister) {
|
||||||
|
new Dec { DestinationReg = aRegister.GetId() };
|
||||||
|
return aRegister;
|
||||||
|
}
|
||||||
|
public static RegisterEAX operator <<(RegisterEAX aRegister, int aCount) {
|
||||||
|
new ShiftLeft { DestinationReg = aRegister.GetId(), SourceValue = (uint)aCount };
|
||||||
|
return aRegister;
|
||||||
|
}
|
||||||
|
public static RegisterEAX operator >>(RegisterEAX aRegister, int aCount) {
|
||||||
|
new ShiftRight { DestinationReg = aRegister.GetId(), SourceValue = (uint)aCount };
|
||||||
|
return aRegister;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterEAX(ElementReference aReference) {
|
||||||
|
Instance.Move(aReference);
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterEAX(MemoryAction aAction) {
|
||||||
|
Instance.Move(aAction);
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterEAX(UInt32 aValue) {
|
||||||
|
Instance.Move(aValue);
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterEAX(RegisterEBX aReg) {
|
||||||
|
Instance.Move(aReg.GetId());
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterEAX(RegisterECX aReg) {
|
||||||
|
Instance.Move(aReg.GetId());
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterEAX(RegisterESI aReg) {
|
||||||
|
Instance.Move(aReg.GetId());
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterEAX(RegisterEDX aReg) {
|
||||||
|
Instance.Move(aReg.GetId());
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator PortNumber(RegisterEAX aEAX) {
|
||||||
|
return new PortNumber(aEAX.GetId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RotateRight(int aCount) {
|
||||||
|
new RotateRight { DestinationReg = Registers.EBX, SourceValue = (uint)aCount };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,59 +6,59 @@ using Cosmos.Compiler.Assembler;
|
||||||
using Cosmos.Compiler.Assembler.X86;
|
using Cosmos.Compiler.Assembler.X86;
|
||||||
|
|
||||||
namespace Cosmos.Compiler.XSharp {
|
namespace Cosmos.Compiler.XSharp {
|
||||||
public class RegisterEBX : Register32 {
|
public class RegisterEBX : Register32 {
|
||||||
public static readonly RegisterEBX Instance = new RegisterEBX();
|
public static readonly RegisterEBX Instance = new RegisterEBX();
|
||||||
|
|
||||||
public static RegisterEBX operator ++(RegisterEBX aRegister) {
|
|
||||||
new Inc { DestinationReg = aRegister.GetId() };
|
|
||||||
return aRegister;
|
|
||||||
}
|
|
||||||
public static RegisterEBX operator --(RegisterEBX aRegister) {
|
|
||||||
new Dec { DestinationReg = aRegister.GetId() };
|
|
||||||
return aRegister;
|
|
||||||
}
|
|
||||||
public static RegisterEBX operator <<(RegisterEBX aRegister, int aCount) {
|
|
||||||
new ShiftLeft { DestinationReg = aRegister.GetId(), SourceValue = (uint)aCount };
|
|
||||||
return aRegister;
|
|
||||||
}
|
|
||||||
public static RegisterEBX operator >>(RegisterEBX aRegister, int aCount) {
|
|
||||||
new ShiftRight { DestinationReg = aRegister.GetId(), SourceValue = (uint)aCount };
|
|
||||||
return aRegister;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator RegisterEBX(ElementReference aReference) {
|
|
||||||
Instance.Move(aReference);
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator RegisterEBX(MemoryAction aAction) {
|
|
||||||
Instance.Move(aAction);
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator RegisterEBX(UInt32 aValue) {
|
|
||||||
Instance.Move(aValue);
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator RegisterEBX(RegisterEAX aValue) {
|
|
||||||
Instance.Move(aValue.GetId());
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator RegisterEBX(RegisterECX aValue) {
|
|
||||||
Instance.Move(aValue.GetId());
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator RegisterEBX(RegisterEDX aValue) {
|
|
||||||
Instance.Move(aValue.GetId());
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RotateRight(int aCount) {
|
|
||||||
new RotateRight { DestinationReg = Registers.EBX, SourceValue = (uint)aCount };
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public static RegisterEBX operator ++(RegisterEBX aRegister) {
|
||||||
|
new Inc { DestinationReg = aRegister.GetId() };
|
||||||
|
return aRegister;
|
||||||
}
|
}
|
||||||
|
public static RegisterEBX operator --(RegisterEBX aRegister) {
|
||||||
|
new Dec { DestinationReg = aRegister.GetId() };
|
||||||
|
return aRegister;
|
||||||
|
}
|
||||||
|
public static RegisterEBX operator <<(RegisterEBX aRegister, int aCount) {
|
||||||
|
new ShiftLeft { DestinationReg = aRegister.GetId(), SourceValue = (uint)aCount };
|
||||||
|
return aRegister;
|
||||||
|
}
|
||||||
|
public static RegisterEBX operator >>(RegisterEBX aRegister, int aCount) {
|
||||||
|
new ShiftRight { DestinationReg = aRegister.GetId(), SourceValue = (uint)aCount };
|
||||||
|
return aRegister;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterEBX(ElementReference aReference) {
|
||||||
|
Instance.Move(aReference);
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterEBX(MemoryAction aAction) {
|
||||||
|
Instance.Move(aAction);
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterEBX(UInt32 aValue) {
|
||||||
|
Instance.Move(aValue);
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterEBX(RegisterEAX aValue) {
|
||||||
|
Instance.Move(aValue.GetId());
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterEBX(RegisterECX aValue) {
|
||||||
|
Instance.Move(aValue.GetId());
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterEBX(RegisterEDX aValue) {
|
||||||
|
Instance.Move(aValue.GetId());
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RotateRight(int aCount) {
|
||||||
|
new RotateRight { DestinationReg = Registers.EBX, SourceValue = (uint)aCount };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,39 +3,57 @@ 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 implicit operator RegisterECX(ElementReference aReference) {
|
public static RegisterECX operator ++(RegisterECX aRegister) {
|
||||||
Instance.Move(aReference);
|
new Inc { DestinationReg = aRegister.GetId() };
|
||||||
return Instance;
|
return aRegister;
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator RegisterECX(MemoryAction aAction) {
|
|
||||||
Instance.Move(aAction);
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator RegisterECX(UInt32 aValue) {
|
|
||||||
Instance.Move(aValue);
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator RegisterECX(RegisterEAX aValue) {
|
|
||||||
Instance.Move(aValue.GetId());
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator RegisterECX(RegisterEBX aValue) {
|
|
||||||
Instance.Move(aValue.GetId());
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator RegisterECX(RegisterEDX aValue) {
|
|
||||||
Instance.Move(aValue.GetId());
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
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) {
|
||||||
|
Instance.Move(aReference);
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterECX(MemoryAction aAction) {
|
||||||
|
Instance.Move(aAction);
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterECX(UInt32 aValue) {
|
||||||
|
Instance.Move(aValue);
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterECX(RegisterEAX aValue) {
|
||||||
|
Instance.Move(aValue.GetId());
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterECX(RegisterEBX aValue) {
|
||||||
|
Instance.Move(aValue.GetId());
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterECX(RegisterEDX aValue) {
|
||||||
|
Instance.Move(aValue.GetId());
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,17 +4,17 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Cosmos.Compiler.XSharp {
|
namespace Cosmos.Compiler.XSharp {
|
||||||
public class RegisterEDX : Register32 {
|
public class RegisterEDX : Register32 {
|
||||||
public static readonly RegisterEDX Instance = new RegisterEDX();
|
public static readonly RegisterEDX Instance = new RegisterEDX();
|
||||||
|
|
||||||
public static implicit operator RegisterEDX(MemoryAction aAction) {
|
public static implicit operator RegisterEDX(MemoryAction aAction) {
|
||||||
Instance.Move(aAction);
|
Instance.Move(aAction);
|
||||||
return Instance;
|
return Instance;
|
||||||
}
|
|
||||||
|
|
||||||
public static implicit operator RegisterEDX(UInt32 aValue) {
|
|
||||||
Instance.Move(aValue);
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterEDX(UInt32 aValue) {
|
||||||
|
Instance.Move(aValue);
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue