modern timers in DOS (32bit) (Developers)
Hi mceric,
> No you do not. If you do not spend too much CPU time in your handler, even
> ancient 386 already allowed you to create timer interrupts at a rate of
> many 1000 per second, using the classic
> https://en.wikipedia.org/wiki/Intel_8253 chip. This was used in audio
> players for people without sound cards
>
> Actually 18.2 Hz is the SLOWEST possible speed (1.19MHz / 64k) which is
> used by the BIOS to use as little CPU time for wall clock updates as
> possible. Everybody is free to change to a different speed as long as they
> take care of keeping the 40:6c clock run at the same speed, for example by
> only calling the original int 8 handler once for one in every X interrupts
> generated by the 8253. There are plenty of tutorials for such things from
> the 1990s
Hmmm,... that´s exactly what I tried, but unfortunately I was not able to get more than 1024Hz,...I will do some more investigations on that - maybe its because I use a mainboard which "simulates" the old 8253,...
> You can also use the RTC timer interrupt or ask the BIOS to wait for N
> microseconds. The latter is usually implemented by the BIOS activating a
> 1024 Hz RTC interrupt, but you can also get 2 Hz and 8192 Hz RTC interrupt
> rates.
>
> The nice thing about using RTC interrupt 0x70 is that it is independent
> from int 0x08 and int 0x1c, so you do not have to worry about whether and
> how often to call previous interrupt 0x08 handlers. You will probably have
> the RTC interrupt all for yourself on many systems, it is not widely used
> otherwise.
> The disadvantage is that you only have a choice of 2, 1024 or 8192 Hz. If
> you want more flexibility, use good old 8253 int 8, which can have any
> frequency between 18.2 Hz and 0.6 MHz, but you better limit yourself to
> 1/10 or 1/100 of that to avoid wasting too much CPU time. On a 386, even 10
> kHz already means a significant CPU load even with optimized handler code.
I will try it too, THX´s for the hint!
> Of course, if you feel masochistic, you could use modern timers such as
> HPET or similar. Modern computers are likely to even contain various extra
> microcontrollers for maintenance stuff or I/O interfaces. Who knows what
> sorts of abuse can be implemented using those :-p
masochistic ,... hahahaha,.. ;)
> If you only want to measure time in a very fine-grained way, use the TSC.
> Every Intel CPU since at least Pentium had a time stamp counter and most
> other brands introduced one not much later. The time stamps typically have
> a very high resolution, for example CPU clock cycles, and processors may
> even compensate the counts for you when changing clock speeds in power
> saving modes. TSC is easy to use, you just need a little helper to fetch
> the value, usually written in Assembly.
I know!
> More DOS-friendly C compilers may already have the helper prepared for you.
> Protected mode OS may not let you access the real counter, so I guess your
> mileage may vary with a DOS application running in Windows. But that would
> certainly not let you manipulate HPET or ACPI stuff either. I wonder
> whether Windows offers a simulated 8253 to DOS boxes, does anybody know? In
> any case, before using RDTSC, make sure that you can actually access it.
> https://www.felixcloutier.com/x86/rdtsc
I want to run my programs just in DOS! My next challenge is to check if I can access the hpet, lapic timer ,.. thru a dos extender with a high frequency ,... I´m not sure at the moment.
THX´s for your time to reply !!!
LowLevel
Complete thread:
- modern timers in DOS (32bit) - LowLevel, 05.05.2022, 11:11
- 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