modern timers in DOS (32bit) (Developers)
> I´m thinking of a lapic timer or perhaps the hpet, and yes I would like to
> generate interrupts at a specific frequency. I fully understand that on a
> PC the timer interrupts are not that precise than on other "platforms".
Those kinds of timers can indeed be used to generate interrupts. For experimental/private purposes that can be OK, but since they only exist on some computers (they are not very "universal") I personally wouldn't normally use them. As others have indicated, they may not even work (at least correctly) in at least some Virtual Machines.
What I normally use is the RTC (IRQ 8/INT 70h) which is programmable through the CMOS. It is programmable to generate interrupts from 2 Hz up to 8192 Hz in factors of 2^n (2, 4, 8, 16, ...) with the default of 1024 Hz. As mceric indicated, it's not used by too many programs so you can reprogram it to something other than 1024. I would still avoid reprogramming it, though. I use it in some of my programs and even though it would be "nice" to reprogram it I don't because of the potential issues it CAN cause when the program is not in complete control of everything. That's also why I never reprogram the PIC timer for IRQ 0 (INT 8).
>> If you're just wanting to "monitor" the frequency and don't require
>> hardware notifications (interrupts) at each tick of the clock, that can
>. use a different approach.
>
> You are thinking of the time stamp counter or ?
The TSC is one way, but again that's less "universal" than using something like the PIC counter (which is what Japheth's code uses). The PIC counter has a resolution of about a microsecond, which is more than sufficient for most applications.
There are also"tricks " you can play with things like USB host controllers. The USB bus has its own "ecosystem" and timers and you can sometimes tap into those timers if you're careful. You really can't use the USB host hardware to generate interrupts "on demand" (though my USB drivers have an "extension" that allows you to do it). But you can use the USB hardware to "monitor" time durations.
Complete thread:
- modern timers in DOS (32bit) - LowLevel, 05.05.2022, 11:11 (Developers)
- modern timers in DOS (32bit) - bretjohn, 05.05.2022, 19:05
- modern timers in DOS (32bit) - mceric, 05.05.2022, 20:53
- modern timers in DOS (32bit) - Japheth, 06.05.2022, 08:06
- modern timers in DOS (32bit) - LowLevel, 06.05.2022, 08:37
- modern timers in DOS (32bit) - LowLevel, 06.05.2022, 08:29
- modern timers in DOS (32bit) - RayeR, 18.05.2022, 22:40
- modern timers in DOS (32bit) - Japheth, 06.05.2022, 08:06
- modern timers in DOS (32bit) - LowLevel, 06.05.2022, 08:08
- modern timers in DOS (32bit) - bretjohn, 06.05.2022, 20:01
- modern timers in DOS (32bit) - tkchia, 08.05.2022, 17:57
- modern timers in DOS (32bit) - bretjohn, 06.05.2022, 20:01
- modern timers in DOS (32bit) - mceric, 05.05.2022, 20:53
- modern timers in DOS (32bit) - Laaca, 05.05.2022, 20:56
- modern timers in DOS (32bit) - LowLevel, 06.05.2022, 08:30
- modern timers in DOS (32bit) - bretjohn, 05.05.2022, 19:05