diff --git a/source/Cosmos/Cosmos.Hardware/Global.cs b/source/Cosmos/Cosmos.Hardware/Global.cs index 3a3a411b8..71cf3f286 100644 --- a/source/Cosmos/Cosmos.Hardware/Global.cs +++ b/source/Cosmos/Cosmos.Hardware/Global.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text; +using Cosmos.Kernel; namespace Cosmos.Hardware { public class Global { @@ -42,7 +43,7 @@ namespace Cosmos.Hardware { uint xEnd = xStart + aMSec; Cosmos.Hardware.DebugUtil.SendNumber("PC", "Sleep", aMSec, 32); while (TickCount < xEnd) { - ; + CPU.Halt(); } Cosmos.Hardware.DebugUtil.SendMessage("PC", "Sleeping done"); } diff --git a/source/Cosmos/Cosmos.Kernel.Plugs/Assemblers/Halt.cs b/source/Cosmos/Cosmos.Kernel.Plugs/Assemblers/Halt.cs new file mode 100644 index 000000000..9342cbf77 --- /dev/null +++ b/source/Cosmos/Cosmos.Kernel.Plugs/Assemblers/Halt.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Indy.IL2CPU.Plugs; +using Indy.IL2CPU.Assembler; +using Assembler = Indy.IL2CPU.Assembler.Assembler; +using CPUAll = Indy.IL2CPU.Assembler; +using CPUx86 = Indy.IL2CPU.Assembler.X86; + +namespace Cosmos.Kernel.Plugs.Assemblers +{ + + public class Halt : AssemblerMethod + { + public override void Assemble(Assembler aAssembler) + { + new CPUx86.Hlt(); + } + } +} diff --git a/source/Cosmos/Cosmos.Kernel.Plugs/CPU.cs b/source/Cosmos/Cosmos.Kernel.Plugs/CPU.cs index 7a3fd5b27..1eb188e97 100644 --- a/source/Cosmos/Cosmos.Kernel.Plugs/CPU.cs +++ b/source/Cosmos/Cosmos.Kernel.Plugs/CPU.cs @@ -73,5 +73,12 @@ namespace Cosmos.Kernel.Plugs { b = 0; a = 0; } + + [PlugMethod(MethodAssembler = typeof(Assemblers.Halt))] + public static void Halt() + { + + } + } } diff --git a/source/Cosmos/Cosmos.Kernel.Plugs/Cosmos.Kernel.Plugs.csproj b/source/Cosmos/Cosmos.Kernel.Plugs/Cosmos.Kernel.Plugs.csproj index 1d78267ed..07c554aa3 100644 --- a/source/Cosmos/Cosmos.Kernel.Plugs/Cosmos.Kernel.Plugs.csproj +++ b/source/Cosmos/Cosmos.Kernel.Plugs/Cosmos.Kernel.Plugs.csproj @@ -54,6 +54,7 @@ + diff --git a/source/Cosmos/Cosmos.Kernel/CPU.cs b/source/Cosmos/Cosmos.Kernel/CPU.cs index 84cf92356..b519446ac 100644 --- a/source/Cosmos/Cosmos.Kernel/CPU.cs +++ b/source/Cosmos/Cosmos.Kernel/CPU.cs @@ -114,5 +114,11 @@ namespace Cosmos.Kernel { b = 0; a = 0; } + + //Plugged + public static void Halt() + { + + } } } \ No newline at end of file diff --git a/source/Indy.IL2CPU.Assembler.X86/Hlt.cs b/source/Indy.IL2CPU.Assembler.X86/Hlt.cs new file mode 100644 index 000000000..0fb4044dd --- /dev/null +++ b/source/Indy.IL2CPU.Assembler.X86/Hlt.cs @@ -0,0 +1,10 @@ +using System; +using System.Linq; + +namespace Indy.IL2CPU.Assembler.X86 +{ + [OpCode(0xF4, "hlt")] + public class Hlt : Instruction + { + } +} \ No newline at end of file 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 bca2329cd..d8a180851 100644 --- a/source/Indy.IL2CPU.Assembler.X86/Indy.IL2CPU.Assembler.X86.csproj +++ b/source/Indy.IL2CPU.Assembler.X86/Indy.IL2CPU.Assembler.X86.csproj @@ -64,6 +64,7 @@ +