Mail Archives: djgpp/1998/06/14/12:00:33
> 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?
Does your TSR use the transfer buffer or any RTL routines which use the
transfer buffer? If so, you need the size of the PSP plus the transfer
buffer size you are using.
> 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:
For a DOS TSR to go away, you need to unhook all interrupts and deallocate the
memory. Don't call 0x31 again, just free the DOS PSP and environment (cwsdpmi
does this for it's own image). Unwinding the DPMI image is a more difficult -
you need to do an exit() call which frees the DPMI memory, frees the selectors,
etc. There must not be another DPMI image running "nested" under the TSR -
the signal for it to exit must come from a real mode program.
Reading the paragraph above - hummm - yes it's possible but very complicated.
It may even be a bit different under different DPMI providers.
- Raw text -