interrupt type in Turbo C
William C. Marsh
bmarsh at cod.NOSC.MIL
Tue Aug 1 04:46:55 AEST 1989
In article <2388 at pur-phy>, murphy at 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 at 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."
More information about the Comp.lang.c
mailing list