[comp.os.msdos.programmer] which timer interrupt to use?

pst@ack.stanford.edu (Paul Traina) (09/18/90)

I'm writing a rallye clock to work under MSDOS.  This is a timer that
counts in 100ths of minutes (600 milisecond ticks).

Originally, I was doing it by speeding up the system timer and counting
ticks, then calling the original INT 1A routine from my handler every
n ticks.  Well, this made correction for delay really ugly,  so I've
now just reprogrammed the system timer to generate interrupts exactly
20 times a second instead of 18.207 times a second.
This lets me count 12 interrupts and bump by 600ms "tick" counter.

Now, the long and the short of it is that I know this screws up the
system time-of-day clock.  I don't care.  It's close enough that it
shouldn't screw up the floppy drive timeout too bad either.

I now have one question left (after examining the BIOS code).

INT 1A is triggered by the system timer.  The BIOS interrupt handler
in turn calls INT 1C when it is done doing its stuff.

I'd like this application to be usable with QuarterDeck or PC view or
any reasonable multi-tasking executive (I don't want to make this into
a TSR if I can avoid it).  So, should I be stealing INT 1A or INT 1C?
Right now I steal 1A and know how that works.

Paul
--
You know what Stuart, I like you.  You're not like the other people, here,
in the trailer park.  Now don't get me wrong,  they're good Americans;
but they're content to sit back,  maybe watch a little Mork and Mindy on
channel 57...maybe kick back a cool Coors 16-ouncer.	-- the dead milkmen

trier@cwlim.CWRU.EDU (Stephen C. Trier) (09/18/90)

In article <pst.653596434@ack.stanford.edu> pst@ack.stanford.edu (Paul Traina) writes:
>Originally, I was doing it by speeding up the system timer and counting
>ticks, then calling the original INT 1A routine from my handler every
>n ticks.  Well, this made correction for delay really ugly,  so I've
>now just reprogrammed the system timer to generate interrupts exactly
>20 times a second instead of 18.207 times a second.

Here's an idea -- not particularily new, but a good one.  Rather than
give up on your real-time clock, just bump it over every now and then.
In other words, use the following rule:  If (i is not a multiple of ten)
or (i is equal to 100), then (give the BIOS a timer tick).

This will keep your system clock in sync while maintaining your 20 Hz
signal.  I like passing on a correct clock tick, especially since it
doesn't really take that much extra work or time to do so.

-- 
Stephen Trier                              Case Western Reserve University
Work: trier@cwlim.ins.cwru.edu             Information Network Services
Home: sct@seldon.clv.oh.us