Skip to navigation

BBC Micro Elite

Map of the source code

This page contains a map of all the routines, variables and macros in the original Elite source files, in the order in which they appear in the original source. The source files are structured like this:

You can click on the links above to jump to the relevant part of the map.

Loader
------

CategoryDetails

Loader

Subroutine: Elite loader (Part 1 of 6) (Loader)

Include binaries for recursive tokens, Python blueprint and images

Screen mode

Variable: B% (Loader)

VDU commands for setting the square mode 4 screen

Sound

Variable: E% (Loader)

Sound envelope definitions

Copy protection

Subroutine: swine (Loader)

Resets the machine if the copy protection detects a problem

Utility routines

Subroutine: OSB (Loader)

A convenience routine for calling OSBYTE with Y = 0

Copy protection

Variable: Authors' names (Loader)

The authors' names, buried in the code

Utility routines

Variable: oscliv (Loader)

Contains the address of OSCLIV, for executing OS commands

Copy protection

Variable: David9 (Loader)

Address used as part of the stack-based decryption loop

Copy protection

Variable: David23 (Loader)

Address pointer to the start of the 6502 stack

Copy protection

Subroutine: doPROT1 (Loader)

Routine to self-modify the loader code

Copy protection

Variable: MHCA (Loader)

Used to set one of the vectors in the copy protection code

Copy protection

Subroutine: David7 (Loader)

Part of the multi-jump obfuscation code in PROT1

Sound

Macro: FNE (Loader)

Macro definition for defining a sound envelope

Loader

Subroutine: Elite loader (Part 2 of 6) (Loader)

Perform a number of OS calls, set up sound, push routines on stack

Loader

Subroutine: Elite loader (Part 3 of 6) (Loader)

Move and decrypt recursive tokens, Python blueprint and images

Loader

Subroutine: Elite loader (Part 4 of 6) (Loader)

Copy more code onto stack, decrypt TUT block, set up IRQ1 handler

Drawing planets

Subroutine: PLL1 (Loader)

Draw Saturn on the loading screen

Utility routines

Subroutine: DORND (Loader)

Generate random numbers

Maths (Arithmetic)

Subroutine: SQUA2 (Loader)

Calculate (A P) = A * A

Drawing pixels

Subroutine: PIX (Loader)

Draw a single pixel at a specific coordinate

Drawing pixels

Variable: TWOS (Loader)

Ready-made single-pixel character row bytes for mode 4

Drawing planets

Variable: CNT (Loader)

A counter for use in drawing Saturn's planetary body

Drawing planets

Variable: CNT2 (Loader)

A counter for use in drawing Saturn's background stars

Drawing planets

Variable: CNT3 (Loader)

A counter for use in drawing Saturn's rings

Maths (Arithmetic)

Subroutine: ROOT (Loader)

Calculate ZP = SQRT(ZP(1 0))

Copy protection

Subroutine: BEGIN% (Loader)

Single-byte decryption and copying routine, run on the stack

Copy protection

Subroutine: DOMOVE (Loader)

Multi-byte decryption and copying routine, run on the stack

Workspaces

Workspace: UU% (Loader)

Marker for a block that is moved as part of the obfuscation

Copy protection

Variable: CHECKbyt (Loader)

Checksum for the validity of the UU% workspace

Copy protection

Variable: MAINSUM (Loader)

Two checksums for the decryption header and text token table

Copy protection

Variable: FOOLV (Loader)

Part of the AFOOL roundabout obfuscation routine

Copy protection

Variable: CHECKV (Loader)

The address of the LBL routine in the decryption header

Screen mode

Variable: block1 (Loader)

Palette data for the two dashboard colour scheme

Screen mode

Variable: block2 (Loader)

Palette data for the space part of the screen

Text

Subroutine: TT26 (Loader)

Print a character at the text cursor (WRCHV points here)

Utility routines

Subroutine: osprint (Loader)

Print a character

Utility routines

Subroutine: command (Loader)

Execute an OS command

Utility routines

Variable: MESS1 (Loader)

Contains an OS command string for loading the main game code

Loader

Subroutine: Elite loader (Part 5 of 6) (Loader)

Load main game code, decrypt it, move it to the correct location

Utility routines

Variable: M2 (Loader)

Used for testing the 6522 System VIA status byte in IRQ1

Screen mode

Subroutine: IRQ1 (Loader)

The loader's screen-mode interrupt handler (IRQ1V points here)

Copy protection

Variable: BLOCK (Loader)

Addresses for the obfuscated jumps that use RTS not JMP

Loader

Subroutine: Elite loader (Part 6 of 6) (Loader)

Set up interrupt vectors, calculate checksums, run main game code

Copy protection

Subroutine: CHECKER (Loader)

Run checksum checks on tokens, loader and tape block count

Text

Variable: XC (Loader)

The x-coordinate of the text cursor

Text

Variable: YC (Loader)

The y-coordinate of the text cursor

Workspaces
----------

CategoryDetails

Workspaces

Workspace: ZP

Lots of important variables are stored in the zero page workspace as it is quicker and more space-efficient to access memory here

Workspaces

Workspace: XX3

Temporary storage space for complex calculations

Workspaces

Workspace: T%

Current commander data and stardust data blocks

Text tokens
-----------

CategoryDetails

Text

Macro: CHAR

Macro definition for characters in the recursive token table

Text

Macro: TWOK

Macro definition for two-letter tokens in the token table

Text

Macro: CTRL

Macro definition for control codes in the recursive token table

Text

Macro: RTOK

Macro definition for recursive tokens in the recursive token table

