Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Phar Lap executables

From ReverseEngineering.wiki
Format
On this wiki Facts · Code · Notes · Topics

Executable formats of Phar Lap's DOS extenders (286|DOS-Extender, 386|DOS-Extender, TNT): simple 'MP' flat images, 'P3' extended-format files with a 128-byte header, run-time parameter blocks ('DX') and 'MQ' REX files, as defined in Open Watcom's exephar.h.

Signatures

Open Watcom's exesigns.h defines the two-byte signatures: 'MP' (0x504D, simple flat image), 'P3' (0x3350, extended format), 'DX' (0x5844, run-time parameter block), 'MQ' (0x514D, REX file of Phar Lap), 'P2' and 'P6' (listed without a comment), 'PL' (0x4C50, Phar Lap TNT) and 'BW' (0x5742, listed as DOS16M, Rational Systems' 16-bit extender; the 'bound' Watcom executables with a BW signature belong to this family). They appear where the extender's loader expects them: after an MZ stub or at the start of the file. Unverified: where each signature sits in a bound .EXE (check the MZ image size, then the bytes at the end of the DOS image).

Simple header (MP)

30 bytes: signature, bytes in last page, file size in 512-byte blocks, relocation count (always 0), header size in paragraphs, minimum and maximum data in 4 KB pages, 32-bit initial ESP, checksum, 32-bit initial EIP, relocation offset (always 0x1E), overlay number (0) and a word that is always 1.

Extended header (P3)

128 bytes, listed in Fact:Phar Lap executables/struct/P3 extended header: format level (1 flat, 2 segmented), header size, file size, checksum, then offset/size pairs for the run-time parameter block, relocations, segment information table, load image, symbols, GDT, LDT, IDT and TSS, minimum and maximum extra memory, entry registers and the flags (bit 0 = packed image).

Run-time parameter block

Signature 'DX', then minreal, maxreal, minibuf, maxibuf, nistack, istksize, realbreak, callbufs, extender flags and unpriv words; the segment information table entries are selector, flags, base, extra.

Code & repositories

  • https://github.com/open-watcom/open-watcom-v2 @ 96b007f094bb21c6108b2793706fa298da59fc5e · license: Watcom-1.0 (declared by the contributor; GitHub's detector did not recognize a license file)
    Open Watcom v2: bld/watcom/h/exephar.h, exesigns.h and exedos.h give the Phar Lap MP/P3/DX structures, the two-letter executable signatures (BW, P2, P3, PL, MQ...) and the DOS EXE header.
    Tested on: source read, not run: Read the three headers at this commit; nothing built or run. · checked 2026-10-19