delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/14/11:00:25

From: "Jan Humme" <info AT imedia-engineering DOT nl>
Newsgroups: comp.os.msdos.djgpp
Subject: How do I gracefully terminate my TSR application?
Date: 14 Jun 1998 14:58:38 GMT
Organization: Imedia Engineering BV
Lines: 38
Message-ID: <6m0oeu$c94@news3.euro.net>
NNTP-Posting-Host: i450.asd.euronet.nl
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I now have working code to install a TSR application that can be accessed by
a software interrupt handler (will mail the skeleton to the newsgroup when
finished).

The TSR code was downloaded from the mail archives and looks like this:

__go32_dpmi_registers r;
/* ............... */
r.x.ax = 0x3100;
r.x.dx = 1000;    // more than emough
__dpmi_int(0x21, &r);

Q1) How can I compute the correct value to be passed in the DX register?
Currently I am passing 1000 paragraphs because this is more than enough, but
how can I compute the exact number?

Q2) Now I want to implement a "quit" command, that will also reach the TSR
via the software interrupt handler. But how can my TSR terminate itself
gracefully? I have tried:

__go32_dpmi_registers r;
/* restore original interrupt handlers */
r.x.ax = 0x3100;
r.x.dx = 0;    // terminate
__dpmi_int(0x21, &r);

But after this code has been executed, the PC still runs, but it seems I get
a page fault on evry program that I try to run (including the DJGPP
compiler). This is not caused by improper interrupt restoring, because if I
leave my program in the regular way, everything is OK.

Any suggestions?

--
Jan Humme.



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019