Richard said:
I distinctly remember writing a stand-alone C library for MS-DOS that talked
directly to hardware.
Richard is correct, if a bit terse.
On the IBM PC it is generally a good idea to use the highest level of
access feasible.
The levels would something like:
(1) Standard C library functions.
(2) Compiler-supplied extended functions.
(3) Third-party libraries.
(4) MSDOS int 21h calls.
(5) BIOS calls (int 10h for video, int 13h for disk, ... )
(6) Direct port or memory I/O.
I've ordered them roughly by portability and cleanliness.
But some aspects of the hardware were not very well supported by 1 to
5, so *many* applications:
(a) wrote directly to video memory, as the standard BIOS or MSDOS calls
were either inflexible, slow, totally bollixed, or a combination of the
above.
(b) Directly controlled the serial port, as there was no support in
MSDOS or the BIOS for high speeds, using hardware buffering, or using
interrupts.
(c) Many apps also wrote directly to the printer port, as the BIOS had
weird timeout and error lockout settings.
(d) Many apps twiddled the speaker control registers to generate odd
sounds.
-----
The disk, however, had pretty adequate BIOS and MSDOS support, so very
few apps talked directly to the disk, except maybe for copy-protection
checks.
---
This continued on into the Windows 3.1/95/98/Me days, as many apps and
tools still had to go directly to the hardware.
With the coming of WIndows NT/2000/XP and the various Unixes, direct
hardware access was made very difficult to impossioble, without having
admin rights to add device drivers or access the kernel.