[fpc-pascal]high performance counter for dos/tp7

Harald Houppermans houppermans at home.nl
Sat Mar 20 20:02:05 CET 2004


Hello,

I thought I give this newsgroup a try since you guys seem to know so much
about all this stuff :D.

Windows has a high performance counter api.

With this api one can read the tick frequency and the tick count.

Dividing the tick count by the tick frequency gives the time that has past
or a timestamp.

Substracting two timestamps from each other with care gives one the time
that has past pretty accurately.

I need the same functionality in dos.

The high performance counter of windows can be used for millisecond accuracy
and even microsecond accuracy.

I have some code available which is for the pit chip (programmable interval
timer).  For my purposes it would probably be enough to have millisecond
accuracy... ( that would interrupt my program thousand times ) if I want
microsecond accuracy the pit chip would be set with a frequency of 1 million
which would interrupt my program a million times.

So a computer calling an interrupt routine a million times (for microsecond
accuracy) that does not seem like a good idea performance wise.

Also calculating the control word (?) can be inaccurate (?):  control_word
:= $1234DD div frequency; ( ??? what about the remainder ??? )

So I don't really need any interrupts... I only need to be able to read some
sort of thing that gives me a tick count and possible a tick frequency.

What are my alternatives for dos/turbo pascal 7 ?

( What about 32 bit free pascal :D ? )

Thanks for any help you can give,

Skybuck.





More information about the fpc-pascal mailing list