Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!lll-tis!ames!hao!gatech!purdue!i.cc.purdue.edu!j.cc.purdue.edu!pur-ee!uiucdcs!uxc.cso.uiuc.edu!ccvaxa!kworrell From: kworrell@ccvaxa.UUCP Newsgroups: comp.sys.ibm.pc Subject: Re: _dos_setvect in MS C 5.0 Message-ID: <27000016@ccvaxa> Date: 25 Feb 88 02:14:00 GMT References: <277@mancol.UUCP> Lines: 43 Nf-ID: #R:mancol.UUCP:277:ccvaxa:27000016:000:1271 Nf-From: ccvaxa.UUCP!kworrell Feb 24 20:14:00 1988 This is the program (a bit stripped down to the bar essentials). All it does is count clock ticks. It is just the functions to set up the interrupt vector, to remove it, and the function which is called when the interrupt occurs. #include #define CLOCKINTR 0x1C /* clock intr vector */ void (interrupt far *oldtimer)(); /* addr of old clock intr */ long int clock_count = 0; /* count of ticks */ install() { void interrupt far handler(); /* declare ours */ oldtimer = _dos_getvect(CLOCKINTR); /* save old for reset */ _dos_setvect(CLOCKINTR,handler); /* set up our interrupt hdlr */ } remove() { _dos_setvect(CLOCKINTR, oldtimer); /* unchain */ } void interrupt far handler() { clock_count++; /* skip 18 tics */ #if defined(CHAINING) /* chain to old handler */ _chain_intr(oldtimer); #endif } ------------------------------------------------------------------------ Kurt J. Worrell USEnet1: ihnp4!uiucuxc!ccvaxa!kworrell Gould CSD-Urbana ARPAnet: kworrell@gswd-vms.arpa 1101 E. University !ARPAnet1: kworrell@Gould.COM Urbana, IL 61801 !ARPAnet2: kworrell@gswd-vms.Gould.COM *** Standard Disclaimer *** BELLnet: (217) 384-8500, x740