The fields
The header is 28 bytes, big-endian. Its first word is a BRA.S that jumps over the header to the first instruction of the text, so the file could in principle be run as it is.
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | word | Branch | $601A: the magic. A program whose first word is anything else is not a GEMDOS executable. |
| 2 | long | Text size | The length of the text segment (the code). |
| 6 | long | Data size | The length of the data segment, which follows the text. |
| 10 | long | BSS size | The length of the BSS: zeroed memory the loader adds after the data. It is not in the file. |
| 14 | long | Symbol table size | The length of the symbol table, 0 if there is none. |
| 18 | long | Reserved | Should be 0; Pure C needs it to be 0. |
| 22 | long | Program flags | See below. |
| 26 | word | ABSFLAG | 0 means a relocation table follows the symbols. No other value is defined by the source read. |
The file then holds the text, the data, the symbol table and the relocation table, in that order; the sizes in the header give the length of each. The tests the explorer uses to
recognise a program: the first word is $601A, the text and data are not both empty, the header, text, data and symbol table fit in the file, and when ABSFLAG is 0 the
file has either nothing or at least four bytes after the symbol table for the relocation table.
Program flags
| Bits | Meaning |
|---|---|
| 0 | Fastload: the stack is not cleared, only the BSS is initialised. |
| 1 | The program may be loaded into the faster alternate RAM (TT-RAM). |
| 2 | Malloc may allocate from alternate RAM. |
| 3 | Reserved (used for the shared library). |
| 4 to 7 | Memory protection: 0 private (only the process and the system may use the memory), 1 global (unprotected), 2 super (accessible to processes in supervisor mode), 3 read-only (anyone may read; only the owner and the system may write). |
| 8 to 11 | Reserved. |
| 12 | Shared text: the text segment may be shared. Only for a program that makes no absolute accesses to its data or BSS. |
| 13 to 27 | Reserved. |
| 28 to 31 | The most alternate RAM the program may use, in steps of 128 KB (sixteen values, 128 KB to 2 MB). The explorer shows the value as (bits + 1) × 128 KB. |
The source calls bit 1 “alternate RAM”, not TT-RAM by name; on a TT and Falcon that is the faster memory outside the ST’s 14 MB.
Not described
Known, not yet covered
- Reference: the field and flag tables were compared with the raw text of the FreeMiNT TOS documentation (
gemdos_programs.html, 2026-11-14) and agree in every field and bit. The MiNT extended header is not decoded by the explorer. From the comment and structure inprg-mint.c(raw source): the GNU linker writes a 256-byte header whose first 28 bytes are the header above, with the long at offset 18 holdingMiNT($4D694E54, the source calls itg_extmagic; it is the reserved long above) and the flags at 22; then an 8-byte jump to the entry (offset 28), a standard a.out header at 36 (e_info, text, data, bss, symbols, entry, text and data relocation sizes: eight longs), the file position and size of a TPA-relative relocation table (68, 72), the position of a hard-coded stack size (76), the symbol format (80) and 172 zero bytes. The alternate RAM limit’s exact units on each machine are not described. - Viewer: every field is shown with its decoded meaning; the reserved bits are not flagged when they are set.
Links
Reference
- GEMDOS programs – FreeMiNT TOS documentation: the header and the flags
- prg-mint.c – BFD code for the MiNT program format: header and symbol constants