Interrupt 27h Terminate And Stay Resident
(0:009Ch) (obsolete, see Int\21f\31)
This vector is used by programs that are to remain resident on exit.
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 Int\27. 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.
entry CS current program segment
DX last program byte + 1
return none
note 1) This interrupt must not be used by .EXE programs that are loaded into
the high end of memory.
2) This interrupt restores the Int\22, Int\23, and Int\24 vectors
in the same manner as Int\20. 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 int 27 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 Int\21f\49 (Free Allocated Memory).
Interrupt 27h Terminate And Stay Resident
5) DOS call Int\21f\4C allows a program to pass a completion code to DOS,
which can be interpreted with processing (see DOS call Int\21f\4D).
6) Terminate and stay resident programs do not close files.
7) Int\21f\31 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.
o Ref: Programmers Problem Solver 1986 Robert Jourdain:
At the time that int 27h or Int\20 is executed, CS must point to the start
of the program segment prefix for this function to work properly. In COM
programs, CS is initially set to this position, and so you need simply end the
program with int 27h. In EXE programs, on the other hand, CS initially points
to the first byte following the PSP (that is , to 100h). In the normal
termination of an EXE program, the final RET instruction pops off the stack the
first values pushed on to the stack: PUSH DS;MOV AX,0;PUSH AX. Since DS
initially points to the bottom of the PSP, when these values are popped the
instruction pointer is directed to offset 0 in the PSP, which is initialized to
contain the code for int 20h. Int 20h is then executed, and it is the standard
function for terminating programs and returning control to DOS. To make int 27h
work in an EXE program poke 27h into the second byte of the PSP (the first
holds the machine code for "int"), and end the program with the usual RET. For
both kinds of file, before int 27h is executed DX must contain the offset of
the end of the program, starting from the beginning of the PSP.
file: /Techref/int/27.htm, 3KB, , updated: 1999/4/21 07:09, local time: 2024/12/28 07:25,
|
| ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://linistepper.com/Techref/int/27.htm"> int 27</A> |
Did you find what you needed?
|