A description of each and every byte in the saved commander file
Elite maintains two separate copies of your commander's status in memory. The current commander data block in the T% workspace gets updated every time you do something in game, so when you finally destroy that pesky pirate that's been hounding you for ages, your combat rating in TALLY gets increased, and your bounty gets paid into your cash pot in CASH. If you die, however, you lose all this progress, which is why you should save your game regularly. Saving your game not only writes to cassette or disc, but it also copies all the commander data to the last saved commander data block at NA%, so if you die, the game can reload the commander data from this point.
To save a commander file, Elite simply saves the block of memory between NA%+8 and CHK (the first 8 bytes of NA% contain the commander name and a carriage return, which isn't saved as part of the file, but is used as the filename). Before doing the save, it calculates two checksums and puts them in CHK and CHK2, to make it harder to for crackers to manipulate commander files manually, and then it just saves out that clock of memory. Let's take a look at the format of this saved file.
The save file format
--------------------
Each commander file is exactly 256 bytes long, though only the first 75 (&4B) bytes contain any data (the rest are zeroed out). Those 75 bytes are shown in the table below, along with links to the relevant variables in the current commander data block, and the corresponding value in the default JAMESON commander from when you start a brand new game.
Note that the NES version of Elite has a slightly different file structure to the following and encrypts its save files differently; see the NA2% variable for the file structure, and the SaveLoadCommander routine for the encryption.
Byte # | In hex | Variable | Description | Default |
---|---|---|---|---|
#1 | &01 | QQ0 | Current system X-coordinate (Lave) | 20 |
#2 | &02 | QQ1 | Current system Y-coordinate (Lave) | 173 |
#3-4 | &03-&04 | QQ21 | Seed s0 for system 0, galaxy 0 (Tibedied) | &5A4A |
#5-6 | &05-&06 | QQ21+2 | Seed s1 for system 0, galaxy 0 (Tibedied) | &0248 |
#7-8 | &07-&08 | QQ21+4 | Seed s2 for system 0, galaxy 0 (Tibedied) | &B753 |
#9-12 | &09-&0C | CASH | Amount of cash (100 Cr) | &E8030000 |
#13 | &0D | QQ14 | Fuel level | 70 |
#14 | &0E | COK | Competition flags | 0 |
#15 | &0F | GCNT | Galaxy number, 0-7 | 0 |
#16 | &10 | LASER | Front laser | POW |
#17 | &11 | LASER+1 | Rear laser | 0 |
#18 | &12 | LASER+2 | Left laser | 0 |
#19 | &13 | LASER+3 | Right laser | 0 |
#20-21 | &14-&15 | These two bytes are unused (they were originally used for up/down lasers, but they were dropped) | 0 | |
#22 | &16 | CRGO | Cargo capacity | 22 |
#23 | &17 | QQ20+0 | Amount of Food in cargo hold | 0 |
#24 | &18 | QQ20+1 | Amount of Textiles in cargo hold | 0 |
#25 | &19 | QQ20+2 | Amount of Radioactives in cargo hold | 0 |
#26 | &1A | QQ20+3 | Amount of Slaves in cargo hold | 0 |
#27 | &1B | QQ20+4 | Amount of Liquor/Wines in cargo hold | 0 |
#28 | &1C | QQ20+5 | Amount of Luxuries in cargo hold | 0 |
#29 | &1D | QQ20+6 | Amount of Narcotics in cargo hold | 0 |
#30 | &1E | QQ20+7 | Amount of Computers in cargo hold | 0 |
#31 | &1F | QQ20+8 | Amount of Machinery in cargo hold | 0 |
#32 | &20 | QQ20+9 | Amount of Alloys in cargo hold | 0 |
#33 | &21 | QQ20+10 | Amount of Firearms in cargo hold | 0 |
#34 | &22 | QQ20+11 | Amount of Furs in cargo hold | 0 |
#35 | &23 | QQ20+12 | Amount of Minerals in cargo hold | 0 |
#36 | &24 | QQ20+13 | Amount of Gold in cargo hold | 0 |
#37 | &25 | QQ20+14 | Amount of Platinum in cargo hold | 0 |
#38 | &26 | QQ20+15 | Amount of Gem-Stones in cargo hold | 0 |
#39 | &27 | QQ20+16 | Amount of Alien Items in cargo hold | 0 |
#40 | &28 | ECM | E.C.M. | 0 |
#41 | &29 | BST | Fuel scoops ("barrel status") | 0 |
#42 | &2A | BOMB | Energy bomb | 0 |
#43 | &2B | ENGY | Energy/shield level | 0 |
#44 | &2C | DKCMP | Docking computer | 0 |
#45 | &2D | GHYP | Galactic hyperdrive | 0 |
#46 | &2E | ESCP | Escape pod | 0 |
#47-50 | &2F-&32 | These four bytes are unused | 0 | |
#51 | &33 | NOMSL | Number of missiles | 3 |
#52 | &34 | FIST | Legal status ("fugitive/innocent status") | 0 |
#53 | &35 | AVL+0 | Market availability of Food | 16 |
#54 | &36 | AVL+1 | Market availability of Textiles | 15 |
#55 | &37 | AVL+2 | Market availability of Radioactives | 17 |
#56 | &38 | AVL+3 | Market availability of Slaves | 0 |
#57 | &39 | AVL+4 | Market availability of Liquor/Wines | 3 |
#58 | &3A | AVL+5 | Market availability of Luxuries | 28 |
#59 | &3B | AVL+6 | Market availability of Narcotics | 14 |
#60 | &3C | AVL+7 | Market availability of Computers | 0 |
#61 | &3D | AVL+8 | Market availability of Machinery | 0 |
#62 | &3E | AVL+9 | Market availability of Alloys | 10 |
#63 | &3F | AVL+10 | Market availability of Firearms | 0 |
#64 | &40 | AVL+11 | Market availability of Furs | 17 |
#65 | &41 | AVL+12 | Market availability of Minerals | 58 |
#66 | &42 | AVL+13 | Market availability of Gold | 7 |
#67 | &43 | AVL+14 | Market availability of Platinum | 9 |
#68 | &44 | AVL+15 | Market availability of Gem-Stones | 8 |
#69 | &45 | AVL+16 | Market availability of Alien Items | 0 |
#70 | &46 | QQ26 | Random byte that changes for each visit to a system, for randomising market prices | 0 |
#71-72 | &47-&48 | TALLY | Number of kills (low byte then high byte) | 0 |
#73 | &49 | SVC | Save count | 128 |
#74 | &4A | CHK2 | Secondary checksum | &AA |
#75 | &4B | CHK | Primary checksum | &03 |
There are various programs from back in the day that let you edit your commander save file; the only complicated part is calculating the CHK checksum, which is done by the CHECK routine. You can also find this same algorithm implemented in Python in the elite-checksum.py script, as part of the build process (see the page on Building Elite from the source for more details).