[comp.sys.ibm.pc] reading system timer?

"bradley grigor" <bradley.grigor@canrem.uucp> (03/04/91)

As part of a system performance analysis exercise, I would like
to read the *internal counting register* of the PC system timer
channel 0.  This is the timer channel that creates the system
clock interrupts 18.2 times per second.

I want to determine how many internal timer counts (which run at
the relatively high speed of 1.193180 MHz) have elapsed since the
last system clock interrupt. I have tried to do it essentially as
follows:

         MOV  AL,36h   ;select timer channel 0
         OUT  43h,AL   ;  for reading LSB first
         IN   AL,40h   ;read the LSB
         MOV  BL,AL    ;  and save it
         IN   AL,40h   ;read the MSB
         MOV  BH,AL    ;  and save it
   ;
   ; Now BX contains the 16-bit counter value.
   ;

This works but there is a serious problem: when this code reads
timer channel 0, it causes the timer channel AND the stream of
18.2 interrupts per second to STOP (or so it would appear)!  Of
course, this wasn't what I had in mind.  But I also didn't expect
this because I thought this timer channel was gated in hardware
to run continuously!  I guess I was wrong!

Can someone tell me how to read timer channel 0 without STOPPING
it?  In the meantime, I have some other options to explore, but
using timer channel 0 is really the best one.  Thanks for your
help.

...bag  Newmarket, Ontario, Canada | RelayNet: ->CRS (Public Key: 7596)
  UUCP: lsuc!canrem!bradley.grigor | others: bradley.grigor@canrem.uucp
---
 ? DeLuxe??c #4613 ? Be C-ing you.
--
Canada Remote Systems.  Toronto, Ontario
NorthAmeriNet Host