Text

Variable: QQ18

Recursive token table for tokens 0-148

Workspaces
----------

CategoryDetails

Workspaces

Workspace: K%

Ship data blocks and ship line heaps

Workspaces

Workspace: WP

Ship slots, variables

Elite A
-------

CategoryDetails

Workspaces

Workspace: S%

Vector addresses, compass colour and configuration settings

Main loop

Subroutine: Main flight loop (Part 1 of 16)

Seed the random number generator

Main loop

Subroutine: Main flight loop (Part 2 of 16)

Calculate the alpha and beta angles from the current pitch and roll of our ship

Main loop

Subroutine: Main flight loop (Part 3 of 16)

Scan for flight keys and process the results

Main loop

Subroutine: Main flight loop (Part 4 of 16)

For each nearby ship: Copy the ship's data block from K% to the zero-page workspace at INWK

Main loop

Subroutine: Main flight loop (Part 5 of 16)

For each nearby ship: If an energy bomb has been set off, potentially kill this ship

Main loop

Subroutine: Main flight loop (Part 6 of 16)

For each nearby ship: Move the ship in space and copy the updated INWK data block back to K%

Main loop

Subroutine: Main flight loop (Part 7 of 16)

For each nearby ship: Check whether we are docking, scooping or colliding with it

Main loop

Subroutine: Main flight loop (Part 8 of 16)

For each nearby ship: Process us potentially scooping this item

Main loop

Subroutine: Main flight loop (Part 9 of 16)

For each nearby ship: If it is a space station, check whether we are successfully docking with it

Main loop

Subroutine: Main flight loop (Part 10 of 16)

For each nearby ship: Remove if scooped, or process collisions

Main loop

Subroutine: Main flight loop (Part 11 of 16)

For each nearby ship: Process missile lock and firing our laser

Main loop

Subroutine: Main flight loop (Part 12 of 16)

For each nearby ship: Draw the ship, remove if killed, loop back

Main loop

Subroutine: Main flight loop (Part 13 of 16)

Show energy bomb effect, charge shields and energy banks

Main loop

Subroutine: Main flight loop (Part 14 of 16)

Spawn a space station if we are close enough to the planet

Main loop

Subroutine: Main flight loop (Part 15 of 16)

Perform altitude checks with planet and sun, process fuel scooping

Main loop

Subroutine: Main flight loop (Part 16 of 16)

Process laser pulsing, E.C.M. energy drain, call stardust routine

Maths (Geometry)

Subroutine: MAS1

Add an orientation vector coordinate to an INWK coordinate

Maths (Geometry)

Subroutine: MAS2

Calculate a cap on the maximum distance to the planet or sun

Maths (Arithmetic)

Subroutine: MAS3

Calculate A = x_hi^2 + y_hi^2 + z_hi^2 in the K% block

Moving

Subroutine: MVEIT (Part 1 of 9)

Move current ship: Tidy the orientation vectors

Moving

Subroutine: MVEIT (Part 2 of 9)

Move current ship: Call tactics routine, remove ship from scanner

Moving

Subroutine: MVEIT (Part 3 of 9)

Move current ship: Move ship forward according to its speed

Moving

Subroutine: MVEIT (Part 4 of 9)

Move current ship: Apply acceleration to ship's speed as a one-off

Moving

Subroutine: MVEIT (Part 5 of 9)

Move current ship: Rotate ship's location by our pitch and roll

Moving

Subroutine: MVEIT (Part 6 of 9)

Move current ship: Move the ship in space according to our speed

Moving

Subroutine: MVEIT (Part 7 of 9)

Move current ship: Rotate ship's orientation vectors by pitch/roll

Moving

Subroutine: MVEIT (Part 8 of 9)

Move current ship: Rotate ship about itself by its own pitch/roll

Moving

Subroutine: MVEIT (Part 9 of 9)

Move current ship: Redraw on scanner, if it hasn't been destroyed

Moving

Subroutine: MVT1

Calculate (x_sign x_hi x_lo) = (x_sign x_hi x_lo) + (A R)

Moving

Subroutine: MVT3

Calculate K(3 2 1) = (x_sign x_hi x_lo) + K(3 2 1)

Moving

Subroutine: MVS4

Apply pitch and roll to an orientation vector

Moving

Subroutine: MVS5

Apply a 3.6 degree pitch or roll to an orientation vector

Moving

Subroutine: MVT6

Calculate (A P+2 P+1) = (x_sign x_hi x_lo) + (A P+2 P+1)

Moving

Subroutine: MV40

Rotate the planet or sun by our ship's pitch and roll

Elite B
-------

CategoryDetails

Save and load

Variable: NA%

The data block for the last saved commander

Save and load

Variable: CHK2

Second checksum byte for the saved commander data file

Save and load

Variable: CHK

First checksum byte for the saved commander data file

Universe

Variable: UNIV

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

Drawing pixels

Variable: TWOS

Ready-made single-pixel character row bytes for mode 4

Drawing pixels

Variable: TWOS2

Ready-made double-pixel character row bytes for mode 4

Drawing pixels

Variable: CTWOS

Ready-made single-pixel character row bytes for mode 5

Drawing lines

Subroutine: LOIN (Part 1 of 7)

Draw a line: Calculate the line gradient in the form of deltas

Drawing lines

Subroutine: LOIN (Part 2 of 7)

Draw a line: Line has a shallow gradient, step right along x-axis

Drawing lines

Subroutine: LOIN (Part 3 of 7)

Draw a shallow line going right and up or left and down

Drawing lines

