2.5.1 Device-Independent Programs device independence>

Programs written to use specific devices or to run under a specific version of MS-DOS may not run successfully on all computers. To ensure device independence, programmers should use the following guidelines:

Avoid direct calls to ROM BIOS routines. Although most computers provide a ROM BIOS, there is no guarantee that all ROM BIOSs are 100-percent compatible.

Avoid direct access to devices. Programs that improve their performance by accessing devices directly cannot be guaranteed to run successfully on all MS-DOS computers. For example, a program that writes to video memory will work only on computers that have the same or compatible video adapters. Programs should rely on device drivers to access devices.

Avoid using “undocumented” features. System functions, interrupts, and structures that are internal to MS-DOS are subject to change at any time. Programs that use these undocumented features cannot be guaranteed to run with future versions of MS-DOS.

Check the MS-DOS version number before using a version's features. Since users may attempt to run programs with older versions of MS-DOS, programs that use features of the latest version should use the system function that retrieves the MS-DOS version number. If the versions do not match, a program can avoid using the features or terminate.

Check the original equipment manufacturer (OEM) version number before using OEM features. Many computer manufacturers adapt MS-DOS for their own computers and in the process may provide additional features that take advantage of the hardware. Although programs can use these additional features, they should use the system function that retrieves the OEM version number before proceeding.