How MS-DOS TSRs Hooked Interrupts to Run Background Tasks in 640K
MS-DOS TSRs achieved background tasks by hooking interrupt vectors and staying resident via INT 21h/31h. This blog explains the mechanism, the non-reentrant kernel's InDOS flag constraint, and includes a minimal assembly example you can run in DOSBox.