From 860efefe5d9f2e02defbc23511b76a76e21fa9bf Mon Sep 17 00:00:00 2001
From: mterwoord_cp <7cd3fd84a0151ea055c2f79e4d2eef9576fe9afesxUZAwxD>
Date: Sat, 5 Jan 2008 16:23:46 +0000
Subject: [PATCH] Fix dividing now
---
source/Indy.IL2CPU.Assembler.X86/IDivide.cs | 20 +++++++++++++++++++
.../Indy.IL2CPU.Assembler.X86.csproj | 1 +
source/Indy.IL2CPU.IL.X86/Div.cs | 4 ++--
3 files changed, 23 insertions(+), 2 deletions(-)
create mode 100644 source/Indy.IL2CPU.Assembler.X86/IDivide.cs
diff --git a/source/Indy.IL2CPU.Assembler.X86/IDivide.cs b/source/Indy.IL2CPU.Assembler.X86/IDivide.cs
new file mode 100644
index 000000000..38c1e8ca0
--- /dev/null
+++ b/source/Indy.IL2CPU.Assembler.X86/IDivide.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Indy.IL2CPU.Assembler.X86 {
+ ///
+ /// Puts the result of the divide into EAX, and the remainder in EDX
+ ///
+ [OpCode(0xFFFFFFFF, "idiv")]
+ public class IDivide: Instruction {
+ private string mSource;
+ public IDivide(string aSource) {
+ mSource = aSource;
+ }
+ public override string ToString() {
+ return "idiv " + mSource;
+ }
+ }
+}
diff --git a/source/Indy.IL2CPU.Assembler.X86/Indy.IL2CPU.Assembler.X86.csproj b/source/Indy.IL2CPU.Assembler.X86/Indy.IL2CPU.Assembler.X86.csproj
index 912487687..2be630850 100644
--- a/source/Indy.IL2CPU.Assembler.X86/Indy.IL2CPU.Assembler.X86.csproj
+++ b/source/Indy.IL2CPU.Assembler.X86/Indy.IL2CPU.Assembler.X86.csproj
@@ -56,6 +56,7 @@
+
diff --git a/source/Indy.IL2CPU.IL.X86/Div.cs b/source/Indy.IL2CPU.IL.X86/Div.cs
index 845ca02c1..71e46b855 100644
--- a/source/Indy.IL2CPU.IL.X86/Div.cs
+++ b/source/Indy.IL2CPU.IL.X86/Div.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);
}
}