TSR's with TC

Tom Ivar Helbekkmo edb_tom at tor.nhh.no
Wed Aug 23 13:10:21 AEST 1989


In article <3723 at ncsuvx.ncsu.edu>, sherman at csclea.ncsu.edu (Chris Sherman) writes:
> _chain_intr, which is usually used in an interrupt handler, accepts the
> address of another interrupt handler, and jumps (not calls) over to it.
> It is as if the first handler was never called.
> 
> What can I do in TC to achieve the same effect?  I thought of calling the
> second interrupt handler like you would call any function, given its
> address, but I'm not sure this will work correctly every time.

No, you certainly can't do it that way.  In MSC, when you declare a
function "interrupt", you're telling the compiler that it will be used
as an interrupt handler.  The compiler then arranges for it to push all
registers upon entry, *and restore them* on exit, then leave with an
iret instead of a ret.  In this scenario, the _chain_intr() function
restores the registers, and then jumps to the specified place, which had
better be another interrupt handler...  :-)

Correct me if I'm wrong, someone, but unless Turbo C has explicit
support for writing interrupt handlers in C, you'll need to write your
own (at the assembly level) to be able to do this sort of thing.  I
think the Blaise C Tools library is available for Turbo C -- it among
other things helps you do interrupt processing in C.  BCT is, in my
opinion, a very good product, at a reasonable price.

-tih

-- 
Tom Ivar Helbekkmo, NHH, Bergen, Norway.  Telephone:  +47-5-959205
edb_tom at tor.nhh.no, thelbekk at norunit.bitnet, helbekkmo at nhh.uninett



More information about the Comp.lang.c mailing list