This commit is contained in:
kudzu_cp 2008-04-27 19:51:23 +00:00
parent 9c190531a7
commit d28e87baf8
9 changed files with 59 additions and 33 deletions

View file

@ -23,33 +23,34 @@ namespace Indy.IL2CPU.Assembler.X86 {
Label = "DebugWriteEIP";
AL = Memory[EBP + 3];
new Push(Registers.EAX);
EAX.Push();
Call("WriteByteToComPort");
AL = Memory[EBP + 2];
new Push(Registers.EAX);
EAX.Push();
Call("WriteByteToComPort");
AL = Memory[EBP + 1];
new Push(Registers.EAX);
EAX.Push();
Call("WriteByteToComPort");
AL = Memory[EBP];
new Push(Registers.EAX);
EAX.Push();
Call("WriteByteToComPort");
Return();
Label = "DebugPoint_WaitCmd";
DX = xComStatusAddr;
new InByte(Registers.AL, Registers.DX);
AL = Port[DX];
AL.Test(0x01);
new JumpIfZero("DebugPoint_WaitCmd");
JumpIfZero("DebugPoint_WaitCmd");
Jump("DebugPoint_ProcessCmd");
Label = "DebugPoint__";
PushAll32();
new Move(Registers.EBP, Registers.ESP);
//new Move(Registers.EBP, Registers.ESP);
EBP = ESP;
new Add(Registers.EBP, 32);
// Check TraceMode
new Move(Registers.EAX, "[TraceMode]");
EAX = Memory["TraceMode"];
new Compare(Registers.AX, 1);
JumpIfEqual("DebugPoint_NoTrace");
//

View file

@ -124,7 +124,7 @@
<Compile Include="Test.cs" />
<Compile Include="Xor.cs" />
<Compile Include="X\AddressIndirect.cs" />
<Compile Include="X\AddressNumeric.cs" />
<Compile Include="X\AddressDirect.cs" />
<Compile Include="X\Memory.cs" />
<Compile Include="X\Address.cs" />
<Compile Include="X\MemoryAction.cs" />

View file

@ -10,5 +10,13 @@ namespace Indy.IL2CPU.Assembler.X86.X {
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);
}
}
}

View 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();
}
}
}

View file

@ -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);
}
}
}

View file

@ -7,6 +7,10 @@ using X86 = Indy.IL2CPU.Assembler.X86;
namespace Indy.IL2CPU.Assembler.X86.X {
public abstract class Register {
public void Push() {
new Push(ToString());
}
protected void Move(string aValue) {
new X86.Move(ToString(), aValue);
}

View file

@ -22,12 +22,12 @@ namespace Indy.IL2CPU.Assembler.X86.X {
}
public static implicit operator RegisterAL(PortNumber aValue) {
new X86.InByte("AL", aValue.ToString());
new X86.InByte(Name, aValue.ToString());
return Instance;
}
public static implicit operator RegisterAL(MemoryAction aAction) {
new X86.Move("AL", aAction.ToString());
new X86.Move(Name, aAction.ToString());
return Instance;
}

View file

@ -12,6 +12,11 @@ namespace Indy.IL2CPU.Assembler.X86.X {
return Name;
}
public static implicit operator RegisterEAX(MemoryAction aAction) {
Instance.Move(aAction.ToString());
return Instance;
}
public static implicit operator RegisterEAX(UInt32 aValue) {
Instance.Move(aValue.ToString());
return Instance;

View file

@ -16,5 +16,12 @@ namespace Indy.IL2CPU.Assembler.X86.X {
Instance.Move(aValue.ToString());
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;
}
}
}