A service program's interrupt handler receives execution control from programs that use the int instruction to issue an interrupt. The calling program, before issuing the interrupt, fills registers with whatever values are needed. The interrupt handler determines which function to carry out and uses the values passed to it to complete the function.
The service program may install a handler for any nonreserved interrupt. (Most interrupts from 00h through 7Fh are reserved by MS-DOS or by the computer's ROM BIOS.) Rather than use a new interrupt, however, many service programs expand the multiplex-interrupt handler they install so that it also receives and processes function requests and replies to queries about the installation state.
When the interrupt handler receives control, the stack, the current program segment prefix (PSP), and the current disk transfer address (DTA) belong to the calling program. In addition, any registers not explicitly used with the function request may contain values that the calling program expects to remain unchanged. If the interrupt handler changes any of these resources, it must save and then restore the original resource before returning.
The current program's PSP determines which open files are available to the interrupt handler. To access files other than those opened by the calling program, the interrupt handler must change the current PSP by using Set PSP Address (Interrupt 21h Function 50h). It can retrieve the current PSP by using Get PSP Address (Interrupt 21h Function 51h).
If the interrupt handler uses the buffer pointed to by the current DTA, it should change the current address to the address of its own buffer by using Set Disk Transfer Address (Interrupt 21h Function 1Ah). This change ensures that any data in the buffer pointed to by the calling program's DTA is not overwritten. The interrupt handler can retrieve the current DTA by using Get Disk Transfer Address (Interrupt 21h Function 2Fh).