Subroutine: LOIN (Part 4 of 7)

Draw a shallow line going right and down or left and up

Drawing lines

Subroutine: LOIN (Part 5 of 7)

Draw a line: Line has a steep gradient, step up along y-axis

Drawing lines

Subroutine: LOIN (Part 6 of 7)

Draw a steep line going up and left or down and right

Drawing lines

Subroutine: LOIN (Part 7 of 7)

Draw a steep line going up and right or down and left

Drawing lines

Subroutine: NLIN3

Print a title and a horizontal line at row 19 to box it in

Drawing lines

Subroutine: NLIN4

Draw a horizontal line at pixel row 19 to box in a title

Drawing lines

Subroutine: NLIN

Draw a horizontal line at pixel row 23 to box in a title

Drawing lines

Subroutine: NLIN2

Draw a screen-wide horizontal line at the pixel row in A

Drawing lines

Subroutine: HLOIN2

Remove a line from the sun line heap and draw it on-screen

Drawing lines

Subroutine: HLOIN

Draw a horizontal line from (X1, Y1) to (X2, Y1)

Drawing lines

Variable: TWFL

Ready-made character rows for left end of horizontal line

Drawing lines

Variable: TWFR

Ready-made character rows for right end of horizontal line

Drawing pixels

Subroutine: PX3

Plot a single pixel at (X, Y) within a character block

Maths (Arithmetic)

Subroutine: PIX1

Calculate (YY+1 SYL+Y) = (A P) + (S R) and draw stardust particle

Drawing pixels

Subroutine: PIXEL2

Draw a stardust particle relative to the screen centre

Drawing pixels

Subroutine: PIXEL

Draw a 1-pixel dot, 2-pixel dash or 4-pixel square

Drawing circles

Subroutine: BLINE

Draw a circle segment and add it to the ball line heap

Stardust

Subroutine: FLIP

Reflect the stardust particles in the screen diagonal

Stardust

Subroutine: STARS

The main routine for processing the stardust

Stardust

Subroutine: STARS1

Process the stardust for the front view

Stardust

Subroutine: STARS6

Process the stardust for the rear view

Equipment

Variable: PRXS

Equipment prices

Status

Subroutine: STATUS

Show the Status Mode screen (red key f8)

Text

Subroutine: plf2

Print text followed by a newline and indent of 6 characters

Text

Variable: TENS

A constant used when printing large numbers in BPRNT

Text

Subroutine: pr2

Print an 8-bit number, left-padded to 3 digits, and optional point

Text

Subroutine: TT11

Print a 16-bit number, left-padded to n digits, and optional point

Text

Subroutine: BPRNT

Print a 32-bit number, left-padded to n digits, and optional point

Sound

Subroutine: BELL

Make a beep sound

Text

Subroutine: TT26

Print a character at the text cursor (WRCHV points here)

Dashboard

Subroutine: DIALS (Part 1 of 4)

Update the dashboard: speed indicator

Dashboard

Subroutine: DIALS (Part 2 of 4)

Update the dashboard: pitch and roll indicators

Dashboard

Subroutine: DIALS (Part 3 of 4)

Update the dashboard: four energy banks

Dashboard

Subroutine: DIALS (Part 4 of 4)

Update the dashboard: shields, fuel, laser & cabin temp, altitude

Dashboard

Subroutine: PZW

Fetch the current dashboard colours, to support flashing

Dashboard

Subroutine: DILX

Update a bar-based indicator on the dashboard

Dashboard

Subroutine: DIL2

Update the roll or pitch indicator on the dashboard

Screen mode

Variable: TVT1

Palette data for space and the two dashboard colour schemes

Screen mode

Subroutine: IRQ1

The main screen-mode interrupt handler (IRQ1V points here)

Flight

Subroutine: ESCAPE

Launch our escape pod

Elite C
-------

CategoryDetails

Tactics

Subroutine: TACTICS (Part 1 of 7)

Apply tactics: Process missiles, both enemy missiles and our own

Tactics

Subroutine: TACTICS (Part 2 of 7)

Apply tactics: Escape pod, station, lone Thargon, safe-zone pirate

Tactics

Subroutine: TACTICS (Part 3 of 7)

Apply tactics: Calculate dot product to determine ship's aim

Tactics

Subroutine: TACTICS (Part 4 of 7)

Apply tactics: Check energy levels, maybe launch escape pod if low

Tactics

Subroutine: TACTICS (Part 5 of 7)

Apply tactics: Consider whether to launch a missile at us

Tactics

Subroutine: TACTICS (Part 6 of 7)

Apply tactics: Consider firing a laser at us, if aim is true

Tactics

Subroutine: TACTICS (Part 7 of 7)

Apply tactics: Set pitch, roll, and acceleration

Maths (Arithmetic)

Subroutine: TAS1

Calculate K3 = (x_sign x_hi x_lo) - V(1 0)

Tactics

Subroutine: HITCH

Work out if the ship in INWK is in our crosshairs

Tactics

Subroutine: FRS1

Launch a ship straight ahead of us, below the laser sights

Tactics

Subroutine: FRMIS

Fire a missile from our ship

Tactics

Subroutine: ANGRY

Make a ship hostile

Tactics

Subroutine: FR1

Display the "missile jammed" message

Flight

Subroutine: SESCP

Spawn an escape pod from the current (parent) ship

Universe

Subroutine: SFS1

Spawn a child ship from the current (parent) ship

Moving

Subroutine: SFS2

Move a ship in space along one of the coordinate axes

Drawing circles

Subroutine: LL164

