Skip to navigation

Elite on the BBC Micro and NES

List of all variables

[BBC Micro cassette version]

This index contains every variable that appears in the source code for the BBC Micro cassette version of Elite, grouped by category. A variable is defined as a labelled memory location that is used for storing data, and this list includes both variables that are defined in workspaces, and variables that are declared within the body of the source code.

Copy protection
---------------

Authors' namesThe authors' names and a copyright notice, buried in the code
Authors' names (Loader)The authors' names, buried in the code
BLOCK (Loader)Addresses for the obfuscated jumps that use RTS not JMP
CHECKbyt (Loader)Checksum for the validity of the UU% workspace
checksum0Checksum for the entire main game code
CHECKV (Loader)The address of the LBL routine in the decryption header
David23 (Loader)Address pointer to the start of the 6502 stack
David9 (Loader)Address used as part of the stack-based decryption loop
FOOLV (Loader)Part of the AFOOL roundabout obfuscation routine
MAINSUM (Loader)Two checksums for the decryption header and text token table
MHCA (Loader)Used to set one of the vectors in the copy protection code

Dashboard
---------

ECBTThe character bitmap for the E.C.M. indicator bulb
SPBTThe bitmap definition for the space station indicator bulb

Drawing lines
-------------

TWFLReady-made character rows for the left end of a horizontal line in mode 4
TWFRReady-made character rows for the right end of a horizontal line in mode 4

Drawing pixels
--------------

CTWOSReady-made single-pixel character row bytes for mode 5
TWOSReady-made single-pixel character row bytes for mode 4
TWOS (Loader)Ready-made single-pixel character row bytes for mode 4
TWOS2Ready-made double-pixel character row bytes for mode 4

Drawing planets
---------------

CNT (Loader)A counter for use in drawing Saturn's planetary body
CNT2 (Loader)A counter for use in drawing Saturn's background stars
CNT3 (Loader)A counter for use in drawing Saturn's rings

Drawing ships
-------------

SHIP_ASTEROIDShip blueprint for an asteroid
SHIP_CANISTERShip blueprint for a cargo canister
SHIP_COBRA_MK_3Ship blueprint for a Cobra Mk III
SHIP_CORIOLISShip blueprint for a Coriolis space station
SHIP_ESCAPE_PODShip blueprint for an escape pod
SHIP_MAMBAShip blueprint for a Mamba
SHIP_MISSILEShip blueprint for a missile
SHIP_PYTHONShip blueprint for a Python
SHIP_SIDEWINDERShip blueprint for a Sidewinder
SHIP_THARGOIDShip blueprint for a Thargoid mothership
SHIP_THARGONShip blueprint for a Thargon
SHIP_VIPERShip blueprint for a Viper
XX21Ship blueprints lookup table

Drawing the screen
------------------

B% (Loader)VDU commands for setting the square mode 4 screen
block1 (Loader)Palette data for the two dashboard colour scheme
block2 (Loader)Palette data for the space part of the screen
TVT1Palette data for space and the two dashboard colour schemes
VECThe original value of the IRQ1 vector

Equipment
---------

PRXSEquipment prices

Keyboard
--------

KYTBLookup table for in-flight keyboard controls

Market
------

QQ23Market prices table

Maths (Geometry)
----------------

ACTArctan table
SNESine/cosine table

Save and load
-------------

CHKFirst checksum byte for the saved commander data file
CHK2Second checksum byte for the saved commander data file
NA%The data block for the last saved commander
SVNThe "saving in progress" flag

Sound
-----

E% (Loader)Sound envelope definitions
SFXSound data

Text
----

QQ16The two-letter token lookup table
QQ18The recursive token table for tokens 0-148
RLINEThe OSWORD configuration block used to fetch a line of text from the keyboard
TENSA constant used when printing large numbers in BPRNT
XC (Loader)The x-coordinate of the text cursor
YC (Loader)The y-coordinate of the text cursor

Universe
--------

UNIVTable of pointers to the local universe's ship data blocks

Utility routines
----------------

M2 (Loader)Used for testing the 6522 System VIA status byte in IRQ1
MESS1 (Loader)Contains an OS command string for loading the main game code
oscliv (Loader)Contains the address of OSCLIV, for executing OS commands

Workspace variables
-------------------

ALP1 Magnitude of the roll angle alpha, i.e. |alpha|, which is a positive value between 0 and 31
ALP2 Bit 7 of ALP2 = sign of the roll angle in ALPHA
ALPHA The current roll angle alpha, which is reduced from JSTX to a sign-magnitude value between -31 and +31
ALTIT Our altitude above the surface of the planet or sun
ASH Aft shield status
AVL Market availability in the current system
BET1 The magnitude of the pitch angle beta, i.e. |beta|, which is a positive value between 0 and 8
BET2 Bit 7 of BET2 = sign of the pitch angle in BETA
BETA The current pitch angle beta, which is reduced from JSTY to a sign-magnitude value between -8 and +8
BLCNT (Loader) Stores the tape loader block count as part of the copy protection code in IRQ1
BLN (Loader) Gets set to &03C6 as part of the obfuscation code
BLPTR (Loader) Gets set to &03CA as part of the obfuscation code
BOMB Energy bomb
BST Fuel scoops (BST stands for "barrel status")
CABTMP Cabin temperature
CASH Our current cash pot
CNT Temporary storage, typically used for storing the number of iterations required when looping
CNT2 Temporary storage, used in the planet-drawing routine to store the segment number where the arc of a partial circle should start
COK Flags used to generate the competition code
COL Temporary storage, used to store colour information when drawing pixels in the dashboard
COMC The colour of the dot on the compass
COMX The x-coordinate of the compass dot
COMY The y-coordinate of the compass dot
CRGO Our ship's cargo capacity
DAMP Keyboard damping configuration setting
de Equipment destruction flag
DELT4 Our current speed * 64 as a 16-bit value
DELTA Our current speed, in the range 1-40
DJD Keyboard auto-recentre configuration setting
DKCMP Docking computer
DL Vertical sync flag
DLY In-flight message delay
DNOIZ Sound on/off configuration setting
ECM E.C.M. system
ECMA The E.C.M. countdown timer, which determines whether an E.C.M. system is currently operating:
ECMP Our E.C.M. status
ENERGY Energy bank status
ENGY Energy unit
ESCP Escape pod
EV The "extra vessels" spawning counter
EXCN (Loader) Gets set to &03C2 as part of the obfuscation code
FIST Our legal status (FIST stands for "fugitive/innocent status"):
FLAG A flag that's used to define whether this is the first call to the ball line routine in BLINE, so it knows whether to wait for the second call before storing segment data in the ball line heap
FLH Flashing console bars configuration setting
FRIN Slots for the ships in the local bubble of universe
FSH Forward shield status
GCNT The number of the current galaxy (0-7)
GHYP Galactic hyperdrive
GNTMP Laser temperature (or "gun temperature")
gov The current system's government type (0-7)
HFX A flag that toggles the hyperspace colour effect
INF Temporary storage, typically used for storing the address of a ship's data block, so it can be copied to and from the internal workspace at INWK
INWK The zero-page internal workspace for the current ship data block
JSTE Reverse both joystick channels configuration setting
JSTGY Reverse joystick Y-channel configuration setting
JSTK Keyboard or joystick configuration setting
JSTX Our current roll rate
JSTY Our current pitch rate
K Temporary storage, used in a number of places
K2 Temporary storage, used in a number of places
K3 Temporary storage, used in a number of places
K3 (Loader) Temporary storage, used in a number of places
K4 Temporary storage, used in a number of places
K5 Temporary storage used to store segment coordinates across successive calls to BLINE, the ball line routine
K6 Temporary storage, typically used for storing coordinates during vector calculations
KL The following bytes implement a key logger that enables Elite to scan for concurrent key presses of the primary flight keys, plus a secondary flight key
KY1 "?" is being pressed
KY12 TAB is being pressed
KY13 ESCAPE is being pressed
KY14 "T" is being pressed
KY15 "U" is being pressed
KY16 "M" is being pressed
KY17 "E" is being pressed
KY18 "J" is being pressed
KY19 "C" is being pressed
KY2 Space is being pressed
KY3 "<" is being pressed
KY4 ">" is being pressed
KY5 "X" is being pressed
KY6 "S" is being pressed
KY7 "A" is being pressed
LAS Contains the laser power of the laser fitted to the current space view (or 0 if there is no laser fitted to the current view)
LAS2 Laser power for the current laser
LASCT The laser pulse count for the current laser
LASER The specifications of the lasers fitted to each of the four space views:
LASX The x-coordinate of the tip of the laser line
LASY The y-coordinate of the tip of the laser line
LSO The ship line heap for the space station (see NWSPS) and the sun line heap (see SUN)
LSP The ball line heap pointer, which contains the number of the first free byte after the end of the LSX2 and LSY2 heaps (see the deep dive on "The ball line heap" for details)
LSX LSX is an alias that points to the first byte of the sun line heap at LSO
LSX2 The ball line heap for storing x-coordinates (see the deep dive on "The ball line heap" for details)
LSY2 The ball line heap for storing y-coordinates (see the deep dive on "The ball line heap" for details)
MANY The number of ships of each type in the local bubble of universe
MCH The text token number of the in-flight message that is currently being shown, and which will be removed by the me2 routine when the counter in DLY reaches zero
MCNT The main loop counter
MJ Are we in witchspace (i.e. have we mis-jumped)?
MSAR The targeting state of our leftmost missile
MSTG The current missile lock target
NOMSL The number of missiles we have fitted (0-4)
NOSTM The number of stardust particles shown on screen, which is 18 (#NOST) for normal space, and 3 for witchspace
P Temporary storage, used in a number of places
P (Loader) Temporary storage, used in a number of places
PATG Configuration setting to show the author names on the start-up screen and enable manual hyperspace mis-jumps
Q Temporary storage, used in a number of places
Q (Loader) Temporary storage, used in a number of places
QQ0 The current system's galactic x-coordinate (0-256)
QQ1 The current system's galactic y-coordinate (0-256)
QQ10 The galactic y-coordinate of the crosshairs in the galaxy chart (and, most of the time, the selected system's galactic y-coordinate)
QQ11 The type of the current view:
QQ12 Our "docked" status
QQ14 Our current fuel level (0-70)
QQ15 The three 16-bit seeds for the selected system, i.e. the one in the crosshairs in the Short-range Chart
QQ17 Contains a number of flags that affect how text tokens are printed, particularly capitalisation:
QQ19 Temporary storage, used in a number of places
QQ2 The three 16-bit seeds for the current system, i.e. the one we are currently in
QQ20 The contents of our cargo hold
QQ21 The three 16-bit seeds for the current galaxy
QQ22 The two hyperspace countdown counters
QQ24 Temporary storage, used to store the current market item's price in routine TT151
QQ25 Temporary storage, used to store the current market item's availability in routine TT151
QQ26 A random value used to randomise market data
QQ28 The current system's economy (0-7)
QQ29 Temporary storage, used in a number of places
QQ3 The selected system's economy (0-7)
QQ4 The selected system's government (0-7)
QQ5 The selected system's tech level (0-14)
QQ6 The selected system's population in billions * 10 (1-71), so the maximum population is 7.1 billion
QQ7 The selected system's productivity in M CR (96-62480)
QQ8 The distance from the current system to the selected system in light years * 10, stored as a 16-bit number
QQ9 The galactic x-coordinate of the crosshairs in the galaxy chart (and, most of the time, the selected system's galactic x-coordinate)
R Temporary storage, used in a number of places
RAND Four 8-bit seeds for the random number generation system implemented in the DORND routine
RAT Used to store different signs depending on the current space view, for use in calculating stardust movement
RAT2 Temporary storage, used to store the pitch and roll signs when moving objects and stardust
S Temporary storage, used in a number of places
SC Screen address (low byte)
SC (Loader) Screen address (low byte)
SCH Screen address (high byte)
SCH (Loader) Screen address (high byte)
SLSP The address of the bottom of the ship line heap
SSPR "Space station present" flag
STP The step size for drawing circles
SUNX The 16-bit x-coordinate of the vertical centre axis of the sun (which might be off-screen)
SVC The save count
SWAP Temporary storage, used to store a flag that records whether or not we had to swap a line's start and end coordinates around when clipping the line in routine LL145 (the flag is used in places like BLINE to swap them back)
SX This is where we store the x_hi coordinates for all the stardust particles
SXL This is where we store the x_lo coordinates for all the stardust particles
SY This is where we store the y_hi coordinates for all the stardust particles
SYL This is where we store the y_lo coordinates for all the stardust particles
SZ This is where we store the z_hi coordinates for all the stardust particles
SZL This is where we store the z_lo coordinates for all the stardust particles
T Temporary storage, used in a number of places
T (Loader) Temporary storage, used in a number of places
T1 Temporary storage, used in a number of places
TALLY Our combat rank
tek The current system's tech level (0-14)
TGT Temporary storage, typically used as a target value for counters when drawing explosion clouds and partial circles
TP The current mission status, which is always 0 for the cassette version of Elite as there are no missions
TRTB% Contains the address of the keyboard translation table, which is used to translate internal key numbers to ASCII
TRTB% (Loader) Contains the address of the keyboard translation table, which is used to translate internal key numbers to ASCII
TYPE The current ship type
U Temporary storage, used in a number of places
V Temporary storage, typically used for storing an address pointer
V219 (Loader) Gets set to &0218 as part of the obfuscation code
VIEW The number of the current space view
X1 Temporary storage, typically used for x-coordinates in line-drawing routines
X2 Temporary storage, typically used for x-coordinates in line-drawing routines
XC The x-coordinate of the text cursor (i.e. the text column), which can be from 0 to 32
XSAV Temporary storage for saving the value of the X register, used in a number of places
XSAV2 Temporary storage, used for storing the value of the X register in the TT26 routine
XX Temporary storage, typically used for storing a 16-bit x-coordinate
XX0 Temporary storage, used to store the address of a ship blueprint. For example, it is used when we add a new ship to the local bubble in routine NWSHP, and it contains the address of the current ship's blueprint as we loop through all the nearby ships in the main flight loop
XX1 This is an alias for INWK that is used in the main ship-drawing routine at LL9
XX12 Temporary storage for a block of values, used in a number of places
XX13 Temporary storage, typically used in the line-drawing routines
XX14 This byte appears to be unused
XX15 Temporary storage, typically used for storing screen coordinates in line-drawing routines
XX16 Temporary storage for a block of values, used in a number of places
XX17 Temporary storage, used in BPRNT to store the number of characters to print, and as the edge counter in the main ship-drawing routine
XX18 Temporary storage used to store coordinates in the LL9 ship-drawing routine
XX19 XX19(1 0) shares its location with INWK(34 33), which contains the address of the ship line heap
XX2 Temporary storage, used to store the visibility of the ship's faces during the ship-drawing routine at LL9
XX20 Temporary storage, used in a number of places
XX24 This byte appears to be unused
XX4 Temporary storage, used in a number of places
Y1 Temporary storage, typically used for y-coordinates in line-drawing routines
Y2 Temporary storage, typically used for y-coordinates in line-drawing routines
YC The y-coordinate of the text cursor (i.e. the text row), which can be from 0 to 23
YSAV Temporary storage for saving the value of the Y register, used in a number of places
YSAV2 Temporary storage, used for storing the value of the Y register in the TT26 routine
YY Temporary storage, typically used for storing a 16-bit y-coordinate
YY (Loader) Temporary storage, used in a number of places
ZZ Temporary storage, typically used for distance values