Interrupt 22h Termination Address

Termination Address (Interrupt 22h) is not used as an interrupt. Instead, MS-DOS stores the termination address for the current program in the corresponding vector-table entry. This address is also specified in offset 0Ah in the current program's PSP (pspTerminateVector field).

Programs must not issue Interrupt 22h.

Comments

The termination address is a return address back to the program that started the current program. MS-DOS transfers control to the termination address as the last step in completing Terminate Program (Interrupt 20h), Terminate Program (Interrupt 21h Function 00h), Keep Program (Interrupt 21h Function 31h), End Program (Interrupt 21h Function 4Ch), and Terminate and Stay Resident (Interrupt 27h). These functions always restore the vector-table entry from offset 0Ah in the current PSP before transferring control, so changes to the vector-table entry are ignored.

Before transferring control to the termination address, MS-DOS restores the parent program's stack and PSP. Furthermore, if a program terminates by using Terminate Program (Interrupt 20h or Interrupt 21h Function 00h) or End Program (Interrupt 21h Function 4Ch), MS-DOS frees all resources for the program, such as allocated memory, stack, files, and standard devices. This means that changes to the termination address in the PSP or direct calls to the termination address may corrupt the operation of the system.

See Also

Interrupt 20h Terminate Program
Interrupt 21h Function 00h Terminate Program
Interrupt 21h Function 31h Keep Program
Interrupt 21h Function 4Ch End Program
Interrupt 27h Terminate and Stay Resident