mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-21 21:38:52 +00:00
Fix dividing now
This commit is contained in:
parent
043e2339fb
commit
860efefe5d
3 changed files with 23 additions and 2 deletions
20
source/Indy.IL2CPU.Assembler.X86/IDivide.cs
Normal file
20
source/Indy.IL2CPU.Assembler.X86/IDivide.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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" />
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue