INT 20H: Program Terminate
This interrupt is a superseded fn. When running under DOS 2.0+, you
should use fn 4cH instead. It is still supported and may be used to exit
from a program and return control to its parent (usually COMMAND.COM).
Note: The CS register must contain the value of the PSP for the
terminating process.
COM-format programs usually run with CS=PSP, so they may issue
INT 20H at any time. EXE programs may perform a FAR JMP or a FAR
RET to pass control to PSP:0000 which contains an INT 20H
instruction.
As with other program termination services:
■ It restores the values of DOS vectors: INT 22H INT 23H INT 24H.
■ It flushes all file buffers and closes all open files.
■ If you are using file-sharing, you must unlock all locked files and
records.
It is advisable to use DOS Fn 4cH (terminate) to avoid difficulties that
occur when CS is not the same as the PSP. Fn 4cH also lets you set an
exit code, checkable by the IF ERRORLEVEL batch command.
See Also: Program Startup & Exit
Process Control Functions
DOS Functions
-♦-