diff --git a/source/Boot/TestSuite/Tests/MathTest.cs b/source/Boot/TestSuite/Tests/MathTest.cs index 54e9656e9..7ca778132 100644 --- a/source/Boot/TestSuite/Tests/MathTest.cs +++ b/source/Boot/TestSuite/Tests/MathTest.cs @@ -29,6 +29,10 @@ namespace TestSuite.Tests Assert(5 - 2 == 3, "5 - 2 == 3"); Assert(2 + 5 * 2 == 12, "2 + 5 * 2 == 12"); Assert((2 + 5) * 2 == 14, "(2 + 5) * 2 == 14"); + //long al = 0x1FFFFFFFF; + //long bl = 0x1FFFFFFFF;//1L; + ////al += bl; + //Assert(al == bl, "Int64 Equality"); UInt32 a = 5; UInt32 b = 5; diff --git a/source/Cosmos.sln b/source/Cosmos.sln index 7ac13bcc3..eea9a0104 100644 --- a/source/Cosmos.sln +++ b/source/Cosmos.sln @@ -89,11 +89,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FrodeTest", "FrodeTest\Frod EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Driver.RTL8139", "Cosmos.Driver.RTL8139\Cosmos.Driver.RTL8139.csproj", "{1F7ACC2A-EA38-4B10-AB87-9450BBCC8D6F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MathTest", "Tests\MathTest\MathTest.csproj", "{4AB1907A-84A0-4E7C-B490-A841979802FC}" -EndProject Global GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 38 + SccNumberOfProjects = 37 SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} SccTeamFoundationServer = https://tfs04.codeplex.com/ SccLocalPath0 = . @@ -241,10 +239,6 @@ Global SccProjectTopLevelParentUniqueName36 = Cosmos.sln SccProjectName36 = Cosmos.Driver.RTL8139 SccLocalPath36 = Cosmos.Driver.RTL8139 - SccProjectUniqueName37 = Tests\\MathTest\\MathTest.csproj - SccProjectTopLevelParentUniqueName37 = Cosmos.sln - SccProjectName37 = Tests/MathTest - SccLocalPath37 = Tests\\MathTest EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -392,10 +386,6 @@ Global {1F7ACC2A-EA38-4B10-AB87-9450BBCC8D6F}.Debug|Any CPU.Build.0 = Debug|Any CPU {1F7ACC2A-EA38-4B10-AB87-9450BBCC8D6F}.Release|Any CPU.ActiveCfg = Release|Any CPU {1F7ACC2A-EA38-4B10-AB87-9450BBCC8D6F}.Release|Any CPU.Build.0 = Release|Any CPU - {4AB1907A-84A0-4E7C-B490-A841979802FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4AB1907A-84A0-4E7C-B490-A841979802FC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4AB1907A-84A0-4E7C-B490-A841979802FC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4AB1907A-84A0-4E7C-B490-A841979802FC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -439,7 +429,6 @@ Global {7EB6E2FF-74C8-4F59-9923-EB8EF1DE098E} = {EBF602FE-8AFC-408D-A9F1-560C35651090} {8C566493-DBA5-45DD-93D4-89D4486CAAB6} = {EBF602FE-8AFC-408D-A9F1-560C35651090} {DA1DFD9E-B80C-4304-BCBA-B313255F6B01} = {EBF602FE-8AFC-408D-A9F1-560C35651090} - {4AB1907A-84A0-4E7C-B490-A841979802FC} = {EBF602FE-8AFC-408D-A9F1-560C35651090} {8F2D5231-CDE5-48FA-9D26-D4305B01FD3C} = {7EB6E2FF-74C8-4F59-9923-EB8EF1DE098E} EndGlobalSection EndGlobal diff --git a/source/Indy.IL2CPU.Assembler.X86/AddWithCarry.cs b/source/Indy.IL2CPU.Assembler.X86/AddWithCarry.cs index 5c6f5dcab..dcd0e8152 100644 --- a/source/Indy.IL2CPU.Assembler.X86/AddWithCarry.cs +++ b/source/Indy.IL2CPU.Assembler.X86/AddWithCarry.cs @@ -8,16 +8,16 @@ namespace Indy.IL2CPU.Assembler.X86 [OpCode(0xFFFFFFFF, "adc")] public class AddWithCarry : Instruction { - public readonly string Address1; - public readonly string Address2; - public AddWithCarry(string aAddress1, string aAddress2) + public readonly string Dest; + public readonly string Source; + public AddWithCarry(string dest, string source) { - Address1 = aAddress1; - Address2 = aAddress2; + Dest = dest; + Source = source; } public override string ToString() { - return "adc " + Address1 + "," + Address2; + return "adc " + Dest + "," + Source; } } } diff --git a/source/Indy.IL2CPU.IL.X86/Ldc_I8.cs b/source/Indy.IL2CPU.IL.X86/Ldc_I8.cs index ce2263534..0bf80830b 100644 --- a/source/Indy.IL2CPU.IL.X86/Ldc_I8.cs +++ b/source/Indy.IL2CPU.IL.X86/Ldc_I8.cs @@ -2,17 +2,27 @@ using System; using System.IO; using CPU = Indy.IL2CPU.Assembler.X86; using Indy.IL2CPU.Assembler; +using System.Diagnostics; namespace Indy.IL2CPU.IL.X86 { [OpCode(OpCodeEnum.Ldc_I8)] public class Ldc_I8: Op { private readonly long mValue; public Ldc_I8(ILReader aReader, MethodInformation aMethodInfo) - : base(aReader, aMethodInfo) { - mValue = Int64.Parse(aReader.Operand.ToString()); + : base(aReader, aMethodInfo) + { + Debug.Assert(aReader.Operand.Length == 8); + + ulong value = 0; + for (int i = 7; i >=0; i--) + { + value <<= 8; + value |= aReader.Operand[i]; + } + mValue = (long)value; } public override void DoAssemble() { - string theValue = mValue.ToString("X"); + string theValue = mValue.ToString("X16"); new CPU.Pushd("0" + theValue.Substring(0, 8) + "h"); new CPU.Pushd("0" + theValue.Substring(8) + "h"); Assembler.StackContents.Push(new StackContent(8, typeof(long))); diff --git a/source/Indy.IL2CPU.IL.X86/Op.cs b/source/Indy.IL2CPU.IL.X86/Op.cs index 4d7acf422..b93fa2356 100644 --- a/source/Indy.IL2CPU.IL.X86/Op.cs +++ b/source/Indy.IL2CPU.IL.X86/Op.cs @@ -264,12 +264,9 @@ namespace Indy.IL2CPU.IL.X86 { } if (xSize.Size > 4) { new CPUx86.Pop("eax"); - new CPUx86.Add("esp", "4"); - new CPUx86.Add("eax", "[esp]"); - new CPUx86.Add("esp", "4"); - new CPUx86.Add("esp", "4"); - new CPUx86.Pushd("0"); - new Pushd("eax"); + new CPUx86.Pop("edx"); + new CPUx86.Add("[esp]", "eax"); + new CPUx86.AddWithCarry("[esp + 4]", "ebx"); } else { new CPUx86.Pop("eax"); new CPUx86.Add("[esp]", "eax");