INT 21 - DOS 1+ - TERMINATE PROGRAM
AH = 00h
CS = PSP segment
Notes: Microsoft recommends using INT 21/AH=4Ch for DOS 2+
this function sets the program's return code (ERRORLEVEL) to 00h
execution continues at the address stored in INT 22 after DOS performs
whatever cleanup it needs to do (restoring the INT 22,INT 23,INT 24
vectors from the PSP assumed to be located at offset 0000h in the
segment indicated by the stack copy of CS, etc.)
on MS-DOS v1 dirty FATs are written, the two or three INT vectors are
copied to the IVT, and the resulting INT 22 vector is used along
with the original (child / process that's terminating) user stack
to return to the parent. the CS:IP and FL on the stack are not
popped and the live FL contains IF=1 DF=0 and arithmetic status
flags from XOR AX,AX (including ZF=1 CF=0).
if the PSP is its own parent, the process's memory is not freed; if
INT 22 additionally points into the terminating program, the
process is effectively NOT terminated
not supported by MS Windows 3.0 DOSX.EXE DOS extender
INT 20, INT 27, AH=00h, AH=26h, AH=31h, AH=4Bh, and AH=4Ch are
expected to be special cased by interrupt hooks (eg dosemu2)
so that they receive exactly the same user stack as was set
up by the interrupt caller.
SeeAlso: AH=26h,AH=31h,AH=4Ch,INT 20,INT 22