DOS/4G

Tenberry Home

Consulting Services

Order DOS/4G

DOS/4G FAQ

Release Notes

DPMI Spec

* * *

DOS/4GW

DOS/4GW Pro

DOS/4G
for Watcom

DOS/16M

DOS/4G and DOS/4GW FAQ:
What are DOS/4G and DOS/4GW?


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

1. What are DOS/4G and DOS/4GW?

DOS/4G is Tenberry's 32-bit DOS extender.

DOS/4GW is a subset of DOS/4G that is specific to and bundled with the Watcom C/C++ and Fortran compilers.

Because DOS/4GW is a subset of DOS/4G, most of the answers in this part of the FAQ apply to both. To shorten this FAQ and to make it clearer, we will use DOS/4G(W) when what we are saying applies to both DOS/4G and DOS/4GW.


2. Is DOS/4G(W) a replacement for DOS?

No. DOS/4G(W) 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/4G(W) is called a DOS extender.


3. 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.


4. 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/4G(W).


5. 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.


6. How Does a DOS Extender Work?

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


7. What happens when my program makes a DOS request -- does DOS/4G(W) 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/4G(W) handles the interrupt, switches to real mode, and then resignals the same interrupt to DOS. It looks to DOS like the DOS/4G(W) program made the request. After DOS is finished processing the request, it returns to DOS/4G(W). DOS/4G(W) then switches to protected mode, and returns to your program the results that DOS returned to DOS/4G(W).

To your program, DOS/4G(W) serves as a surrogate for DOS, as though DOS could operate in protected mode.

To DOS, DOS/4G(W) serves as a surrogate for your program, as though your program were operating in real mode.


8. 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.


9. How about TSR or device driver calls?

Essentially, they are handled in a similar manner. However, because DOS/4G(W) can't be coded for every special-purpose device and interrupt call, the buffer copying that DOS/4G(W) 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.


10. 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.


11. 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/4G(W) run faster than their real-mode versions, sometimes dramatically so.


12. Can I use my existing 32-bit compiler?

Currently, only if it is a Watcom compiler, or derived from a Watcom compiler.


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