Make the hyperspace sound and draw the hyperspace tunnel

Drawing circles

Subroutine: LAUN

Make the launch sound and draw the launch tunnel

Drawing circles

Subroutine: HFS2

Draw the launch or hyperspace tunnel

Stardust

Subroutine: STARS2

Process the stardust for the left or right view

Maths (Geometry)

Variable: SNE

Sine/cosine table

Maths (Arithmetic)

Subroutine: MU5

Set K(3 2 1 0) = (A A A A) and clear the C flGag

Maths (Arithmetic)

Subroutine: MULT3

Calculate K(3 2 1 0) = (A P+1 P) * Q

Maths (Arithmetic)

Subroutine: MLS2

Calculate (S R) = XX(1 0) and (A P) = A * ALP1

Maths (Arithmetic)

Subroutine: MLS1

Calculate (A P) = ALP1 * A

Maths (Arithmetic)

Subroutine: SQUA

Clear bit 7 of A and calculate (A P) = A * A

Maths (Arithmetic)

Subroutine: SQUA2

Calculate (A P) = A * A

Maths (Arithmetic)

Subroutine: MU1

Copy X into P and A, and clear the C flag

Maths (Arithmetic)

Subroutine: MLU1

Calculate Y1 = y_hi and (A P) = |y_hi| * Q for Y-th stardust

Maths (Arithmetic)

Subroutine: MLU2

Calculate (A P) = |A| * Q

Maths (Arithmetic)

Subroutine: MULTU

Calculate (A P) = P * Q

Maths (Arithmetic)

Subroutine: MU11

Calculate (A P) = P * X

Maths (Arithmetic)

Subroutine: MU6

Set P(1 0) = (A A)

Maths (Arithmetic)

Subroutine: FMLTU2

Calculate A = K * sin(A)

Maths (Arithmetic)

Subroutine: FMLTU

Calculate A = A * Q / 256

Maths (Arithmetic)

Subroutine: Unused duplicate of MULTU

Unused duplicate of the MULTU routine

Maths (Arithmetic)

Subroutine: MLTU2

Calculate (A P+1 P) = (A ~P) * Q

Maths (Arithmetic)

Subroutine: MUT3

Unused routine that does the same as MUT2

Maths (Arithmetic)

Subroutine: MUT2

Calculate (S R) = XX(1 0) and (A P) = Q * A

Maths (Arithmetic)

Subroutine: MUT1

Calculate R = XX and (A P) = Q * A

Maths (Arithmetic)

Subroutine: MULT1

Calculate (A P) = Q * A

Maths (Arithmetic)

Subroutine: MULT12

Calculate (S R) = Q * A

Maths (Geometry)

Subroutine: TAS3

Calculate the dot product of XX15 and an orientation vector

Maths (Arithmetic)

Subroutine: MAD

Calculate (A X) = Q * A + (S R)

Maths (Arithmetic)

Subroutine: ADD

Calculate (A X) = (A P) + (S R)

Maths (Arithmetic)

Subroutine: TIS1

Calculate (A ?) = (-X * A + (S R)) / 96

Maths (Arithmetic)

Subroutine: DV42

Calculate (P R) = 256 * DELTA / z_hi

Maths (Arithmetic)

Subroutine: DV41

Calculate (P R) = 256 * DELTA / A

Maths (Arithmetic)

Subroutine: DVID4

Calculate (P R) = 256 * A / Q

Maths (Arithmetic)

Subroutine: DVID3B2

Calculate K(3 2 1 0) = (A P+1 P) / (z_sign z_hi z_lo)

Dashboard

Subroutine: cntr

Apply damping to the pitch or roll dashboard indicator

Dashboard

Subroutine: BUMP2

Bump up the value of the pitch or roll dashboard indicator

Dashboard

Subroutine: REDU2

Reduce the value of the pitch or roll dashboard indicator

Maths (Geometry)

Subroutine: ARCTAN

Calculate A = arctan(P / Q)

Maths (Geometry)

Variable: ACT

Arctan table

Flight

Subroutine: WARP

Perform an in-system jump

Drawing lines

Subroutine: LASLI

Draw the laser lines for when we fire our lasers

Flight

Subroutine: PLUT

Flip the coordinate axes for the four different views

Flight

Subroutine: LOOK1

Initialise the space view

Utility routines

Subroutine: TT66

Clear the screen and set the current view type

Utility routines

Subroutine: TTX66

Clear the top part of the screen and draw a white border

Utility routines

Subroutine: DELAY

Wait for a specified time, in 1/50s of a second

Charts

Subroutine: hm

Select the closest system and redraw the chart crosshairs

Utility routines

Subroutine: CLYNS

Clear the bottom three text rows of the mode 4 screen

Utility routines

Subroutine: LYN

Clear most of a row of pixels

Dashboard

Subroutine: SCAN

Display the current ship on the scanner

Screen mode

Subroutine: WSCAN

Wait for the vertical sync

Elite D
-------

CategoryDetails

Market

Subroutine: tnpr

Work out if we have space for a specific amount of cargo

Universe

Subroutine: TT20

Twist the selected system's seeds four times

Universe

Subroutine: TT54

Twist the selected system's seeds

Text

Subroutine: TT146

Print the distance to the selected system in light years

Text

Subroutine: TT60

Print a text token and a paragraph break

Text

Subroutine: TTX69

Print a paragraph break

Text

Subroutine: TT69

Set Sentence Case and print a newline

Text

Subroutine: TT67

Print a newline

Text

Subroutine: TT70

Display "MAINLY " and jump to TT72

Text

Subroutine: spc

Print a text token followed by a space

Universe

Subroutine: TT25

Show the Data on System screen (red key f6)

Universe

Subroutine: TT24

Calculate system data from the system seeds

Charts

Subroutine: TT22

Show the Long-range Chart (red key f4)

Drawing lines

Subroutine: TT15

Draw a set of crosshairs

Drawing circles

Subroutine: TT14

Draw a circle with crosshairs on a chart

Drawing circles

Subroutine: TT128

Draw a circle on a chart

Market

Subroutine: TT219

Show the Buy Cargo screen (red key f1)

Market

Subroutine: gnum

Get a number from the keyboard

Market

Subroutine: TT208

Show the Sell Cargo screen (red key f2)

Inventory

Subroutine: TT210

Show a list of current cargo in our hold, optionally to sell

Inventory

Subroutine: TT213

Show the Inventory screen (red key f9)

Inventory

Subroutine: TT214

Ask a question with a "Y/N?" prompt and return the response

Charts

Subroutine: TT16

Move the crosshairs on a chart

Charts

Subroutine: TT103

Draw a small set of crosshairs on a chart

Charts

Subroutine: TT123

Move galactic coordinates by a signed delta

Charts

Subroutine: TT105

Draw crosshairs on the Short-range Chart, with clipping

Charts

Subroutine: TT23

Show the Short-range Chart (red key f5)

Universe

Subroutine: TT81

Set the selected system's seeds to those of system 0

Universe

Subroutine: TT111

Set the current system to the nearest system to a point

Flight

Subroutine: hy6

Print a message to say no hyperspacing inside the station

Flight

Subroutine: hyp

Start the hyperspace process

Flight

Subroutine: wW

Start a hyperspace countdown

Flight

Subroutine: Ghy

Perform a galactic hyperspace jump

Universe

Subroutine: jmp

Set the current system to the selected system

Text

Subroutine: ee3

Print the hyperspace countdown in the top-left of the screen

Text

Subroutine: pr6

Print 16-bit number, left-padded to 5 digits, no point

Text

Subroutine: pr5

Print a 16-bit number, left-padded to 5 digits, and optional point

Text

Subroutine: TT147

Print an error when a system is out of hyperspace range

Text

Subroutine: prq

Print a text token followed by a question mark

Market

Subroutine: TT151

Print the name, price and availability of a market item

Market

Subroutine: TT152

Print the unit ("t", "kg" or "g") for a market item

Text

Subroutine: TT162

Print a space

Market

Subroutine: TT160

Print "t" (for tonne) and a space

Market

Subroutine: TT161

Print "kg" (for kilograms)

Market

Subroutine: TT16a

Print "g" (for grams)

Market

Subroutine: TT163

Print the headers for the table of market prices

Market

Subroutine: TT167

Show the Market Price screen (red key f7)

Market

Subroutine: var

Calculate QQ19+3 = economy * |economic_factor|

Universe

Subroutine: hyp1

Process a jump to the system closest to (QQ9, QQ10)

Universe

Subroutine: GVL

Calculate the availability of a market item

Universe

Subroutine: GTHG

Spawn a Thargoid ship and a Thargon companion

Flight

Subroutine: MJP

Process a mis-jump into witchspace

Flight

Subroutine: TT18

Try to initiate a jump into hyperspace

Flight

Subroutine: TT110

Launch from a station or show the front space view

Charts

Subroutine: TT114

Display either the Long-range or Short-range Chart

Maths (Arithmetic)

Subroutine: LCASH

Subtract an amount of cash from the cash pot

Maths (Arithmetic)

Subroutine: MCASH

Add an amount of cash to the cash pot

Maths (Arithmetic)

Subroutine: GCASH

Calculate (Y X) = P * Q * 4

Maths (Arithmetic)

Subroutine: GC2

Calculate (Y X) = (A P) * 4

Equipment

Subroutine: EQSHP

Show the Equip Ship screen (red key f3)

Text

Subroutine: dn

Print the amount of cash and beep

Text

Subroutine: dn2

Make a short, high beep and delay for 1 second

Equipment

Subroutine: eq

Subtract the price of equipment from the cash pot

Equipment

Subroutine: prx

Return the price of a piece of equipment

Equipment

Subroutine: qv

Print a menu of the four space views, for buying lasers

Elite E
-------

CategoryDetails

Copy protection

Variable: Authors' names

The authors' names and a copyright notice, buried in the code

Text

Subroutine: cpl

Print the selected system name

Text

Subroutine: cmn

Print the commander's name

Text

Subroutine: ypl

Print the current system name

Text

Subroutine: tal

Print the current galaxy numbe

Text

Subroutine: fwl

Print fuel and cash levels

Text

Subroutine: csh

Print the current amount of cash

Text

Subroutine: plf

Print a text token followed by a newline

Text

Subroutine: TT68

Print a text token followed by a colon

Text

Subroutine: TT73

Print a colon

Text

Subroutine: TT27

Print a text token

Text

Subroutine: TT42

Print a letter in lower case

Text

Subroutine: TT41

Print a letter according to Sentence Case

Text

Subroutine: qw

Print a recursive token in the range 128-145

Text

Subroutine: crlf

Tab to column 21 and print a colon

Text

Subroutine: TT45

Print a letter in lower case

Text

Subroutine: TT46

Print a character and switch to capitals

Text

Subroutine: TT74

Print a character

Text

Subroutine: TT43

Print a two-letter token or recursive token 0-95

Text

Subroutine: ex

Print a recursive token

Drawing ships

Subroutine: DOEXP

Draw an exploding ship

Universe

Subroutine: SOS1

Update the missile indicators, set up the planet data block

Universe

Subroutine: SOLAR

Set up various aspects of arriving in a new system

Stardust

Subroutine: NWSTARS

Initialise the stardust field

Stardust

Subroutine: nWq

Create a random cloud of stardust

Dashboard

Subroutine: WPSHPS

Clear the scanner, reset the ball line and sun line heaps

Drawing suns

Subroutine: FLFLLS

Reset the sun line heap

Screen mode

Subroutine: DET1

Hide the dashboard (for when we die)

Flight

Subroutine: SHD

Charge a shield and drain some energy from the energy banks

Flight

Subroutine: DENGY

Drain some energy from the energy banks

Dashboard

Subroutine: COMPAS

Update the compass

Maths (Arithmetic)

Subroutine: SPS2

Calculate (Y X) = A / 10

Maths (Geometry)

Subroutine: SPS4

Calculate the vector to the space station

Dashboard

Subroutine: SP1

Draw the space station on the compass

Dashboard

Subroutine: SP2

Draw a dot on the compass, given the planet/station vector

Dashboard

Subroutine: DOT

Draw a dot on the compass

Drawing pixels

Subroutine: CPIX4

Draw a double-height dot on the dashboard

Drawing pixels

Subroutine: CPIX2

Draw a single-height dot on the dashboard

Flight

Subroutine: OOPS

Take some damage

Maths (Geometry)

Subroutine: SPS3

Copy a space coordinate from the K% block into K3

Universe

Subroutine: GINF

Fetch the address of a ship's data block into INF

Universe

Subroutine: NWSPS

Add a new space station to our local bubble of universe

Universe

Subroutine: NWSHP

Add a new ship to our local bubble of universe

Universe

Subroutine: NwS1

Flip the sign and double an INWK byte

Dashboard

Subroutine: ABORT

Disarm missiles and update the dashboard indicators

Dashboard

Subroutine: ABORT2

Set/unset the lock target for a missile and update the dashboard

Dashboard

Subroutine: ECBLB2

Start up the E.C.M. (indicator, start countdown and make sound)

Dashboard

Subroutine: ECBLB

Light up the E.C.M. indicator bulb ("E") on the dashboard

Dashboard

Subroutine: SPBLB

Light up the space station indicator ("S") on the dashboard

Dashboard

Subroutine: BULB

Draw an indicator bulb on the dashboard

Dashboard

Variable: ECBT

The character definition for the E.C.M. indicator

Dashboard

Variable: SPBT

The character definition for the space station indicator

Dashboard

Subroutine: MSBAR

Draw a specific indicator in the dashboard's missile bar

Drawing ships

Subroutine: PROJ

Project the current ship onto the screen

Drawing planets

Subroutine: PL2

Remove the planet or sun from the screen

Drawing planets

Subroutine: PLANET

Draw the planet or sun

Drawing planets

Subroutine: PL9 (Part 1 of 3)

Draw the planet, with either an equator and meridian, or a crater

Drawing planets

Subroutine: PL9 (Part 2 of 3)

Draw the planet's equator and meridian

Drawing planets

Subroutine: PL9 (Part 3 of 3)

Draw the planet's crater

Drawing planets

Subroutine: PLS1

Calculate (Y A) = nosev_x / z

Drawing planets

Subroutine: PLS2

Draw a half-circle

Drawing planets

Subroutine: PLS22

Draw a circle or half-circle

Drawing suns

Subroutine: SUN (Part 1 of 4)

Draw the sun: Set up all the variables needed

Drawing suns

Subroutine: SUN (Part 2 of 4)

Draw the sun: Start from bottom of screen and erase the old sun

Drawing suns

Subroutine: SUN (Part 3 of 4)

Draw the sun: Continue to move up the screen, drawing the new sun

Drawing suns

Subroutine: SUN (Part 4 of 4)

Draw the sun: Continue to the top of the screen, erasing old sun

Drawing circles

Subroutine: CIRCLE

Draw a circle for the planet

Drawing circles

Subroutine: CIRCLE2

Draw a circle (for the planet or chart)

Drawing planets

Subroutine: WPLS2

Remove the planet from the screen

Drawing suns

Subroutine: WPLS

Remove the sun from the screen

Drawing lines

Subroutine: EDGES

Draw a horizontal line given a centre and a half-width

Drawing circles

Subroutine: CHKON

Check whether a circle will fit on-screen

Drawing planets

Subroutine: PL21

Return from a planet/sun-drawing routine with a failure flag

Drawing planets

Subroutine: PLS3

Calculate (Y A P) = 222 * roofv_x / z

Drawing planets

Subroutine: PLS4

Calculate CNT2 = arctan(P / A) / 4

Drawing planets

Subroutine: PLS5

Calculate roofv_x / z and roofv_y / z

Drawing planets

Subroutine: PLS6

Calculate (X K) = (A P) / (z_sign z_hi z_lo)

Keyboard

Subroutine: TT17

Scan the keyboard for cursor key or joystick movement

Universe

Subroutine: ping

Set the selected system to the current system

Elite F
-------

CategoryDetails

Universe

Subroutine: KS3

Set the SLSP ship heap pointer after shuffling ship slots

Universe

Subroutine: KS1

Remove the current ship from our local bubble of universe

Universe

Subroutine: KS4

Remove the space station and replace it with the sun

Universe

Subroutine: KS2

Check the local bubble for missiles with target lock

Universe

