19.4.1 Understanding DOS Stacks

DOS functions set up their own stacks, which makes them nonreentrant. If a TSR interrupts a DOS function and then executes another function that sets up the same stack, the second function will overwrite everything placed on the stack by the first function. The problem occurs when the second function returns and the first is left with unusable stack data. A TSR that calls a DOS function must not interrupt any function that uses the same stack.

Summary: With few exceptions, DOS functions use their own stacks when they execute.

DOS versions 2.0 and later use three internal stacks: an I/O stack, a disk stack, and an auxiliary stack. The current stack depends on the DOS function. Functions 01 through 0Ch set up the I/O stack. Functions higher than 0Ch (with few exceptions) use the disk stack, as do Interrupts 25h and 26h. DOS normally uses the auxiliary stack only when it executes Interrupt 24h (Critical Error Handler).