Interrupt 27h   Terminate And Stay Resident                  

Input

DOS1 Y DOS2 Y

DOS3

Y DOS5 Y

Output

AX

        AX

BX

        BX

CX

        CX

DX

 Last Program Byte + 1     DX

CS

 Current Program Segment   CF
     This vector is used by programs that are to remain  resident when
     COMMAND.COM regains control.

     After  initializing  itself,  the program must set DX to its last
     address plus one relative to the program's initial DS or ES value
     (the offset at which other  programs can be loaded), then execute
     interrupt 27h. DOS then considers  the program as an extension of
     itself,  so  the  program is not overlaid when other programs are
     executed. This is  useful  for loading programs such as utilities
     and interrupt handlers that must remain resident.

Notes:

     1)   This  interrupt  must  not be used by .EXE programs that are
          loaded into the high end of memory.

     2)   This interrupt restores  the  interrupt  22h,  23h,  and 24h
          vectors in the  same  manner as interrupt 20h. Therefore, it
          cannot be used to install permanently resident Ctrl-Break or
          critical error handler routines.

     3)   The maximum size of memory that can be made resident by this
          method is 64K.

     4)   Memory can  be more efficiently used if the block containing
          a copy of the environment is deallocated before terminating.
          This can be done by loading ES with the segment contained in
          2Ch  of  the  PSP,  and  issuing  function  call  49h  (Free
          Allocated Memory).

     5)   DOS function call 4Ch allows  a program to pass a completion
          code to DOS,  which  can be interpreted with processing (see
          function call 31h).

     6)   Terminate and stay resident programs do not close files.

     7)   Int  21, function 31h is the preferred  method  to  cause  a
          program  to  remain  resident  because  this  allows  return
          information to be passed  and  allows  a program larger than
          64K to remain resident.

See Also Func/31h Func/00h INT/20h Func/4Ch


Copyright © 1985 to 2022 Beta Systems                            Last modified: Wednesday, January 05, 2022 .