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.
The explorer also reads the commander file of the 6502 versions of Elite (the BBC Micro, Electron and Master, and Elite: The New Kind), which is a different 256-byte layout with checksums: see 6502 versions. It works the galaxy out from the seeds in that file and draws a chart of the 256 systems with the commander’s system marked (the galaxy generator).
Which Elite
Elite was written for many computers, and each version saves its commanders in its own way. The two layouts below are described and read.
| Version | Commander file | Here |
|---|---|---|
| PC Elite (Firebird, 1987) | .CDR, 208 bytes | Described in full |
| BBC Micro (cassette, disc), Acorn Electron, BBC Master, 6502 Second Processor | A file named after the commander, 256 bytes, two checksums | Described and read; with the galaxy generator |
| Elite: The New Kind (C rewrite) | The same 256 bytes as the BBC file (from its source code); no real file seen, so its extension is not confirmed | Read as the BBC layout |
| Elite Plus (PC, 1991) | .CDR, a different layout with a checksum | Not covered: no documentation found |
| Commodore 64, Apple II | As the BBC file with a third checksum | Not covered |
| NES, Archimedes, Amiga, Atari ST | Each its own layout (the NES file is encrypted) | Not covered |
| Frontier: Elite II, First Encounters | .SAV files | Not covered |
| Oolite | .oolite-save files (a property list) | Not covered |
PC Elite’s file is quite different from the 6502 one: it is not a translation of it.
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 6502 commander file has no signature: it is exactly 256 bytes long, and the byte at
75 is the game’s checksum of bytes 0 to 73 while the byte at 74 is that value EOR
A9 (the checksum), which
a file of any other kind passes by chance once in 65,536. A text file with the extension
is reported as not an Elite file.
A PC Elite 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.
Not described
Only two of Elite’s commander layouts are read. The PC Elite file was worked out from the program itself and checked against 17 real files. The 6502 file follows the commented sources of the BBC Micro and of Elite: The New Kind; no real 6502 commander file was found on this machine or on the sites that were searched, so the viewer was checked against files built from the sources, the checksum of the default commander (which the source states) and the first eight systems of the galaxy.
Known, not yet covered
- Reference and Viewer: the Commodore 64 and Apple II commander files (a
third checksum, CHK3, with its own routine), the NES file (encrypted, see the NA2% variable in Mark
Moxon’s source), Elite-A, the Archimedes, Amiga and Atari ST versions and Oolite’s property-list
.oolite-save. A file of these in a 6502-like size is shown only as bytes or rejected. - Viewer: the PC Elite file’s galaxy chart. The PC file keeps its seeds under another name and its systems are drawn from its own generator, which has not been checked against the 6502 one.
- Reference: bits 3, 4 and 6 of the 6502 competition flags, set by the Master and second-processor versions, whose source was not read; the disc version’s mission bits 4 to 7; the meaning of the unused bytes 20, 21 and 47 to 50.
Unknown
- Reference: Elite Plus’s
.CDRcommander file and Frontier: Elite II and First Encounters’.SAVfiles: no public documentation was found, and no file is on this machine to work them out from. - Reference: the file extension Elite: The New Kind uses; its source writes whatever name it is given.
- Viewer: a 6502 file whose checksum is wrong is shown only when its name ends in
.cdr, with the problem marked; a file with no extension is not recognised.
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
- Elite on the 6502 – Mark Moxon’s annotated source of the BBC Micro, Electron, Master, C64, Apple II and NES Elites
- Elite: The New Kind – the C source of the rewrite, whose file.c saves the 6502 layout
- PC Elite – Frontier Astro’s page on the PC version, its missions and how it differs