The _osmajor, _osminor, _osmode, _osversion, and _cpumode variables specify the version number of the operating system or the current mode of operation.
They are declared in the STDLIB.H include file as follows:
extern unsigned char _osmajor;
extern unsigned char _osminor;
extern unsigned char _osmode;
extern unsigned char _osversion;
extern unsigned char _cpumode;
The _osmajor, _osminor, and _osversion variables specify the version number of DOS or Windows in use. The _osmajor variable holds the “major” version number, and the _osminor variable stores the “minor” version number. Thus, under DOS version 5.0, _osmajor is 5 and _osminor is 0. The _osversion variable holds both values: its low byte contains the major version number and its high byte contains the minor version number.
These variables are useful for creating programs that run in different versions of DOS and Windows. For example, you can test the _osmajor variable before making a call to _sopen; if the major version number is earlier (less) than 3, _open should be used instead of _sopen.
The _osmode variable indicates the currently running operating system—_DOS_MODE, which is defined as 0, and _WIN_MODE, which is defined as 2.
The _cpumode variable indicates the mode of the currently running operating system—_REAL_MODE, which is defined as 0, and _PROT_MODE, which is defined as 2.