Introduction
PC Elite, the version of Elite that Firebird published for the IBM PC in 1987, saves
each commander as a .CDR file. Andy Onions wrote it for Real Time Software.
The file is 208 bytes long. It holds the commander’s name, credits, rating and legal
status, the ship’s fuel, equipment and lasers, the cargo, the present and the chosen
system, and the state of the game’s three missions.
The format was never published. These pages describe it from the program itself:
every instruction in ELITE.EXE (74,560 bytes) that reads or writes the
commander was followed, and the result checked against 17 real commander files. Every
byte of the file is described.
The extension is also CorelDRAW’s. A .cdr file dropped on any page opens
in the explorer, which tells a commander file from a CorelDRAW drawing by what is
inside it and shows every field.
Which Elite
Elite was written for many computers, and each version saves its commanders in its own way. Only PC Elite’s file is described here.
| Version | Commander file | Here |
|---|---|---|
| PC Elite (Firebird, 1987) | .CDR, 208 bytes | Described in full |
| Elite Plus (PC, 1991) | .CDR, a different layout with a checksum | Not covered |
| BBC Micro, Acorn Electron, BBC Master, Commodore 64, Apple II | A file named after the commander, with no extension | Not covered |
| NES, Archimedes, Amiga, Atari ST | Each its own layout | Not covered |
| Elite: The New Kind, Oolite | .nkc and .oolite-save files | Not covered |
The 6502 versions’ commander file is described byte by byte on Mark Moxon’s site (see Links). PC Elite’s file is quite different: it is not a translation of that one.
Structure
The file is the program’s commander block, written from memory in one piece and read
back the same way. Numbers are little-endian. The block starts with text, so that
TYPE in DOS shows “Commander file” and stops at the end-of-file mark.
0x00Header “Commander file”, the status screen’s title and the credits as text480x30Galaxy and charts random number state, galaxy, position and chart cursors160x40Present system name, number, government, economy, tech level and more250x59Hyperspace system the system chosen for the next jump, in the same layout250x72Description seeds of the hyperspace system40x76Ship fuel, missiles, equipment and the laser on each mount180x88Commander credits, legal status, kills and name150x97Cargo and market 17 goods held and on sale, refugees, space used360xBBMissions and flags the three missions, witch space and the fuel leak21
There is no checksum. Instead, the program asks DOS for the file’s attributes before loading it and refuses it unless they are all clear, and it clears them itself after saving. Copying or editing a file sets its archive attribute, so such a file is refused until the attribute is cleared.
Telling it apart
A commander file starts with the 14 characters Commander file and the byte
1A, and is exactly 208 bytes long. CorelDRAW files start with
RIFF, WL or, from CorelDRAW X4, PK (a ZIP
package). The explorer’s reader also checks the title, the credits text and the range
of each value, so a damaged or edited commander file is shown with its problems
marked.
Also used for
- CorelDRAW drawing – CorelDRAW's working file: RIFF chunks in older versions, a ZIP archive since X4.
Links
Software
- PC Elite – Firebird’s Elite for the IBM PC, 1987, which writes and reads these files (MS-DOS)
Reference
- Commander save files – Mark Moxon’s byte-by-byte description of the 6502 versions’ commander file, for comparison
- PC Elite – Frontier Astro’s page on the PC version, its missions and how it differs