mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-09 09:42:13 +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++;
|
TickCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Change this to use an x86 Op or something so it doesnt
|
|
||||||
// just thrash
|
|
||||||
public static void Sleep(uint aMSec) {
|
public static void Sleep(uint aMSec) {
|
||||||
uint xStart = TickCount;
|
|
||||||
uint xEnd = xStart + aMSec;
|
|
||||||
Cosmos.Hardware.DebugUtil.SendNumber("PC", "Sleep", aMSec, 32);
|
Cosmos.Hardware.DebugUtil.SendNumber("PC", "Sleep", aMSec, 32);
|
||||||
while (TickCount < xEnd) {
|
CPU.Halt();//At least one hlt even if aMSec is 0
|
||||||
CPU.Halt();
|
if (aMSec > 0)
|
||||||
|
{
|
||||||
|
uint xStart = TickCount;
|
||||||
|
uint xEnd = xStart + aMSec;
|
||||||
|
while (TickCount < xEnd)
|
||||||
|
{
|
||||||
|
CPU.Halt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Cosmos.Hardware.DebugUtil.SendMessage("PC", "Sleeping done");
|
Cosmos.Hardware.DebugUtil.SendMessage("PC", "Sleeping done");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue