Turbo C

Mike Driscoll driscoll at eecae.UUCP
Fri Jul 22 23:51:30 AEST 1988


in article <16577 at brl-adm.ARPA>, C08922DB%WUVMD.BITNET at 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 at 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 at eecae.ee.msu.edu  (35.8.8.151)
Michigan State University        Office: (517) 353-5337
E. Lansing, MI, 48824



More information about the Comp.lang.c mailing list