mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-26 21:42:11 +00:00
More X#
This commit is contained in:
parent
8f3675fc84
commit
9c190531a7
18 changed files with 275 additions and 63 deletions
|
|
@ -13,92 +13,92 @@ namespace Indy.IL2CPU.Assembler.X86 {
|
||||||
Label = "WriteByteToComPort";
|
Label = "WriteByteToComPort";
|
||||||
Label = "WriteByteToComPort_Wait";
|
Label = "WriteByteToComPort_Wait";
|
||||||
DX = xComStatusAddr;
|
DX = xComStatusAddr;
|
||||||
AL = Port(DX);
|
AL = Port[DX];
|
||||||
AL.Test(0x20);
|
AL.Test(0x20);
|
||||||
JumpIfEqual("WriteByteToComPort_Wait");
|
JumpIfEqual("WriteByteToComPort_Wait");
|
||||||
DX = aComAddr;
|
DX = aComAddr;
|
||||||
new Move(Registers.AL, "[esp + 4]");
|
AL = Memory[ESP + 4];
|
||||||
new Out(Registers.DX, Registers.AL);
|
Port[DX] = AL;
|
||||||
new Ret(4);
|
Return(4);
|
||||||
|
|
||||||
new Label("DebugWriteEIP");
|
Label = "DebugWriteEIP";
|
||||||
new Move(Registers.AL, "[ebp + 3]");
|
AL = Memory[EBP + 3];
|
||||||
new Push(Registers.EAX);
|
new Push(Registers.EAX);
|
||||||
new Call("WriteByteToComPort");
|
Call("WriteByteToComPort");
|
||||||
new Move(Registers.AL, "[ebp + 2]");
|
AL = Memory[EBP + 2];
|
||||||
new Push(Registers.EAX);
|
new Push(Registers.EAX);
|
||||||
new Call("WriteByteToComPort");
|
Call("WriteByteToComPort");
|
||||||
new Move(Registers.AL, "[ebp + 1]");
|
AL = Memory[EBP + 1];
|
||||||
new Push(Registers.EAX);
|
new Push(Registers.EAX);
|
||||||
new Call("WriteByteToComPort");
|
Call("WriteByteToComPort");
|
||||||
new Move(Registers.AL, "[ebp]");
|
AL = Memory[EBP];
|
||||||
new Push(Registers.EAX);
|
new Push(Registers.EAX);
|
||||||
new Call("WriteByteToComPort");
|
Call("WriteByteToComPort");
|
||||||
new Ret();
|
Return();
|
||||||
|
|
||||||
new Label("DebugPoint_WaitCmd");
|
Label = "DebugPoint_WaitCmd";
|
||||||
DX = xComStatusAddr;
|
DX = xComStatusAddr;
|
||||||
new InByte(Registers.AL, Registers.DX);
|
new InByte(Registers.AL, Registers.DX);
|
||||||
new Test(Registers.AL, 1);
|
AL.Test(0x01);
|
||||||
new JumpIfZero("DebugPoint_WaitCmd");
|
new JumpIfZero("DebugPoint_WaitCmd");
|
||||||
new Jump("DebugPoint_ProcessCmd");
|
Jump("DebugPoint_ProcessCmd");
|
||||||
|
|
||||||
new Label("DebugPoint__");
|
Label = "DebugPoint__";
|
||||||
new Pushad();
|
PushAll32();
|
||||||
new Move(Registers.EBP, Registers.ESP);
|
new Move(Registers.EBP, Registers.ESP);
|
||||||
new Add(Registers.EBP, 32);
|
new Add(Registers.EBP, 32);
|
||||||
|
|
||||||
// Check TraceMode
|
// Check TraceMode
|
||||||
new Move(Registers.EAX, "[TraceMode]");
|
new Move(Registers.EAX, "[TraceMode]");
|
||||||
new Compare(Registers.AX, 1);
|
new Compare(Registers.AX, 1);
|
||||||
new JumpIfEqual("DebugPoint_NoTrace");
|
JumpIfEqual("DebugPoint_NoTrace");
|
||||||
//
|
//
|
||||||
new Call("DebugWriteEIP");
|
new Call("DebugWriteEIP");
|
||||||
//
|
//
|
||||||
new Move(Registers.EAX, "[TraceMode]");
|
new Move(Registers.EAX, "[TraceMode]");
|
||||||
new Compare(Registers.AL, 4);
|
new Compare(Registers.AL, 4);
|
||||||
new JumpIfEqual("DebugPoint_WaitCmd");
|
JumpIfEqual("DebugPoint_WaitCmd");
|
||||||
new Label("DebugPoint_NoTrace");
|
Label = "DebugPoint_NoTrace";
|
||||||
|
|
||||||
// Is there a new incoming command?
|
// Is there a new incoming command?
|
||||||
new Label("DebugPoint_CheckCmd");
|
Label = "DebugPoint_CheckCmd";
|
||||||
DX = xComStatusAddr;
|
DX = xComStatusAddr;
|
||||||
new InByte(Registers.AL, Registers.DX);
|
AL = Port[DX];
|
||||||
new Test(Registers.AL, 1);
|
AL.Test(0x01);
|
||||||
new JumpIfZero("DebugPoint_AfterCmd");
|
JumpIfZero("DebugPoint_AfterCmd");
|
||||||
|
|
||||||
new Label("DebugPoint_ProcessCmd");
|
Label = "DebugPoint_ProcessCmd";
|
||||||
DX = aComAddr;
|
DX = aComAddr;
|
||||||
new InByte(Registers.AL, Registers.DX);
|
AL = Port[DX];
|
||||||
new Compare(Registers.AL, 1);
|
new Compare(Registers.AL, 1);
|
||||||
new JumpIfNotEqual("DebugPoint_Cmd02");
|
JumpIfNotEqual("DebugPoint_Cmd02");
|
||||||
new Move("dword", "[TraceMode]", 1);
|
new Move("dword", "[TraceMode]", 1);
|
||||||
new Jump("DebugPoint_CheckCmd");
|
Jump("DebugPoint_CheckCmd");
|
||||||
//
|
//
|
||||||
new Label("DebugPoint_Cmd02");
|
Label = "DebugPoint_Cmd02";
|
||||||
new Compare(Registers.AL, 2);
|
new Compare(Registers.AL, 2);
|
||||||
new JumpIfNotEqual("DebugPoint_Cmd03");
|
JumpIfNotEqual("DebugPoint_Cmd03");
|
||||||
new Move("dword", "[TraceMode]", 2);
|
new Move("dword", "[TraceMode]", 2);
|
||||||
new Jump("DebugPoint_CheckCmd");
|
Jump("DebugPoint_CheckCmd");
|
||||||
//
|
//
|
||||||
new Label("DebugPoint_Cmd03");
|
Label = "DebugPoint_Cmd03";
|
||||||
new Compare(Registers.AL, 3);
|
new Compare(Registers.AL, 3);
|
||||||
new JumpIfNotEqual("DebugPoint_Cmd04");
|
JumpIfNotEqual("DebugPoint_Cmd04");
|
||||||
new Move("dword", "[TraceMode]", 4);
|
new Move("dword", "[TraceMode]", 4);
|
||||||
new Jump("DebugPoint_AfterCmd");
|
Jump("DebugPoint_AfterCmd");
|
||||||
//
|
//
|
||||||
new Label("DebugPoint_Cmd04");
|
Label = "DebugPoint_Cmd04";
|
||||||
new Compare(Registers.AL, 4);
|
new Compare(Registers.AL, 4);
|
||||||
new JumpIfNotEqual("DebugPoint_Cmd05");
|
JumpIfNotEqual("DebugPoint_Cmd05");
|
||||||
new Move("dword", "[TraceMode]", 4);
|
new Move("dword", "[TraceMode]", 4);
|
||||||
new Jump("DebugPoint_WaitCmd");
|
Jump("DebugPoint_WaitCmd");
|
||||||
//
|
//
|
||||||
new Label("DebugPoint_Cmd05");
|
Label = "DebugPoint_Cmd05";
|
||||||
// -Evaluate variables
|
// -Evaluate variables
|
||||||
// -Step to next debug call
|
// -Step to next debug call
|
||||||
// Break points
|
// Break points
|
||||||
// Immediate break
|
// Immediate break
|
||||||
new Label("DebugPoint_AfterCmd");
|
Label = "DebugPoint_AfterCmd";
|
||||||
|
|
||||||
// TraceMode
|
// TraceMode
|
||||||
// 1 - No tracing
|
// 1 - No tracing
|
||||||
|
|
@ -106,8 +106,8 @@ namespace Indy.IL2CPU.Assembler.X86 {
|
||||||
// 3 -
|
// 3 -
|
||||||
// 4 - Break and wait
|
// 4 - Break and wait
|
||||||
|
|
||||||
new Popad();
|
PopAll32();
|
||||||
new Ret();
|
Return();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,13 @@
|
||||||
<Compile Include="SubWithCarry.cs" />
|
<Compile Include="SubWithCarry.cs" />
|
||||||
<Compile Include="Test.cs" />
|
<Compile Include="Test.cs" />
|
||||||
<Compile Include="Xor.cs" />
|
<Compile Include="Xor.cs" />
|
||||||
<Compile Include="X\PortSource.cs" />
|
<Compile Include="X\AddressIndirect.cs" />
|
||||||
|
<Compile Include="X\AddressNumeric.cs" />
|
||||||
|
<Compile Include="X\Memory.cs" />
|
||||||
|
<Compile Include="X\Address.cs" />
|
||||||
|
<Compile Include="X\MemoryAction.cs" />
|
||||||
|
<Compile Include="X\Ports.cs" />
|
||||||
|
<Compile Include="X\PortNumber.cs" />
|
||||||
<Compile Include="X\Register.cs" />
|
<Compile Include="X\Register.cs" />
|
||||||
<Compile Include="X\Register08.cs" />
|
<Compile Include="X\Register08.cs" />
|
||||||
<Compile Include="X\Register16.cs" />
|
<Compile Include="X\Register16.cs" />
|
||||||
|
|
@ -131,6 +137,8 @@
|
||||||
<Compile Include="X\RegisterAL.cs" />
|
<Compile Include="X\RegisterAL.cs" />
|
||||||
<Compile Include="X\RegisterDX.cs" />
|
<Compile Include="X\RegisterDX.cs" />
|
||||||
<Compile Include="X\RegisterEAX.cs" />
|
<Compile Include="X\RegisterEAX.cs" />
|
||||||
|
<Compile Include="X\RegisterEBP.cs" />
|
||||||
|
<Compile Include="X\RegisterESP.cs" />
|
||||||
<Compile Include="X\Y86.cs" />
|
<Compile Include="X\Y86.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
14
source/Indy.IL2CPU.Assembler.X86/X/Address.cs
Normal file
14
source/Indy.IL2CPU.Assembler.X86/X/Address.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
|
public class Address {
|
||||||
|
|
||||||
|
public static implicit operator Address(Register32 aRegister) {
|
||||||
|
return new AddressIndirect(aRegister, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
24
source/Indy.IL2CPU.Assembler.X86/X/AddressIndirect.cs
Normal file
24
source/Indy.IL2CPU.Assembler.X86/X/AddressIndirect.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
|
public class AddressIndirect : Address {
|
||||||
|
protected Register32 mBaseRegister;
|
||||||
|
protected UInt32 mDisplacement = 0;
|
||||||
|
|
||||||
|
public AddressIndirect(Register32 aBaseRegister, UInt32 aDisplacement) {
|
||||||
|
mBaseRegister = aBaseRegister;
|
||||||
|
mDisplacement = aDisplacement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString() {
|
||||||
|
if (mDisplacement == 0) {
|
||||||
|
return "[" + mBaseRegister.ToString() + "]";
|
||||||
|
} else {
|
||||||
|
return "[" + mBaseRegister.ToString() + " + " + mDisplacement + "]";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
source/Indy.IL2CPU.Assembler.X86/X/AddressNumeric.cs
Normal file
22
source/Indy.IL2CPU.Assembler.X86/X/AddressNumeric.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
|
public class AddressNumeric : Address {
|
||||||
|
protected UInt32 mAddress;
|
||||||
|
|
||||||
|
public AddressNumeric(UInt32 aAddress) {
|
||||||
|
mAddress = aAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString() {
|
||||||
|
return mAddress.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator AddressNumeric(UInt32 aAddress) {
|
||||||
|
return new AddressNumeric(aAddress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
16
source/Indy.IL2CPU.Assembler.X86/X/Memory.cs
Normal file
16
source/Indy.IL2CPU.Assembler.X86/X/Memory.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
|
public class Memory {
|
||||||
|
public MemoryAction this[Address aAddress] {
|
||||||
|
get {
|
||||||
|
return new MemoryAction(aAddress.ToString());
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
18
source/Indy.IL2CPU.Assembler.X86/X/MemoryAction.cs
Normal file
18
source/Indy.IL2CPU.Assembler.X86/X/MemoryAction.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
|
public class MemoryAction {
|
||||||
|
protected string mValue;
|
||||||
|
|
||||||
|
public MemoryAction(string aValue) {
|
||||||
|
mValue = aValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString() {
|
||||||
|
return mValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,10 +4,10 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Indy.IL2CPU.Assembler.X86.X {
|
namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
public class PortSource {
|
public class PortNumber {
|
||||||
string mPort;
|
string mPort;
|
||||||
|
|
||||||
public PortSource(string aPort) {
|
public PortNumber(string aPort) {
|
||||||
mPort = aPort;
|
mPort = aPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
26
source/Indy.IL2CPU.Assembler.X86/X/Ports.cs
Normal file
26
source/Indy.IL2CPU.Assembler.X86/X/Ports.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
|
public class Ports {
|
||||||
|
public PortNumber this[byte aPort] {
|
||||||
|
get {
|
||||||
|
return new PortNumber(aPort.ToString());
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
new X86.Out("DX", aPort.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public PortNumber this[RegisterDX aDX] {
|
||||||
|
get {
|
||||||
|
return new PortNumber("DX");
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
new X86.Out("DX", value.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,13 +6,10 @@ using X86 = Indy.IL2CPU.Assembler.X86;
|
||||||
|
|
||||||
namespace Indy.IL2CPU.Assembler.X86.X {
|
namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
public abstract class Register {
|
public abstract class Register {
|
||||||
// Not abstract so 8,16,32 dont have to override it
|
|
||||||
protected virtual string GetName() {
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void Move(string aValue) {
|
protected void Move(string aValue) {
|
||||||
new X86.Move(GetName(), aValue);
|
new X86.Move(ToString(), aValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ using X86 = Indy.IL2CPU.Assembler.X86;
|
||||||
namespace Indy.IL2CPU.Assembler.X86.X {
|
namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
public class Register08 : Register {
|
public class Register08 : Register {
|
||||||
public void Test(byte aValue) {
|
public void Test(byte aValue) {
|
||||||
new X86.Test(GetName(), aValue);
|
new X86.Test(ToString(), aValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,10 @@ using System.Text;
|
||||||
|
|
||||||
namespace Indy.IL2CPU.Assembler.X86.X {
|
namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
public class Register32 : Register {
|
public class Register32 : Register {
|
||||||
|
|
||||||
|
public static AddressIndirect operator +(Register32 aBaseRegister, UInt32 aDisplacement) {
|
||||||
|
return new AddressIndirect(aBaseRegister, aDisplacement);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,21 +6,34 @@ using X86 = Indy.IL2CPU.Assembler.X86;
|
||||||
|
|
||||||
namespace Indy.IL2CPU.Assembler.X86.X {
|
namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
public class RegisterAL : Register08 {
|
public class RegisterAL : Register08 {
|
||||||
|
public const string Name = "AL";
|
||||||
public static readonly RegisterAL Instance = new RegisterAL();
|
public static readonly RegisterAL Instance = new RegisterAL();
|
||||||
|
|
||||||
protected override string GetName() {
|
public override string ToString() {
|
||||||
return "AL";
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Use an attribute to find the register name
|
||||||
|
// Also useful for Memory conversion - Can find attribute
|
||||||
|
// of descendant? or no?
|
||||||
public static implicit operator RegisterAL(byte aValue) {
|
public static implicit operator RegisterAL(byte aValue) {
|
||||||
Instance.Move(aValue.ToString());
|
Instance.Move(aValue.ToString());
|
||||||
return Instance;
|
return Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator RegisterAL(PortSource aValue) {
|
public static implicit operator RegisterAL(PortNumber aValue) {
|
||||||
new X86.InByte(Instance.GetName(), aValue.ToString());
|
new X86.InByte("AL", aValue.ToString());
|
||||||
return Instance;
|
return Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterAL(MemoryAction aAction) {
|
||||||
|
new X86.Move("AL", aAction.ToString());
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator PortNumber(RegisterAL aAL) {
|
||||||
|
return new PortNumber("AL");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,11 @@ using System.Text;
|
||||||
|
|
||||||
namespace Indy.IL2CPU.Assembler.X86.X {
|
namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
public class RegisterDX : Register16 {
|
public class RegisterDX : Register16 {
|
||||||
|
public const string Name = "DX";
|
||||||
public static readonly RegisterDX Instance = new RegisterDX();
|
public static readonly RegisterDX Instance = new RegisterDX();
|
||||||
|
|
||||||
protected override string GetName() {
|
public override string ToString() {
|
||||||
return "DX";
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator RegisterDX(UInt16 aValue) {
|
public static implicit operator RegisterDX(UInt16 aValue) {
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,11 @@ using System.Text;
|
||||||
|
|
||||||
namespace Indy.IL2CPU.Assembler.X86.X {
|
namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
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();
|
||||||
|
|
||||||
protected override string GetName() {
|
public override string ToString() {
|
||||||
return "EAX";
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator RegisterEAX(UInt32 aValue) {
|
public static implicit operator RegisterEAX(UInt32 aValue) {
|
||||||
|
|
|
||||||
20
source/Indy.IL2CPU.Assembler.X86/X/RegisterEBP.cs
Normal file
20
source/Indy.IL2CPU.Assembler.X86/X/RegisterEBP.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
|
public class RegisterEBP : Register32 {
|
||||||
|
public const string Name = "EBP";
|
||||||
|
public static readonly RegisterEBP Instance = new RegisterEBP();
|
||||||
|
|
||||||
|
public override string ToString() {
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterEBP(UInt32 aValue) {
|
||||||
|
Instance.Move(aValue.ToString());
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
20
source/Indy.IL2CPU.Assembler.X86/X/RegisterESP.cs
Normal file
20
source/Indy.IL2CPU.Assembler.X86/X/RegisterESP.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
|
public class RegisterESP : Register32 {
|
||||||
|
public const string Name = "ESP";
|
||||||
|
public static readonly RegisterESP Instance = new RegisterESP();
|
||||||
|
|
||||||
|
public override string ToString() {
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterESP(UInt32 aValue) {
|
||||||
|
Instance.Move(aValue.ToString());
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11,9 +11,12 @@ namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
|
|
||||||
public RegisterDX DX = RegisterDX.Instance;
|
public RegisterDX DX = RegisterDX.Instance;
|
||||||
|
|
||||||
public PortSource Port(RegisterDX aDX) {
|
public RegisterESP ESP = RegisterESP.Instance;
|
||||||
return new PortSource("DX");
|
|
||||||
}
|
public RegisterEBP EBP = RegisterEBP.Instance;
|
||||||
|
|
||||||
|
public readonly Ports Port = new Ports();
|
||||||
|
public readonly Memory Memory = new Memory();
|
||||||
|
|
||||||
public string Label {
|
public string Label {
|
||||||
set {
|
set {
|
||||||
|
|
@ -21,9 +24,33 @@ namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Call(string aLabel) {
|
||||||
|
new X86.Call(aLabel);
|
||||||
|
}
|
||||||
|
public void Jump(string aLabel) {
|
||||||
|
new X86.Jump(aLabel);
|
||||||
|
}
|
||||||
public void JumpIfEqual(string aLabel) {
|
public void JumpIfEqual(string aLabel) {
|
||||||
new X86.JumpIfEqual(aLabel);
|
new X86.JumpIfEqual(aLabel);
|
||||||
}
|
}
|
||||||
|
public void JumpIfZero(string aLabel) {
|
||||||
|
new X86.JumpIfZero(aLabel);
|
||||||
|
}
|
||||||
|
public void JumpIfNotEqual(string aLabel) {
|
||||||
|
new X86.JumpIfNotEqual(aLabel);
|
||||||
|
}
|
||||||
|
public void PopAll32() {
|
||||||
|
new Popad();
|
||||||
|
}
|
||||||
|
public void PushAll32() {
|
||||||
|
new Pushad();
|
||||||
|
}
|
||||||
|
public void Return() {
|
||||||
|
new X86.Ret();
|
||||||
|
}
|
||||||
|
public void Return(UInt16 aBytes) {
|
||||||
|
new X86.Ret(aBytes);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue