Welcome to the fully documented source code for the classic space game Elite on the BBC Micro and Acorn Electron. Here's a quick summary of what you'll find on this site, whether you're looking to read about Elite and how it works, or you're just keen to get stuck into the source code.
Finding out how Elite works
- Read the about this project page for an introduction to this site.
- Read some of the deep dive articles to discover how Elite works under the hood. The following selection is a good place to start:
- Check out the index of all deep dive articles to continue exploring.
Exploring the source code
- See the map of the source code for an overview of the program structure for the BBC Micro cassette version. You can dive straight into the source code from here - just click on the routine names and away you go.
- Read the notes on terminology used in this commentary, as without this it might be a bit tricky to follow the comments (in particular, you should understand the terminology I use for multi-byte numbers).
- You can explore the source code in two different ways. The easiest way is with each routine shown individually, which is what you'll see if you click the links from the map of the source code. These pages are small and easy to navigate in a browser. For example, the main game code starts at routine TT170, while the 3D scanner code is in SCAN.
- The other way is to explore the original source code file structure, as shown in the map of the source code. The original source files are pretty big and can be a bit unwieldy, but they do show the routines in their original context. For example, the source code for the BBC Micro cassette version splits into the following files:
- The Loader, which displays the loading screen, implements the copy protection and sets things up for the main game
- The main game source, which consists of Workspaces, Text tokens, Elite A, Elite B, Elite C, Elite D, Elite E, Elite F, Elite G and Ship blueprints
- The Big Code File, which concatenates the files produced by the above and adds a bit more copy protection
- You can see more information on a routine by using the "Show more" link. Amongst other things, this is where you can switch between the two ways of looking at the code. For example, here is TT170 shown on its own page, and here's the same routine in context as part of the Elite F source file.
- When viewing the source code, you can click on variable and routine names to see more information in a popup. The source code also has syntax highlighting.
- If you're interested in comparing the code for the different versions of Elite, you can find out how to do this in the section on how to compare the different versions of Elite.
- Important routines are flagged with a "*" in the site menu.
- The entry point for the main game code is routine TT170. If you want to follow the program flow all the way from the title screen around the main game loop, then there's a deep dive on program flow of the main game loop that has you covered.
Finding your way around
- There is a whole section of the site dedicated to indexes and analyses, to help you find what you are looking for. Look in the site menu for the "Indexes to the source code" section for details.
- There are loads of subroutines in Elite - literally hundreds. You can find them all listed and linked in the indexes for each individual version; for example, the BBC Micro cassette version has indexes of subroutines, variables, workspaces and macros.
- Each version also has an A-Z index of the whole source, which lists every single label across all the source files, a well as source code statistics, and an index of cross-references to help you find what you're looking for.
- The above links are for the BBC Micro cassette version, which is probably the best place to start. For the more adventurous, the site menu contains indexes to the more complex BBC Micro disc, 6502 Second Processor, BBC Master and Elite-A versions, as well as the simpler Electron version.
- There is also a complete index of the entire codebase, showing which parts of the code are used in which versions. This comes in three parts: shared code with variations, shared code without variations and version-specific code.
- The index section also contains statistics for each of the versions. For example, here are the statistics for the BBC Micro cassette version. Statistics for the other versions can be found in the same section.
Other helpful hints
- If you want to build the source on a modern computer, then check out the page on building Elite from the source.
- The source code is designed to be read at an 80-column width and with a monospaced font, just like in the good old days. If you're viewing this on a phone, you may find it easier to view the source code pages in landscape.
- You can change the site's colour scheme by clicking the theme icons in the top-right corner. The dark themes are inspired by the colour schemes used in the BBC Micro Model B and 6502 Second Processor versions of the game, but with a modern, IDE-like twist.
I hope you enjoy exploring the inner workings of Elite as much as I have.