[comp.sys.ibm.pc] Beginner's question: interrupt handlers in MS-C 5.1.

kevin@kosman.uucp (Kevin O'Gorman) (02/02/90)

I feel both annoyed and stupid.  Maybe someone can help.

I've been programming in C for a while, but this is my first crack at
an Intel machine, let alone MSDOS.

I'm working at a new place and I would like to look at least better than
incompetent, so I don't want to mess up something that should be obvious.

This is my first task: take an interrupt handler from a TSR, writtem in
MASM, and rewrite it in C.  This is a 286 running DOS as an imbedded
controller.

I found _dos_setvect() and friends to do the INT 25H for me, but I read
in the manual:
	interrupt far *handler;
and
	If _handler_ is a C function, it must have been previously de-
	clared with the interrupt attribute. Otherwise, you must make
	sure that the function satisfies the requirements for an
	interrupt-handling routine."

Sounds good, but I have been completely unable to find any reference on
the "interrupt attribute" or on the requirements for ...

Anybody out there ever write one of these things?  What they talking
about, anyway???  About all I can think of is that the attribute may
set up DX for me on entry to the function.  The MASM examples all have
code to do that that assumes a tiny model, it seems, and that's not what
I have here.  Is that it???

norsk@sequent.UUCP (Doug Thompson) (02/03/90)

In article <1127@kosman.UUCP> kevin@kosman.uucp (Kevin O'Gorman) writes:
>I feel both annoyed and stupid.  Maybe someone can help.
>
>This is my first task: take an interrupt handler from a TSR, writtem in
>MASM, and rewrite it in C.  This is a 286 running DOS as an imbedded
>controller.
>
>I found _dos_setvect() and friends to do the INT 25H for me, but I read
>in the manual:
>	interrupt far *handler;
>and
>	If _handler_ is a C function, it must have been previously de-
>	clared with the interrupt attribute. Otherwise, you must make
>	sure that the function satisfies the requirements for an
>	interrupt-handling routine."
>
>Sounds good, but I have been completely unable to find any reference on
>the "interrupt attribute" or on the requirements for ...
>
>Anybody out there ever write one of these things?  What they talking
>about, anyway???  About all I can think of is that the attribute may
>set up DX for me on entry to the function.  The MASM examples all have
>code to do that that assumes a tiny model, it seems, and that's not what
>I have here.  Is that it???

Microsoft Systems Journal had an article on the 'interrupt' attribute.
It was about a year ago, I believe I have the article but its at home.

Send me your net address and I'll see about mailing a copy if you'd
like.

-- 
Douglas Thompson		UUCP: ..{tektronix,ogicse,uunet}!sequent!norsk
Sequent Computer Systems	Phone: (503) 526-5727
15450 SW Koll Parkway	!"The scientist builds to learn;the engineer learns in
Beaverton OR 97006	!order to build."  Fred Brooks