Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!rutgers!ucsd!hub.ucsb.edu!spinrad From: spinrad@rigel.ucsb.edu (Sanford Spinrad) Newsgroups: comp.os.msdos.programmer Subject: TSR programming with MSC Message-ID: <8646@hub.ucsb.edu> Date: 30 Jan 91 21:01:06 GMT Sender: news@hub.ucsb.edu Reply-To: spinrad@cornu.ucsb.edu Distribution: comp Organization: UC Santa Barbara Computer Science Lines: 38 I'm having a problem with TSR programming with MSC. My final goal is write something which catches DOS int 21 read string so that you can do history and file completetion. So I started out by writing a TSR which gets activated from int 60H. The interrupt handler calls a simple c function (_interrupt type) via a jmp (This was done because MSC automatically inserts a return from interrupt after the fucntion completes). The c function only contains 1 printf statement. When I generate the int 60H from the program which installed the int 60H interrupt, everything works fine. But after I TSR the handler and generate int 60H from debug, the print statement prints out garbage and then returns. I am just about positive that this is NOT a re-entrant problem. I know at the time that the int 60H is occuring that the cpu is executing my code, not dos, so it can't be re-entering dos. This leads me to believe that there's something going wrong with the printf library function. I traced through the beginning of the printf fucntion and saw that it did get the correct pointer to the string that it was supposed to print, and the string still contained the correct data. So I'm beginning to belive that I need to do somekind of environmental restoration in order to get the c library to behave correctly. But I don't know what needs to be done. I tried restoring various register values but none of this helped. So I would like to know if my guess is correct in that the c library needs some pointers restored. If so, which library functions are affected (i.e. is only the print routines?). Also what needs to be done to restore the environment? Many thanks, Sandy -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Sandy Spinrad Internet: spinrad@cornu.ucsb.edu UUNET: uunet!hub.ucsb.edu!spinrad@cornu