
PMODE

PMODE is a DOS extender used in several IBM PC compatible DOS applications in the mid and late 1990s. It was created by Thomas "Tran" Pytel, and the first version became publicly available in 1994. The original PMODE was written to be used with programs written in x86 assembler, specifically using Borland's TASM. It was later expanded for use as a drop-in replacement for DOS/4GW under the name PMODE/W.
PMODE was released with the source code included in the distribution archive, with the only restrictions on its use being that it could not be sold for profit, nor used as the kernel of an extender to be sold for profit. Older releases also requested that the original authors be credited in the product.
Originally the source code to PMODE/W was not made available to the public, although the extender could be used without restriction in free software, once again with a request that the authors were credited in the product. Commercial and shareware releases using PMODE/W required that a license be purchased. The cost at the time of PMODE/W v1.33's release (1996) was USD $500, although university students could purchase a license at the discounted price of US$100.
As of 2002, PMODE/W may be freely used in commercial software, provided the software is not itself a DOS extender.
Features.
Like other DOS extenders, PMODE is used in the creation of 32-bit DOS applications that run in the protected mode of the 386+ CPU as opposed to real mode, which is the native execution mode of the DOS operating system, and the only mode of operation supported by older x86 processors (e.g. the 8086). In particular, this facilitates straightforward access to memory above 1 MB (1024^2 bytes), which cannot be addressed in real mode without special hardware, such as expanded memory boards. (In the 80286 and later processors with the A20 line enabled, addresses allow a maximum address of 1114095 (65536*16+65520, 16 segments 64K each, plus an additional segment less one 16 bytes paragraph due to how segmented memory works beyond the first megabyte) to be specified in real mode; this extra space above 1 MB is known as the HMA, or High Memory Area.)
A major difference between PMODE and other popular extenders is its small footprint, making it feasible to embed the whole of PMODE to the DOS-extended executable, increasing its size by approximately 10 (binary) kilobytes, and compression (see executable compression) is supported for further reduction of the storage footprint (but not run-time memory requirement). PMODE is therefore often appropriate where size is an issue (which it usually was on old computer systems), but there is also the advantage of eliminating the external dependency on a separate(*) DOS extender (the presence of which certainly cannot be taken for granted - for instance in DOS-based "rescue disk" environments). (Most other extenders, such as DOS4G/W, require that a small real mode program (called a stub) was attached to the beginning of the protected mode executable; a stub that would locate and load the external DOS extender executable, such as DOS4GW.EXE).
PMODE implements a subset of the DOS Protected Mode Interface (DPMI) specification version 0.9, and certain extensions that are not part of the DPMI. When a DPMI host is already loaded at the time the PMODE DOS-extended executable is run, PMODE plays a somewhat more passive role, generally passing DPMI requests through to the original provider. However, unlike some other DOS extenders, PMODE does not require the presence of a memory manager, although it is compatible with both XMS (such as that of HIMEM.SYS) and VCPI (provided by Expanded Memory Managers, like EMM386.EXE or QEMM), and will make use of those services if available. The DPMI compatibility allows many PMODE programs to run while Windows is loaded, although in the Windows NT-based series of Windows (such as XP or Vista), DOS compatibility features are not as highly developed as in the 3.x/9x-series (including Windows Millennium).
The incomplete DPMI implementation and the lack of support for virtual memory (demand paging, swapping, etc.) are reasons why PMODE may not be a suitable for some applications. PMODE was entirely written in x86 assembly language, and early versions were not directly usable by programs written in high level languages (including C). The price of PMODE/W may have been a deterrent to some, although most other DOS extenders at the time commanded a comparable or higher price (such as the Phar Lap DOS extender).
The role of PMODE as sample code illustrating the practical application of advanced, widely available, but under-used features documented in Intel 80386 manuals also should not be underestimated, since for many developers, this may have outweighed any significance of PMODE as a DOS-extender.
Derived versions.
PMODE/W is a version of PMODE for the Watcom C/C++ compilers. It was developed by Charles "Daredevil" Scheffold and Thomas Pytel. Its footprint in the final executable file is slightly larger than that of the original PMODE because of the added functionality, but it is still less than 12 kilobytes according to its own documentation.
PMODE/DJ is a DOS extender derived from PMODE 3.07 by Matthias Grimrath for use with the DJGPP compilers. PMODE/DJ can also be used with Free Pascal.
Applications using PMODE.
PMODE was originally designed to be used with demoscene demos, and this was the area of application where it became extremely popular because of its performance and compactness. These features of PMODE also made it relevant for the developers of games and embedded systems.
PMODE/W is one of the four DOS extenders included in the Open Watcom compiler distribution. PMODE/W is also the default DOS extender used by TMT Pascal.