Contents of the TIMERHI.DOC file
The machine code module timer.asm contains two functions.
Each function is C compatable in the medium model.
Neither function has any parameters passed to it.
void far time_int(void);
long int far elaptime(void);
the return from elaptime() is a 32 bit value returned in dx:ax (correct
for Microsoft C version 5.0 and QuickBasic 4.0).
The value represents the elapsed time since the previous call. Each count
is 838.2ns (1.19318 mHz clock). It is assumed that 32 bits will provide
sufficient duration, internally the counting is done to 48 bits.
The routines can be called from QuickBasic by declaring the functions
as CDECL (use "." instead of underscore in time_int). An example of
QB usage is included as TEST.BAS.
The routines have been used on IBM PC's, XT's 4.77/8mHz XT clones, 6 mHz
IBM AT's, 6 and 8mHz IBM industrial 7532 (AT like) machines.
They depend on the 8253 counter in these machines being at port 040.
The time_int() function modifies the setup of the counters to use pulse
output rather than square wave output. This does not seem to have any
effect on the system timing but the user should be on the lookout for
any effects on system time. Each call to time_int() has the potential to
lose up to 55msec from absolute time because it resets the timer chip
registers to 0 in the process of changing the timer mode. The time_int()
function need only be called once from a powerup unless some other program
you might use also plays with the timer. Normally it is called on program
It has been used mainly with a C program that monitors pulse durations by
waiting for an edge of an external signal (brought in via DTR on an COM:
port) and calling deltime() at those points. These values were then saved
and analysed later. It is important that the decision measure and program
path following the decision have the same duration if measure to measure
values are to be consistant.
Michael Walraven (301) 997-8856 [72375,1657]