Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!mit-eddie!nathan From: nathan@eddie.MIT.EDU (Nathan Glasser) Newsgroups: comp.sys.ibm.pc Subject: File usage in interrupt handlers Message-ID: <6207@eddie.MIT.EDU> Date: Sat, 27-Jun-87 05:14:49 EDT Article-I.D.: eddie.6207 Posted: Sat Jun 27 05:14:49 1987 Date-Received: Sun, 28-Jun-87 00:39:50 EDT Organization: MIT EE/CS Computer Facility, Cambridge, MA Lines: 37 Suppose I've got a procedure set up as an interrupt handler, and I either make its containing program resident (Dos fn 31h), or make its containing program run (spawn) another program. (These two cases are really very similar). And suppose I wish the handler to open a file and leave the file open between invocations of the handler, eventually closing it on some other invocation. Just doing it in the straightforward way doesn't work. I set up the handler to be resident, and had another program X cause interrupts (based on keystrokes). I found that the handler could successfully open, write, and close the file as long as we don't exit X. If I exit X after opening the file, the file is automatically closed. This leads me to believe that Dos thinks that the file is one of the ones opened by program X, and therefore closes it when X exits. (Strictly speaking, I was using MSC, and it may be its exit() call that closes all the files. I'm not sure on this point, but I don't think it matters). Someone told me I might have to deal with the PSP (program segment prefix) in order to make the files work right. Could someone who knows how to make this work please explain the steps necessary to do it. Hopefully it will be something simple, like just telling Dos that that it should look at my handler program's PSP instead of X's PSP, and then putting things back again. I don't know where the PSP for a running program is located, nor do I know how does knows where its "current" PSP is located. Thanks, -- Nathan Glasser nathan@mit-eddie.uucp (usenet) fnord nathan@xx.lcs.mit.edu (arpa) "A tribble is the only love that money can buy."