Int 22h Termination Address
Interrupt 22h is not used as an interrupt. Instead, 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.
Programs must not issue Interrupt 22h.
──────────────────────────────────────────────────────────────────
The termination address is a return address back to the program
that started the current program. DOS transfers control to the
termination address as the last step in completing Terminate
Program (Int 20h), Terminate Program (Int 21h, function 00h), Keep
Program (Int 21h, function 31h), End Program (Int 21h, function
4ch), and Terminate and Stay Resident (Int 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, DOS
restores the parent program's stack and PSP. Furthermore, if a
program terminates by using Int 20h, Int 21h/00h, or Int 21h/4ch,
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.