Subroutine: KILLSHP

Remove a ship from our local bubble of universe

Sound

Variable: SFX

Sound data

Start and end

Subroutine: RESET

Reset most variables

Start and end

Subroutine: RES4

Reset shields and energy banks and lots of flight variables

Start and end

Subroutine: RES2

Reset a number of flight variables and workspaces

Utility routines

Subroutine: ZINF

Reset the INWK workspace

Dashboard

Subroutine: msblob

Display the dashboard's missile indicators in green

Text

Subroutine: me2

Remove an in-flight message from the space view

Utility routines

Subroutine: Ze

Initialise the INWK workspace to a hostile ship

Utility routines

Subroutine: DORND

Generate random numbers

Main loop

Subroutine: Main game loop (Part 1 of 6)

Spawn a trader (a peaceful Cobra Mk III)

Main loop

Subroutine: Main game loop (Part 2 of 6)

Call main flight loop, potentially spawn trader, asteroid, cargo

Main loop

Subroutine: Main game loop (Part 3 of 6)

Potentially spawn a cop, particularly if we've been bad

Main loop

Subroutine: Main game loop (Part 4 of 6)

Potentially spawn lone bounty hunter, Thargoid, or up to 4 pirates

Main loop

Subroutine: Main game loop (Part 5 of 6)

Cool down lasers, make calls to update the dashboard

Main loop

Subroutine: Main game loop (Part 6 of 6)

Process non-flight key presses (red function keys, docked keys)

Main loop

Subroutine: tha

Consider spawning a Thargoid (22% chance)

Keyboard

Subroutine: TT102

Process function key, save, hyperspace and chart key presses

Status

Subroutine: BAD

Calculate how bad we have been

Maths (Geometry)

Subroutine: FAROF

Compare x_hi, y_hi and z_hi with 224

Maths (Geometry)

Subroutine: FAROF2

Compare x_hi, y_hi and z_hi with A

Maths (Geometry)

Subroutine: MAS4

Calculate a cap on the maximum distance to a ship

Start and end

Subroutine: DEATH

Display the death screen

Start and end

Subroutine: DEATH2

Reset most of the game and restart from the title screen

Start and end

Subroutine: TT170

Main entry point for the Elite game code

Status

Subroutine: BAY

Go to the docking bay (i.e. show the Status Mode screen)

Start and end

Subroutine: TITLE

Display a title screen with a rotating ship and prompt

Save and load

Subroutine: CHECK

Calculate the checksum for the last saved commander data block

Save and load

Subroutine: TRNME

Copy the last saved commander's name from INWK to NA%

Save and load

Subroutine: TR1

Copy the last saved commander's name from NA% to INWK

Save and load

Subroutine: GTNME

Get the commander's name

Utility routines

Subroutine: ZERO

Zero-fill pages &9, &A, &B, &C and &D

Utility routines

Subroutine: ZES1

Zero-fill the page whose number is in X

Utility routines

Subroutine: ZES2

Zero-fill a specific page

Save and load

Subroutine: SVE

Save the commander file

Save and load

Subroutine: QUS1

Save or load the commander file

Save and load

Subroutine: LOD

Load a commander file

Utility routines

Subroutine: FX200

Set the behaviour of the Escape and Break keys

Maths (Geometry)

Subroutine: SPS1

Calculate the vector to the planet and store it in XX15

Maths (Geometry)

Subroutine: TAS2

Normalise the three-coordinate vector in K3

Maths (Geometry)

Subroutine: NORM

Normalise the three-coordinate vector in XX15

Keyboard

Subroutine: RDKEY

Scan the keyboard for a specific key

Sound

Subroutine: ECMOF

Switch off the E.C.M.

Sound

Subroutine: EXNO3

Make an explosion sound

Tactics

Subroutine: SFRMIS

Add an enemy missile to our local bubble of universe

Sound

Subroutine: EXNO2

Process us making a kill

Sound

Subroutine: EXNO

Make the sound of a laser strike or ship explosion

Sound

Subroutine: BEEP

Make a short, high beep

Sound

Subroutine: NOISE

Make the sound whose number is in A

Sound

Subroutine: NO3

Make a sound from a prepared sound block

Sound

Subroutine: NOS1

Prepare a sound block

Keyboard

Variable: KYTB

Lookup table for in-flight keyboard controls

Keyboard

Subroutine: DKS1

Scan the keyboard for a flight key

Keyboard

Subroutine: CTRL

Scan the keyboard to see if CTRL is currently pressed

Keyboard

Subroutine: DKS4

Scan the keyboard to see if a specific key is being pressed

Keyboard

Subroutine: DKS2

Read the joystick position

Keyboard

Subroutine: DKS3

Toggle a configuration setting and emit a beep

Keyboard

Subroutine: DKJ1

Read joystick and flight controls

Keyboard

Subroutine: U%

Clear the key logger (from KY1 through KY19)

Keyboard

Subroutine: DOKEY

Scan for the seven primary flight controls

Keyboard

Subroutine: DK4

Scan for pause, configuration and secondary flight keys

Keyboard

Subroutine: TT217

Scan the keyboard until a key is pressed

Text

Subroutine: me1

Erase an old in-flight message and display a new one

Text

Subroutine: ou2

Display "E.C.M.SYSTEM DESTROYED" as an in-flight message

Text

Subroutine: ou3

Display "FUEL SCOOPS DESTROYED" as an in-flight message

Text

Subroutine: MESS

Display an in-flight message

Text

Subroutine: mes9

Print a text token, possibly followed by " DESTROYED"

Flight

