2 ms·
When you write C code on MS-DOS, you usually don't directly call INT 21h. Instead you call fopen(),printf(), etc, which are library calls which call INT 21h in
by skissane 8y ago
When you write C code on MS-DOS, you usually don't directly call INT 21h. Instead you call fopen(),printf(), etc, which are library calls which call INT 21h in their implementation. As well as standard C functions, there are also C functions for MS-DOS specific services, e.g. chdrive(), findfirst(), etc.
Even when you want to call some INT 21h service which doesn't have a C function, it is more common to use interrupt functions like int86() or intdos() than to use inline assembly. (Or something like __dpmi_int from 32-bit code, such as DJGPP)
So, I don't think MS-DOS is as different from Linux/Unix as you think. High-level language code on MS-DOS (whether in C or Pascal or BASIC or whatever) usually doesn't directly invoke INT 21h, it goes through higher-level libraries / wrapper functions. Only software written in assembly tends to invoke INT 21h directly.
- pdkl95 8y ago> Only software written in assembly tends to invoke INT 21h directly. Or anybody that wasn't satisfied with the high-level libraries. We just looked up the functionality[2] we needed in Ralf Brown's list[1]. [1] http://www.ctyme.com/rbrown.htm http://www.ctyme.com/rbrown.htm (INT 21h http://www.ctyme.com/intr/int-21.htm http://www.ctyme.com/intr/int-21.htm ) [2] http://www.ctyme.com/intr/rb-0250.htm http://www.ctyme.com/intr/rb-0250.htm