mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-26 21:42:11 +00:00
This commit is contained in:
parent
9c190531a7
commit
d28e87baf8
9 changed files with 59 additions and 33 deletions
|
|
@ -23,33 +23,34 @@ namespace Indy.IL2CPU.Assembler.X86 {
|
||||||
|
|
||||||
Label = "DebugWriteEIP";
|
Label = "DebugWriteEIP";
|
||||||
AL = Memory[EBP + 3];
|
AL = Memory[EBP + 3];
|
||||||
new Push(Registers.EAX);
|
EAX.Push();
|
||||||
Call("WriteByteToComPort");
|
Call("WriteByteToComPort");
|
||||||
AL = Memory[EBP + 2];
|
AL = Memory[EBP + 2];
|
||||||
new Push(Registers.EAX);
|
EAX.Push();
|
||||||
Call("WriteByteToComPort");
|
Call("WriteByteToComPort");
|
||||||
AL = Memory[EBP + 1];
|
AL = Memory[EBP + 1];
|
||||||
new Push(Registers.EAX);
|
EAX.Push();
|
||||||
Call("WriteByteToComPort");
|
Call("WriteByteToComPort");
|
||||||
AL = Memory[EBP];
|
AL = Memory[EBP];
|
||||||
new Push(Registers.EAX);
|
EAX.Push();
|
||||||
Call("WriteByteToComPort");
|
Call("WriteByteToComPort");
|
||||||
Return();
|
Return();
|
||||||
|
|
||||||
Label = "DebugPoint_WaitCmd";
|
Label = "DebugPoint_WaitCmd";
|
||||||
DX = xComStatusAddr;
|
DX = xComStatusAddr;
|
||||||
new InByte(Registers.AL, Registers.DX);
|
AL = Port[DX];
|
||||||
AL.Test(0x01);
|
AL.Test(0x01);
|
||||||
new JumpIfZero("DebugPoint_WaitCmd");
|
JumpIfZero("DebugPoint_WaitCmd");
|
||||||
Jump("DebugPoint_ProcessCmd");
|
Jump("DebugPoint_ProcessCmd");
|
||||||
|
|
||||||
Label = "DebugPoint__";
|
Label = "DebugPoint__";
|
||||||
PushAll32();
|
PushAll32();
|
||||||
new Move(Registers.EBP, Registers.ESP);
|
//new Move(Registers.EBP, Registers.ESP);
|
||||||
|
EBP = ESP;
|
||||||
new Add(Registers.EBP, 32);
|
new Add(Registers.EBP, 32);
|
||||||
|
|
||||||
// Check TraceMode
|
// Check TraceMode
|
||||||
new Move(Registers.EAX, "[TraceMode]");
|
EAX = Memory["TraceMode"];
|
||||||
new Compare(Registers.AX, 1);
|
new Compare(Registers.AX, 1);
|
||||||
JumpIfEqual("DebugPoint_NoTrace");
|
JumpIfEqual("DebugPoint_NoTrace");
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@
|
||||||
<Compile Include="Test.cs" />
|
<Compile Include="Test.cs" />
|
||||||
<Compile Include="Xor.cs" />
|
<Compile Include="Xor.cs" />
|
||||||
<Compile Include="X\AddressIndirect.cs" />
|
<Compile Include="X\AddressIndirect.cs" />
|
||||||
<Compile Include="X\AddressNumeric.cs" />
|
<Compile Include="X\AddressDirect.cs" />
|
||||||
<Compile Include="X\Memory.cs" />
|
<Compile Include="X\Memory.cs" />
|
||||||
<Compile Include="X\Address.cs" />
|
<Compile Include="X\Address.cs" />
|
||||||
<Compile Include="X\MemoryAction.cs" />
|
<Compile Include="X\MemoryAction.cs" />
|
||||||
|
|
|
||||||
|
|
@ -10,5 +10,13 @@ namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
return new AddressIndirect(aRegister, 0);
|
return new AddressIndirect(aRegister, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static implicit operator Address(UInt32 aAddress) {
|
||||||
|
return new AddressDirect(aAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator Address(string aLabel) {
|
||||||
|
return new AddressDirect(aLabel);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
23
source/Indy.IL2CPU.Assembler.X86/X/AddressDirect.cs
Normal file
23
source/Indy.IL2CPU.Assembler.X86/X/AddressDirect.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
|
public class AddressDirect : Address {
|
||||||
|
protected readonly string mAddress;
|
||||||
|
|
||||||
|
public AddressDirect(UInt32 aAddress) {
|
||||||
|
mAddress = aAddress.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AddressDirect(string aLabel) {
|
||||||
|
mAddress = "[" + aLabel + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString() {
|
||||||
|
return mAddress.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -7,6 +7,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 {
|
||||||
|
|
||||||
|
public void Push() {
|
||||||
|
new Push(ToString());
|
||||||
|
}
|
||||||
|
|
||||||
protected void Move(string aValue) {
|
protected void Move(string aValue) {
|
||||||
new X86.Move(ToString(), aValue);
|
new X86.Move(ToString(), aValue);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,12 @@ namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator RegisterAL(PortNumber aValue) {
|
public static implicit operator RegisterAL(PortNumber aValue) {
|
||||||
new X86.InByte("AL", aValue.ToString());
|
new X86.InByte(Name, aValue.ToString());
|
||||||
return Instance;
|
return Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static implicit operator RegisterAL(MemoryAction aAction) {
|
public static implicit operator RegisterAL(MemoryAction aAction) {
|
||||||
new X86.Move("AL", aAction.ToString());
|
new X86.Move(Name, aAction.ToString());
|
||||||
return Instance;
|
return Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,11 @@ namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
return Name;
|
return Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static implicit operator RegisterEAX(MemoryAction aAction) {
|
||||||
|
Instance.Move(aAction.ToString());
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
|
|
||||||
public static implicit operator RegisterEAX(UInt32 aValue) {
|
public static implicit operator RegisterEAX(UInt32 aValue) {
|
||||||
Instance.Move(aValue.ToString());
|
Instance.Move(aValue.ToString());
|
||||||
return Instance;
|
return Instance;
|
||||||
|
|
|
||||||
|
|
@ -16,5 +16,12 @@ namespace Indy.IL2CPU.Assembler.X86.X {
|
||||||
Instance.Move(aValue.ToString());
|
Instance.Move(aValue.ToString());
|
||||||
return Instance;
|
return Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Use Generics to add all the stuff that is common between all register
|
||||||
|
// but must exist on actual register type
|
||||||
|
public static implicit operator RegisterEBP(RegisterESP aValue) {
|
||||||
|
Instance.Move(aValue.ToString());
|
||||||
|
return Instance;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue