Message-ID: <365693BC.6B54EC5C@jps.net> Date: Sat, 21 Nov 1998 02:19:40 -0800 From: Willy Lee Organization: WombatSoft X-Mailer: Mozilla 4.04 [en] (Win95; I) MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: TSRs with DJGPP? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 209.239.196.63 X-NNTP-Posting-Host: 209.239.196.63 Lines: 44 X-NNTP-Posting-Host: 209.63.114.134 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi, I've been trying to write a little keyboard-translation TSR today and was looking in the FAQ; there's quite a bit there about interrupt handling which has been very useful but I couldn't find very much about installing an interrupt handler as a TSR. Has anyone any pointers or tutorials dealing with this topic? I saw the DPMI functions for staying resident as a protected-mode service provider to other DPMI clients, but I want to stay resident to hook hardware interrupts while at the DOS command prompt, so that won't work. I guess I need to install a real-mode interrupt handler, and actually place the handler code in conventional memory (by allocating a DOS block and copying the code there). And I'm guessing that the real-mode handler code can use segment:offset addressing, since it will only be called in real mode. Now when I terminate and stay resident (using DOS function Int21h, 31h), my allocated DOS blocks will stay in memory. So the interrupt vectors will point to the right code. I could even write a real-mode callback, since the protected-mode memory would never get released, since the app never really exited as far as the DPMI host knows...can this be right?? Wait a second! Does __dpmi_set_real_mode_interrupt_vector set the vector only in the current IDT, or does it set the entry in the real-mode IVT at 0000:0000? The DPMI spec isn't clear to me on this question. It seems to me that the TSR would need the vector set in the real-mode IVT. My head is starting to buzz and it's getting pretty late for me to think, so I'll quit here for the night and await any answers you might have. P.S. please cc: me any replies, I suspect that my ISP has a tendency to have newsgroup posts go missing occasionally. Thanks, =wl -- Willy Lee uses some form of Emacs http://www.jps.net/willy2 ICQ-UIN: 7570905 "People hardly ever make use of the freedom which they have, for example, freedom of thought; instead they demand freedom of speech as a compensation." -- S.K.