Skip to navigation

Commander save files

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.

The disk access menu in BBC Micro disc Elite

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 hexVariableDescriptionDefault
#1&01QQ0Current system X-coordinate (Lave)20
#2&02QQ1Current system Y-coordinate (Lave)173
#3-4&03-&04QQ21Seed s0 for system 0, galaxy 0 (Tibedied)&5A4A
#5-6&05-&06QQ21+2Seed s1 for system 0, galaxy 0 (Tibedied)&0248
#7-8&07-&08QQ21+4Seed s2 for system 0, galaxy 0 (Tibedied)&B753
#9-12&09-&0CCASHAmount of cash (100 Cr)&E8030000
#13&0DQQ14Fuel level70
#14&0ECOKCompetition flags0
#15&0FGCNTGalaxy number, 0-70
#16&10LASERFront laserPOW
#17&11LASER+1Rear laser0
#18&12LASER+2Left laser0
#19&13LASER+3Right laser0
#20-21&14-&15These two bytes are unused (they were originally used for up/down lasers, but they were dropped)0
#22&16CRGOCargo capacity22
#23&17QQ20+0Amount of Food in cargo hold0
#24&18QQ20+1Amount of Textiles in cargo hold0
#25&19QQ20+2Amount of Radioactives in cargo hold0
#26&1AQQ20+3Amount of Slaves in cargo hold0
#27&1BQQ20+4Amount of Liquor/Wines in cargo hold0
#28&1CQQ20+5Amount of Luxuries in cargo hold0
#29&1DQQ20+6Amount of Narcotics in cargo hold0
#30&1EQQ20+7Amount of Computers in cargo hold0
#31&1FQQ20+8Amount of Machinery in cargo hold0
#32&20QQ20+9Amount of Alloys in cargo hold0
#33&21QQ20+10Amount of Firearms in cargo hold0
#34&22QQ20+11Amount of Furs in cargo hold0
#35&23QQ20+12Amount of Minerals in cargo hold0
#36&24QQ20+13Amount of Gold in cargo hold0
#37&25QQ20+14Amount of Platinum in cargo hold0
#38&26QQ20+15Amount of Gem-Stones in cargo hold0
#39&27QQ20+16Amount of Alien Items in cargo hold0
#41&29BSTFuel scoops ("barrel status")0
#42&2ABOMBEnergy bomb0
#43&2BENGYEnergy/shield level0
#44&2CDKCMPDocking computer0
#45&2DGHYPGalactic hyperdrive0
#46&2EESCPEscape pod0
#47-50&2F-&32These four bytes are unused0
#51&33NOMSLNumber of missiles3
#52&34FISTLegal status ("fugitive/innocent status")0
#53&35AVL+0Market availability of Food16
#54&36AVL+1Market availability of Textiles15
#55&37AVL+2Market availability of Radioactives17
#56&38AVL+3Market availability of Slaves0
#57&39AVL+4Market availability of Liquor/Wines3
#58&3AAVL+5Market availability of Luxuries28
#59&3BAVL+6Market availability of Narcotics14
#60&3CAVL+7Market availability of Computers0
#61&3DAVL+8Market availability of Machinery0
#62&3EAVL+9Market availability of Alloys10
#63&3FAVL+10Market availability of Firearms0
#64&40AVL+11Market availability of Furs17
#65&41AVL+12Market availability of Minerals58
#66&42AVL+13Market availability of Gold7
#67&43AVL+14Market availability of Platinum9
#68&44AVL+15Market availability of Gem-Stones8
#69&45AVL+16Market availability of Alien Items0
#70&46QQ26Random byte that changes for each visit to a system, for randomising market prices0
#71-72&47-&48TALLYNumber of kills (low byte then high byte)0
#73&49SVCSave count128
#74&4ACHK2Secondary checksum&AA
#75&4BCHKPrimary 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 script, as part of the build process (see the page on Building Elite from the source for more details).