Fix dividing now

This commit is contained in:
mterwoord_cp 2008-01-05 16:23:46 +00:00
parent 043e2339fb
commit 860efefe5d
3 changed files with 23 additions and 2 deletions

View file

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Indy.IL2CPU.Assembler.X86 {
/// <summary>
/// Puts the result of the divide into EAX, and the remainder in EDX
/// </summary>
[OpCode(0xFFFFFFFF, "idiv")]
public class IDivide: Instruction {
private string mSource;
public IDivide(string aSource) {
mSource = aSource;
}
public override string ToString() {
return "idiv " + mSource;
}
}
}

View file

@ -56,6 +56,7 @@
<Compile Include="CLD.cs" />
<Compile Include="CmpXchg.cs" />
<Compile Include="Compare.cs" />
<Compile Include="IDivide.cs" />
<Compile Include="Stosw.cs" />
<Compile Include="JumpNotCary.cs" />
<Compile Include="RepeatMovsb.cs" />

View file

@ -16,7 +16,7 @@ namespace Indy.IL2CPU.IL.X86 {
new CPUx86.Pop(CPUx86.Registers.ECX);
new CPUx86.Add("esp", "4");
new CPUx86.Pop(CPUx86.Registers.EAX);
new CPUx86.Divide(CPUx86.Registers.ECX);
new CPUx86.IDivide(CPUx86.Registers.ECX);
//new CPUx86.Push("0");
new CPUx86.Pushd(CPUx86.Registers.EAX);
@ -24,7 +24,7 @@ namespace Indy.IL2CPU.IL.X86 {
new CPUx86.Xor(CPUx86.Registers.EDX, CPUx86.Registers.EDX);
new CPUx86.Pop(CPUx86.Registers.ECX);
new CPUx86.Pop(CPUx86.Registers.EAX);
new CPUx86.Divide(CPUx86.Registers.ECX);
new CPUx86.IDivide(CPUx86.Registers.ECX);
new CPUx86.Pushd(CPUx86.Registers.EAX);
}
}