Subroutine: OUCH

Potentially lose cargo or equipment following damage

Text

Variable: QQ16

The two-letter token lookup table

Market

Macro: ITEM

Macro definition for the market prices table

Market

Variable: QQ23

Market prices table

Maths (Geometry)

Subroutine: TIDY

Orthonormalise the orientation vectors for a ship

Maths (Arithmetic)

Subroutine: TIS2

Calculate A = A / Q

Maths (Arithmetic)

Subroutine: TIS3

Calculate -(nosev_1 * roofv_1 + nosev_2 * roofv_2) / nosev_3

Maths (Arithmetic)

Subroutine: DVIDT

Calculate (P+1 A) = (A P) / Q

Elite G
-------

CategoryDetails

Drawing ships

Subroutine: SHPPT

Draw a distant ship as a point rather than a full wireframe

Maths (Arithmetic)

Subroutine: LL5

Calculate Q = SQRT(R Q)

Maths (Arithmetic)

Subroutine: LL28

Calculate R = 256 * A / Q

Maths (Arithmetic)

Subroutine: LL38

Calculate (S A) = (S R) + (A Q)

Maths (Geometry)

Subroutine: LL51

Calculate the dot product of XX15 and XX16

Drawing ships

Subroutine: LL9 (Part 1 of 11)

Draw ship: Check if ship is exploding, check if ship is in front

Drawing ships

Subroutine: LL9 (Part 2 of 11)

Draw ship: Check if ship is in field of view, close enough to draw

Drawing ships

Subroutine: LL9 (Part 3 of 11)

Draw ship: Set up orientation vector, ship coordinate variables

Drawing ships

Subroutine: LL9 (Part 4 of 11)

Draw ship: Set visibility for exploding ship (all faces visible)

Drawing ships

Subroutine: LL9 (Part 5 of 11)

Draw ship: Calculate the visibility of each of the ship's faces

Drawing ships

Subroutine: LL9 (Part 6 of 11)

Draw ship: Calculate the visibility of each of the ship's vertices

Maths (Arithmetic)

Subroutine: LL61

Calculate (U R) = 256 * A / Q

Maths (Arithmetic)

Subroutine: LL62

Calculate 128 - (U R)

Drawing ships

Subroutine: LL9 (Part 7 of 11)

Draw ship: Calculate the visibility of each of the ship's vertices

Drawing ships

Subroutine: LL9 (Part 8 of 11)

Draw ship: Calculate the screen coordinates of visible vertices

Drawing ships

Subroutine: LL9 (Part 9 of 11)

Draw ship: Draw laser beams if the ship is firing its laser at us

Drawing ships

Subroutine: LL9 (Part 10 of 11)

Draw ship: Calculate the visibility of each of the ship's edges

Drawing ships

Subroutine: LL9 (Part 11 of 11)

Draw ship: Draw all the visible edges from the ship line heap

Drawing lines

Subroutine: LL118

Move a point along a line until it is on-screen

Maths (Arithmetic)

Subroutine: LL120

Calculate (Y X) = (S x1_lo) * XX12+2 or (S x1_lo) / XX12+2

Maths (Arithmetic)

Subroutine: LL123

Calculate (Y X) = (S R) / XX12+2 or (S R) * XX12+2

Maths (Arithmetic)

Subroutine: LL129

Calculate Q = XX12+2, A = S EOR XX12+3 and (S R) = |S R|

Drawing lines

Subroutine: LL145 (Part 1 of 4)

Clip line: Work out which end-points are on-screen, if any

Drawing lines

Subroutine: LL145 (Part 2 of 4)

Clip line: Work out if any part of the line is on-screen

Drawing lines

Subroutine: LL145 (Part 3 of 4)

Clip line: Calculate the line's gradient

Drawing lines

Subroutine: LL145 (Part 4 of 4)

Clip line: Call the routine in LL188 to do the actual clipping

Copy protection

Variable: checksum0

Checksum for the entire main game code

Ship blueprints
---------------

CategoryDetails

Drawing ships

Macro: VERTEX

Macro definition for adding vertices to ship blueprints

Drawing ships

Macro: EDGE

Macro definition for adding edges to ship blueprints

Drawing ships

Macro: FACE

Macro definition for adding faces to ship blueprints

Drawing ships

Variable: XX21

Ship blueprints lookup table

Drawing ships

Variable: SHIP1

Ship blueprint for a Sidewinder

Drawing ships

Variable: SHIP2

Ship blueprint for a Viper

Drawing ships

Variable: SHIP3

Ship blueprint for a Mamba

Drawing ships

Variable: SHIP5

Ship blueprint for a Cobra Mk III

Drawing ships

Variable: SHIP6

Ship blueprint for a Thargoid mothership

Drawing ships

Variable: SHIP8

Ship blueprint for a Coriolis space station

Drawing ships

Variable: SHIP9

Ship blueprint for a missile

Drawing ships

Variable: SHIP10

Ship blueprint for an asteroid

Drawing ships

Variable: SHIP11

Ship blueprint for a cargo canister

Drawing ships

Variable: SHIP12

Ship blueprint for a Thargon

Drawing ships

Variable: SHIP13

Ship blueprint for an escape pod

Drawing ships

Variable: SHIP4

Ship blueprint for a Python

Save and load

Variable: SVN

The "saving in progress" flag

Screen mode

Variable: VEC

The original value of the IRQ1 vector

Big Code file
-------------

CategoryDetails

Copy protection

Subroutine: LBL (Big Code file)

Checksum the two pages of code that were copied from UU% to LE%