Xref: utzoo comp.lang.c:20271 comp.sys.ibm.pc:32378 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wasatch!helios.ee.lbl.gov!nosc!cod!bmarsh From: bmarsh@cod.NOSC.MIL (William C. Marsh) Newsgroups: comp.lang.c,comp.sys.ibm.pc Subject: Re: interrupt type in Turbo C Summary: interrupt supported with small mods Message-ID: <1591@cod.NOSC.MIL> Date: 31 Jul 89 18:46:55 GMT References: <2388@pur-phy> Distribution: na Organization: Naval Ocean Systems Center, San Diego Lines: 52 In article <2388@pur-phy>, murphy@pur-phy (William J. Murphy) writes: > I am woking on a program to interface with a DataTranslation board > from my Zenith PC 386. I came across a type of variable which I know > nothing about. The program was written in Turbo C and TC uses a type > interrupt. I looked at the manual for TC and found that this is specific > to TC, so my question is how would I implement this in MicroSoft C 5.1? > I have little experience programming interrupts, in fact this is > my first time in MS-DOS. > > > /* Function Prototypes */ > void interrupt DTintHandler(unsigned bp, unsigned di, unsigned si, > unsigned ds, unsigned es, unsigned dx, > unsigned cx, unsigned bx, unsigned ax); > void InitInt( int vector, void interrupt (*haddr) ()); > > > void interrupt DTintHandler(unsigned bp, unsigned di, unsigned si, > unsigned ds, unsigned es, unsigned dx, > unsigned cx, unsigned bx, unsigned ax); 'interrupt' functions are supported by MSC 5.1, however, the only documentation is in the 'readme' file on the setup disk... The only difference between Turbo C and MSC is that in Turbo the function is automatically made 'far', which is smart (MSC you *have* to say far), and the register contents are placed on the stack in a different order. (Here MSC is better, if you tell it to make 186 or 286 code, it can do a pusha/popa) Here is an example of the beginning of a critical error handler I wrote in C (both...) static void interrupt far #ifdef __TURBOC__ crit_error(bp, di, si, ds, es, dx, cx, bx, ax) unsigned bp, di, si, ds, es, dx, cx, bx, ax; #else crit_error(es, ds, di, si, bp, sp, bx, dx, cx, ax, ip, cs, flags) unsigned es, ds, di, si, bp, sp, bx, dx, cx, ax, ip, cs, flags; #endif { Hope this helps! Bill -------- Bill Marsh, Naval Ocean Systems Center, San Diego, CA {arpa,mil}net: bmarsh@cod.nosc.mil uucp: {ihnp4,akgua,decvax,dcdwest,ucbvax}!sdcsvax!nosc!bmarsh "If everything seems to be coming your way, you're probably in the wrong lane."