Int 20H [1.0] Terminate process

Terminates the current process. This is one of several methods that a program can use to perform a final exit. MS-DOS then takes the following actions:

All memory belonging to the process is released.

File buffers are flushed and any open handles for files or devices owned by the process are closed.

The termination handler vector (Int 22H) is restored from PSP:000AH.

The Ctrl-C handler vector (Int 23H) is restored from PSP:000EH.

[2.0+] The critical-error handler vector (Int 24H) is restored from PSP:0012H.

Control is transferred to the termination handler.

If the program is returning to COMMAND.COM, control transfers to the resident portion, and the transient portion is reloaded if necessary. If a batch file is in progress, the next line of the file is fetched and interpreted; otherwise, a prompt is issued for the next user command.

Call with:

CS = segment address of program segment prefix

Returns:

Nothing

Notes:

Any files that have been written to using FCBs should be closed before performing this exit call; otherwise, data may be lost.

Other methods of performing a final exit are:

Int 21H Function 00H

Int 21H Function 31H

Int 21H Function 4CH

Int 27H

[2.0+] Int 21H Functions 31H and 4CH are the preferred methods for termination, since they allow a return code to be passed to the parent process.

[3.0+] If the program is running on a network, it should remove all locks it has placed on file regions before terminating.

Example:

Terminate the current program, returning control to the program's parent.

.

.

.

int 20h ; transfer to MS-DOS