interrupt type in Turbo C

Brian Lanier blanier at mips.COM
Sat Jul 29 18:43:27 AEST 1989


In article <2388 at pur-phy> murphy at pur-phy (William J. Murphy) writes:
>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?

>From what I have read, the way to accomplish this in MSC is to use the
-S switch to generate the source listing and change "ret" to "iret". Of
course,  you then have to assemble/link that code in with the C.
Alternately, you could use debug, find the address of the ret instruction
and change it that way. (This is a real pain in the tuckus) (see note)
To install the interrupt, use Function 35h to get the current vector (for
later chaining, of course) and use Function 25h to set the new vector.
This takes the place of Turbo C's getvect() and setvect().  (I thinks MSC
5.0 added dos_getvect and dos_setvect, but I'm not sure).  

I hope that's what you were asking for. 

Brian Lanier
blanier at mips.com
blanier at scueng.scu.edu

note: if you feel you have to use the debug method (maybe you don't have a
good assembler), the coding for ret is :

		  11000011                        return within a segment
		  11000000 data-low data-high     return within a segment
										   with a pop value
          11001011                        intersegment return
		  11001010 data-low data-high     intersegment return with a 
										   pop value

I would be suprised if there was a pop value (if there is you have to code
it out as iret won't let you have one.)  The coding for iret is :
  
		  11001111

Just replace the right bit pattern. Use the u in debug to find the ret.



More information about the Comp.lang.c mailing list