mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-27 22:12:25 +00:00
Modified Sleep, now Sleep(0) calls hlt one time
This commit is contained in:
parent
70432fb9eb
commit
4a4744082b
1 changed files with 9 additions and 6 deletions
|
|
@ -36,14 +36,17 @@ namespace Cosmos.Hardware {
|
|||
TickCount++;
|
||||
}
|
||||
|
||||
//TODO: Change this to use an x86 Op or something so it doesnt
|
||||
// just thrash
|
||||
public static void Sleep(uint aMSec) {
|
||||
uint xStart = TickCount;
|
||||
uint xEnd = xStart + aMSec;
|
||||
Cosmos.Hardware.DebugUtil.SendNumber("PC", "Sleep", aMSec, 32);
|
||||
while (TickCount < xEnd) {
|
||||
CPU.Halt();
|
||||
CPU.Halt();//At least one hlt even if aMSec is 0
|
||||
if (aMSec > 0)
|
||||
{
|
||||
uint xStart = TickCount;
|
||||
uint xEnd = xStart + aMSec;
|
||||
while (TickCount < xEnd)
|
||||
{
|
||||
CPU.Halt();
|
||||
}
|
||||
}
|
||||
Cosmos.Hardware.DebugUtil.SendMessage("PC", "Sleeping done");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue