MS-DOS system dependencies

Under MS-DOS, the OSDI is implemented as a TSR (Terminate and Stay Resident) program. It intercepts INT 21 (the operating system call), and passes instructions for the NUL printer to the user exit code. The I/O control instruction (INT 21, Function 44) is used for device selection, including input devices, and returning error codes.

The inp_idle() function switches between a foreground process which is called by the DP4 Terminal Manager for input and output, and a background process which runs all the time executing inp_task() and putting characters into a circular buffer from which the application takes them as required. All stack and Program Segment Prefix (PSP) switching is handled automatically, so the OSDI code does not require any special care, and can do file handling in the usual way.

Note however that the high-level file handling functions provided by compilers may not work from a TSR; it is recommended that the DP4 function _msdos() be used.

When called from inp_task() the effect of inp_idle() is to allow the application to run; the application may then call inp_start() or inp_stop() or the prn_xxx() functions. The effect of this is that functions such as inp_start() and inp_stop() appear to inp_task() to be called during the execution of inp_idle().