What kind of tool was 'DOS / 4GW' that supported game functions and compatibility from MS-DOS to Windows 95?



If you played MS-DOS games in the 1990s, you should have seen the 'DOS/4GW' banner at least once. Experts with detailed knowledge explain on blogs what tools DOS/4GW did and how they functioned.

Pikuma: DOS/4GW and Protected Mode

https://pikuma.com/blog/what-is-dos4gw-protected-mode



The popularity of DOS/4GW made Windows 95 game compatibility a little easier, but with higher stakes - The Old New Thing
https://devblogs.microsoft.com/oldnewthing/20230829-00/?p=108661


When the first IBM PC was released in 1981, the CPU installed was Intel 8088. The Intel 8088 had an 8-bit external data bus and only 1024KB of memory address space. Furthermore, even if 1024KB of memory was installed, 384KB was reserved for display buffers, expansion functions, BIOS, ROM, etc., and only the lower 640KB could be used by applications. There is a legend that at a computer exhibition held in 1981, Microsoft founder Bill Gates said, ``640KB is enough for everyone!'' Later, Bill Gates said, ``I never said that. No,” he denies.



Since DOS allowed direct access to hardware, applications could specify addresses from 0xA0000 to 0x00000 and directly rewrite numerical values. For example, by directly rewriting the value 0xA0000, I was able to change the color of the pixel at the top left of the screen.



This method is called 'real mode' because the memory address visible to the program matches the actual memory address. Due to the specifications, memory protection features, multithreading, and simultaneous execution of multiple processes were not supported.

Intel, which achieved success with the 8088, released a 16-bit CPU called Intel 80286 in 1982, and 32-bit Intel 80386 in 1985. The upper limit on the amount of memory that can be used has been expanded to 16MB for 16bit CPUs and 4GB for 32bit CPUs. Intel equipped the CPU with two modes to access the increased memory space while maintaining compatibility with the 8088. One is 'real mode' like the 8088, and the other is 'protected mode.' To maintain compatibility, Intel has set the CPU so that when it is powered on, it first boots up in real mode and can transition to protected mode depending on the situation.

Protected mode enables many features such as virtual memory, paging, secure multitasking, and access to over 1MB of expanded memory space. However, MS-DOS is not a multitasking OS and does not have a multithreading function, so it was not able to utilize the functions of protected mode. Therefore, applications that wanted to use protected mode functionality had to prepare the necessary kernel tools and transition to protected mode after startup.

'DOS extender' was created to solve these problems. A DOS extender is just a small OS kernel tool that provides some basic services such as multitasking, memory management, memory protection, basic network support, etc. DOS extenders allow programmers to easily implement protected mode functionality. Now available.



The most popular DOS extender was 'DOS/4GW'. By starting DOS/4GW and shifting from real mode to protected mode before the application itself starts, programs for MS-DOS can be written as if they were programs for 32-bit OS. It is said that it became

As time progressed and Windows 95 was introduced, an OS that boots in protected mode from the beginning, applications could no longer take over control of the entire system. These multitasking OSes have introduced DPMI (DOS Protected Mode Interface) , and MS-DOS applications can be started in protected mode through DPMI.

DOS/4GW and DPMI have some functional conflicts, but DOS/4GW has responded by separating its functions into two: server and client. DOS/4GW checks to see if a DPMI server already exists at startup, and installs itself as a DPMI server only if it does not. If a DPMI server already exists, only the client part of DOS/4GW functions, and it is a mechanism that mediates the interaction between the application and the DPMI server.



This mechanism has made it possible to significantly improve compatibility when running MS-DOS applications on multitasking OSes such as Windows 95. If a problem occurs with communication between the DOS/4GW client and the DPMI server, simply fixing that problem will fix the problem in the same way in many games. Although it was a high-risk, high-reward approach in that the scope of the impact would be large if it could not be fixed, it is said that most games worked normally.

in Software, Posted by log1d_ts