Path: utzoo!utgpu!water!watmath!clyde!att!pacbell!ames!mailrus!eecae!driscoll From: driscoll@eecae.UUCP (Mike Driscoll) Newsgroups: comp.lang.c Subject: Re: Turbo C Message-ID: <10231@eecae.UUCP> Date: 22 Jul 88 13:51:30 GMT References: <16577@brl-adm.ARPA> Organization: Engineering, Michigan State U., E. Lansing MI Lines: 46 in article <16577@brl-adm.ARPA>, C08922DB%WUVMD.BITNET@cunyvm.cuny.edu says: > > > I am interested in understanding the structure of the function type > "interrupt" in Turbo C. Basically, what is special about this function > definition, and what approaches can be used in other compilers to simulate > this feature? Optimum-C is what I'm using. > > Thanks in advance, > > Thank you. > Don Branson > C08922DB@WUVMD.BITNET In TurboC, a function declared to be of type interrupt has three major differences: 1. All registers are pushed onto the stack on entry and popped from the stack on exit. 2. The DS register is set to point to the DGROUP of the program. 3. The function returns with an return from interrupt instruction (IRET) instead of a normal return (RET). Note that pushing the registers on the stack makes them available to the function as if they were function parameters. They may be changed and the changed values will be placed in the registers on return. If your compiler allows inline assembly language, you can probably insert the neccesary instructions in any function that should be interrupt. You need to know how to access the address of the DGROUP segment. You might also be able to compile to assembly language and insert the needed assembly code in the file and then assemble that to get an executable. Mike -- Michael A. Driscoll UUCP: ...ihnp4!msudoc!eecae!driscoll Dept. of Electrical Engineering ARPA: driscoll@eecae.ee.msu.edu (35.8.8.151) Michigan State University Office: (517) 353-5337 E. Lansing, MI, 48824