DOS/16M

Tenberry Home

Consulting Services

DOS/16M FAQ

Release Notes

DPMI Spec

* * *

DOS/4GW

DOS/4G

DOS/16M FAQ:
What is DOS/16M?


[Index of FAQ] * [Next Section]
  1. Is DOS/16M a replacement for DOS?
  2. What is a DOS extender?
  3. What is Protected Mode?
  4. What is Real Mode?
  5. How Does a DOS Extender Work?
  6. What happens when my program makes a DOS request -- does DOS/16M handle it?
  7. How about BIOS requests?
  8. How about TSR or device driver calls?
  9. All this seems complicated -- why bother?
  10. All this seems complicated -- will my program slow down?
  11. Can I use my existing 16-bit compiler?

1. Is DOS/16M a replacement for DOS?

No. DOS/16M doesn't replace DOS, but rather extends the capability of the DOS you already have to allow for larger programs. Because of this extending, DOS/16M is called a DOS extender.


2. What is a DOS extender?

A DOS extender is a program that runs your program in the protected mode of Intel 286, 386, 486, Pentium and later processors. Doing so provides your DOS program with many megabytes of main memory. Your program can transparently access all of the memory in today's PCs.


3. What is Protected Mode?

Protected mode (really Protected Virtual Mode) is Intel's name for the native operating mode of 286, 386, 486, Pentium and later CPU chips. The two main characteristics of Protected mode are 1) a much larger address space (many megabytes) and 2) a much greater level of hardware protection. Except for a slight change in addressing, protected mode uses exactly the same machine instructions as real mode.

Linux, FreeBSD, OS/2, and Windows (95,98,ME,NT,2000,XP) all run in protected mode. Your DOS program can as well, if you use DOS/16M.


4. What is Real Mode?

Real mode is Intel's name for the 8086 compatibility mode in which all Intel chips start execution. Even though Pentium and other Intel chips are 32-bit powerful processors, they start execution acting as though they were 16-bit 8086 processors, so that they can run DOS. This 8086 compatibility mode is called 'Real' mode. ('Real' is the computer-science opposite of 'Virtual'.) Since real mode is, in some sense, the opposite of protected mode (protected virtual mode), it should be called 'Unprotected Real Compatibility' mode. 'Real mode' is shorter and easier to say.

DOS runs in real mode.


5. How Does a DOS Extender Work?

DOS can only load and execute real-mode programs. The DOS/16M DOS extender is incorporated into your application. When DOS starts your application, it first starts the copy of DOS/16M, which is the real-mode program that DOS sees. DOS/16M then loads your program into extended memory, switches to protected mode, and starts your program executing.


6. What happens when my program makes a DOS request -- does DOS/16M handle it?

Partially, but most of the work is done by DOS, just as in your real-mode programs. All of your program's requests for services from DOS, such as allocating memory, or opening a file, are signalled by a software interrupt. DOS/16M handles the interrupt, switches to real mode, and then resignals the same interrupt to DOS. It looks to DOS like the DOS/16M program made the request. After DOS is finished processing the request, it returns to DOS/16M. DOS/16M then switches to protected mode, and returns to your program the results that DOS returned to DOS/16M.

To your program, DOS/16M serves as a surrogate for DOS, as though DOS could operate in protected mode.

To DOS, DOS/16M serves as a surrogate for your program, as though your program were operating in real mode.


7. How about BIOS requests?

Common BIOS requests are handled the same way as DOS requests, so that your current code will execute unchanged in protected mode.


8. How about TSR or device driver calls?

Essentially, they are handled in a similar manner. However, because DOS/16M can't be coded for every special-purpose device and interrupt call, the buffer copying that DOS/16M does for standard software interrupts isn't done for all interrupts. To handle these cases, we provide an extensive API of utility routines so that you can copy and translate addresses as appropriate for the interrupts your program uses.


9. All this seems complicated -- why bother?

Because in protected mode, your program can address many megabytes of memory, not just the 640KB that DOS programs have been traditionally limited to. And that means you can run huge DOS programs, without the traditional restrictions.


10. All this seems complicated -- will my program slow down?

It can, but it's more likely to speed up. Most computers can switch between real and protected modes 20,000 to 50,000 times per second. If your program consists of nothing but calls on DOS, it can slow down. In addition, protected mode causes some instructions to execute more slowly, particularly on 386 and 486 CPUs.

However, the additional memory that your program can address in protected mode can allow your program to run faster. In particular, you can stop using overlays and use much bigger buffers. Almost all commercial programs built with DOS/16M run faster than their real-mode versions, sometimes dramatically so.


11. Can I use my existing 16-bit compiler?

Probably.

The exact compilers supported are listed in the release notes. Microsoft, Borland and the other major vendors are all supported.


[Index of FAQ] * [Next Section]
Last modified 2003.02.07. Your questions, comments, and feedback are welcome.