Hello everybody,
I'm working on a boot sector, related to the "512 byte challenge" as posted here: http://forum.osdev.org/viewtopic.php?f=1&t=25492
For that I wondered if I could code snake in 512 bytes, so I went ahead to work on that. But now I need to sleep for some interval. I found an interrupt providing a timer that ticks at approximately 18.2 Hz, but I need something more accurate. Is there any way provided by the BIOS to sleep, or to retrieve the approximate time in milliseconds?
Worst case I'll run the same instruction(s) for a larger number of times, but I'd rather have a better solution.
Any ideas?
Thanks in advance
Sleeping in real-mode
-
- Member
- Posts: 510
- Joined: Wed Mar 09, 2011 3:55 am
Re: Sleeping in real-mode
The PIT can be reprogrammed to generate interrupts at higher frequencies than 18 Hz (in fact, 18 Hz is its lowest frequency).
You can find more information on this by searching the Wiki for "PIT".
You can find more information on this by searching the Wiki for "PIT".
Re: Sleeping in real-mode
Perfect, thank you!
Re: Sleeping in real-mode
Since you are most probably looking for something consuming as little space as possible, I guess you might be interested in the BIOS wait call (theoretically providing microsecond resolution): http://www.ctyme.com/intr/rb-1525.htm
Re: Sleeping in real-mode
Even easier! Thank you, both!XanClic wrote:Since you are most probably looking for something consuming as little space as possible, I guess you might be interested in the BIOS wait call (theoretically providing microsecond resolution): http://www.ctyme.com/intr/rb-1525.htm