This index contains every subroutine and entry point that appears in the source code for the Apple II version of Elite, grouped by category. An entry points is a label within a subroutine that is called from outside the subroutine, which typically implements a subset or variation of the functionality of the parent subroutine.
- Charts
- Dashboard
- Drawing circles
- Drawing lines
- Drawing pixels
- Drawing planets
- Drawing ships
- Drawing suns
- Drawing the screen
- Equipment
- Flight
- Keyboard
- Loader
- Main loop
- Market
- Maths (Arithmetic)
- Maths (Geometry)
- Missions
- Moving
- Save and load
- Sound
- Stardust
- Start and end
- Status
- Tactics
- Text
- Tube
- Universe
- Utility routines
Charts
| |
hm | Select the closest system and redraw the chart crosshairs |
HME2 | Search the galaxy for a system |
TT103 | Draw a small set of crosshairs on a chart |
TT105 | Draw crosshairs on the Short-range Chart, with clipping |
TT114 | Display either the Long-range or Short-range Chart |
TT123 | Move galactic coordinates by a signed delta |
TT16 | Move the crosshairs on a chart |
TT180 | Contains an RTS |
TT22 | Show the Long-range Chart |
TT23 | Show the Short-range Chart |
Dashboard
| |
ABORT | Disarm missiles and update the dashboard indicators |
ABORT2 | Set/unset the lock target for a missile and update the dashboard |
BULB | Draw an indicator bulb on the dashboard |
BUMP2 | Bump up the value of the pitch or roll dashboard indicator |
cntr | Apply damping to the pitch or roll dashboard indicator |
COMPAS | Update the compass |
DIALS (Part 1 of 4) | Update the dashboard: speed indicator |
DIALS (Part 2 of 4) | Update the dashboard: pitch and roll indicators |
DIALS (Part 3 of 4) | Update the dashboard: four energy banks |
DIALS (Part 4 of 4) | Update the dashboard: shields, fuel, laser & cabin temp, altitude |
DIR1 | Contains an RTS |
DIS1 | Update a bar-based indicator on the dashboard |
DIS1+2 | The range of the indicator is 0-63 (for the fuel indicator) |
DIS2 | The range of the indicator is 0-31 (for the fuel and energy bank indicators) |
DIS5 | Update the roll or pitch indicator on the dashboard |
djd1 | Auto-recentre the value in X, if keyboard auto-recentre is configured |
DOT | Draw a dash on the compass |
ECBLB | Light up the E.C.M. indicator bulb ("E") on the dashboard |
ECBLB2 | Start up the E.C.M. (light up the indicator, start the countdown and make the E.C.M. sound) |
MSBAR | Draw a specific indicator in the dashboard's missile bar |
MSBARS | Draw two horizontal lines as part of an indicator bar, from (X1, Y1+1) to (X2, Y1+1) and (X1, Y1+2) to (X2, Y1+2) |
msblob | Display the dashboard's missile indicators in green |
RE1 | Contains an RTS |
RE2+2 | Restore A from T and return from the subroutine |
REDU2 | Reduce the value of the pitch or roll dashboard indicator |
SCAN | Display the current ship on the scanner |
SP1 | Draw the space station on the compass |
SP2 | Draw a dot on the compass, given the planet/station vector |
SPBLB | Light up the space station indicator ("S") on the dashboard |
WPSHPS | Clear the scanner, reset the ball line and sun line heaps |
Drawing circles
| |
BLINE | Draw a circle segment and add it to the ball line heap |
CHKON | Check whether any part of a circle appears on the extended screen |
CIRCLE | Draw a circle for the planet |
CIRCLE2 | Draw a circle (for the planet or chart) |
HFS1 | Don't clear the screen, and draw 8 concentric rings with the step size in STP |
HFS2 | Draw the launch or hyperspace tunnel |
LAUN | Make the launch sound and draw the launch tunnel |
LL164 | Make the hyperspace sound and draw the hyperspace tunnel |
TT128 | Draw a circle on a chart |
TT14 | Draw a circle with crosshairs on a chart |
Drawing lines
| |
BOMBEFF2 | Erase the energy bomb zig-zag lightning bolt, make the sound of the energy bomb going off, draw a new bolt and repeat four times |
BOMBOFF | Draw the zig-zag lightning bolt for the energy bomb |
BOMBON | Randomise and draw the energy bomb's zig-zag lightning bolt lines |
CLIP | Another name for LL145 CLIP2 Don't initialise the values in SWAP or A |
CLIP2 | Don't initialise the values in SWAP or A |
DVLOIN | Draw a vertical line from (A, GCYT) to (A, GCYB) |
EDGES | Draw a horizontal line given a centre and a half-width |
HL6 | Contains an RTS |
HLOIN | Draw a horizontal line from (X1, Y1) to (X2, Y1) |
HLOIN2 | Remove a line from the sun line heap and draw it on-screen |
LASLI | Draw the laser lines for when we fire our lasers |
LASLI-1 | Contains an RTS |
LASLI2 | Just draw the current laser lines without moving the centre point, draining energy or heating up. This has the effect of removing the lines from the screen |
LL118 | Move a point along a line until it is on-screen |
LL118-1 | Contains an RTS |
LL145 (Part 1 of 4) | Clip line: Work out which end-points are on-screen, if any |
LL145 (Part 2 of 4) | Clip line: Work out if any part of the line is on-screen |
LL145 (Part 3 of 4) | Clip line: Calculate the line's gradient |
LL145 (Part 4 of 4) | Clip line: Call the routine in LL188 to do the actual clipping |
LL30 | LL30 is a synonym for LOIN and draws a line from (X1, Y1) to (X2, Y2) |
LOIN (Part 1 of 7) | Draw a line: Calculate the line gradient in the form of deltas |
LOIN (Part 2 of 7) | Draw a line: Line has a shallow gradient, step right along x-axis |
LOIN (Part 3 of 7) | Draw a shallow line going right and up or left and down |
LOIN (Part 4 of 7) | Draw a shallow line going right and down or left and up |
LOIN (Part 5 of 7) | Draw a line: Line has a steep gradient, step up along y-axis |
LOIN (Part 6 of 7) | Draw a steep line going up and left or down and right |
LOIN (Part 7 of 7) | Draw a steep line going up and right or down and left |
LSPUT | Draw a ship line using flicker-free animation |
NLI4 | Draw a line of dashes underneath a title on the text screen |
NLIN | Draw a horizontal line at pixel row 23 to box in a title |
NLIN2 | Draw a screen-wide horizontal line at the pixel row in A |
NLIN3 | Print a title and draw a horizontal line at row 19 to box it in |
NLIN4 | Draw a horizontal line at pixel row 19 to box in a title |
NLIN5 | Move the text cursor down one line before drawing the line |
TT15 | Draw a set of crosshairs |
VLOIN | Draw a vertical line from (X1, Y1) to (X1, Y2) |
Drawing pixels
| |
CPIX | Draw a colour pixel |
PIXEL | Draw a two-pixel dash, three-pixel dash or double-height three-pixel dash |
PIXEL2 | Draw a stardust particle relative to the screen centre |
PXR1 | Contains an RTS |
Drawing planets
| |
PL2 | Remove the planet or sun from the screen |
PL2-1 | Contains an RTS |
PL21 | Return from a planet/sun-drawing routine with a failure flag |
PL44 | Clear the C flag and return from the subroutine PL6 Contains an RTS |
PL6 | Contains an RTS |
PL9 | Draw the planet as a plain circle |
PLANET | Draw the planet or sun |
PLS6 | Calculate (X K) = (A P+1 P) / (z_sign z_hi z_lo) |
WP1 | Reset the ball line heap |
WPLS2 | Remove the planet from the screen |
Drawing ships
| |
DOEXP | Draw an exploding ship |
EE51 | Remove the current ship from the screen, called from SHPPT before drawing the ship as a point |
LL10-1 | Contains an RTS |
LL66 | A re-entry point into the ship-drawing routine, used by the LL62 routine to store 128 - (U R) on the XX3 heap |
LL70+1 | Contains an RTS (as the first byte of an LDA instruction) |
LL81+2 | Draw the contents of the ship line heap, used to draw the ship as a dot from SHPPT |
LL9 (Part 1 of 12) | Draw ship: Check if ship is exploding, check if ship is in front |
LL9 (Part 2 of 12) | Draw ship: Check if ship is in field of view, close enough to draw |
LL9 (Part 3 of 12) | Draw ship: Set up orientation vector, ship coordinate variables |
LL9 (Part 4 of 12) | Draw ship: Set visibility for exploding ship (all faces visible) |
LL9 (Part 5 of 12) | Draw ship: Calculate the visibility of each of the ship's faces |
LL9 (Part 6 of 12) | Draw ship: Calculate the visibility of each of the ship's vertices |
LL9 (Part 7 of 12) | Draw ship: Calculate the visibility of each of the ship's vertices |
LL9 (Part 8 of 12) | Draw ship: Calculate the screen coordinates of visible vertices |
LL9 (Part 9 of 12) | Draw ship: Draw laser beams if the ship is firing its laser at us |
LL9 (Part 10 of 12) | Draw ship: Calculate the visibility of each of the ship's edges and draw the visible ones using flicker-free animation |
LL9 (Part 11 of 12) | Draw ship: Loop back for the next edge |
LL9 (Part 12 of 12) | Draw ship: Draw all the visible edges from the ship line heap |
LSC3 | Contains an RTS |
LSCLR | Draw any remaining lines from the old ship that are still in the ship line heap |
SHPPT | Draw a distant ship as a point rather than a full wireframe |
Drawing suns
| |
FLFLLS | Reset the sun line heap |
RTS2 | Contains an RTS |
SUN (Part 1 of 4) | Draw the sun: Set up all the variables needed to draw the sun |
SUN (Part 2 of 4) | Draw the sun: Start from the bottom of the screen and erase the old sun line by line |
SUN (Part 3 of 4) | Draw the sun: Continue to move up the screen, drawing the new sun line by line |
SUN (Part 4 of 4) | Draw the sun: Continue to the top of the screen, erasing the old sun line by line |
WPLS | Remove the sun from the screen |
WPLS-1 | Contains an RTS |
Drawing the screen
| |
BOX | Just draw the border box along the top of the screen (the sides are retained from the loading screen, along with the dashboard) |
cleargrap | Clear screen memory for the top part of the graphics screen mode (the space view), drawing blue borders along the sides as we do so |
clearrow | Clear a character row of screen memory, drawing blue borders along the left and right edges as we do so |
cleartext | Clear screen memory for the text screen mode |
clss | Clear the screen, move the text cursor to the top-left corner and jump back into the CHPR routine to print the next character |
CLYNS | Clear two character rows near the bottom of the screen |
DET1 | Show or hide the dashboard (for when we die) |
HGR | Switch to the high-resolution graphics screen mode |
TEXT | Switch to the text screen mode |
TRADEMODE | Clear the screen and set up a trading screen |
TT66 | Clear the screen and set the current view type |
TTX66 | Clear the top part of the screen, draw a border box if required and configure the specified view |
TTX66K | Clear the whole screen or just the space view (as appropriate), and draw a border box if required |
WSCAN | Wait for 15 * 256 loop iterations |
Equipment
| |
c | Contains an RTS |
eq | Subtract the price of equipment from the cash pot |
EQSHP | Show the Equip Ship screen |
err | Beep, pause and go to the docking bay (i.e. show the Status Mode screen) |
pres | Given an item number A with the item name in recursive token Y, show an error to say that the item is already present, refund the cost of the item, and then beep and exit to the docking bay (i.e. show the Status Mode screen) |
prx | Return the price of a piece of equipment |
prx-3 | Return the price of the item with number A - 1 c Contains an RTS |
qv | Print a menu of the four space views, for buying lasers |
refund | Install a new laser, processing a refund if applicable |
Flight
| |
DCS1 | Calculate the vector from the ideal docking position to the ship |
DENGY | Drain some energy from the energy banks |
dockEd | Print a message to say there is no hyperspacing allowed inside the station |
DOCKIT | Apply docking manoeuvres to the ship in INWK |
DOENTRY | Dock at the space station and work out any mission progression |
ee3 | Print the hyperspace countdown in the top-left of the screen |
ESCAPE | Launch our escape pod |
Ghy | Perform a galactic hyperspace jump |
hyp | Start the hyperspace process |
LO2 | Contains an RTS |
LOOK1 | Initialise the space view |
me1 | Erase an old in-flight message and display a new one |
me2 | Remove an in-flight message from the space view |
mes9 | Print a text token, possibly followed by " DESTROYED" |
MESS | Display an in-flight message |
MJP | Process a mis-jump into witchspace |
OOPS | Take some damage |
ou2 | Display "E.C.M.SYSTEM DESTROYED" as an in-flight message |
ou3 | Display "FUEL SCOOPS DESTROYED" as an in-flight message |
OUCH | Potentially lose cargo or equipment following damage |
PLUT | Flip the coordinate axes for the four different views |
ptg | Called when the user manually forces a mis-jump RTS111 Contains an RTS |
RTS111 | Contains an RTS |
SESCP | Spawn an escape pod from the current (parent) ship |
SHD | Charge a shield and drain some energy from the energy banks |
SIGHT | Draw the laser crosshairs |
TT110 | Launch from a station or show the front space view |
TT147 | Print an error when a system is out of hyperspace range |
TT18 | Try to initiate a jump into hyperspace |
TTX110 | Set the current system to the nearest system and return to hyp |
TTX111 | Used to rejoin this routine from the call to TTX110 |
WARP | Perform an in-system jump |
wW | Start a hyperspace countdown |
wW2 | Start the hyperspace countdown, starting the countdown from the value in A |
zZ+1 | Contains an RTS |
Keyboard
| |
DK4 | Scan for pause, configuration and secondary flight keys |
DKS2 | Read the joystick position |
DKS3 | Toggle a configuration setting and emit a beep |
DKSANYKEY | Scan the keyboard to detect whether any key is being pressed |
DOKEY | Scan for the seven primary flight controls and apply the docking computer manoeuvring code |
FLKB | Flush the keyboard buffer |
FREEZE | Rejoin the pause routine after processing a screen save |
out | Contains an RTS t As TT217 but don't preserve Y, set it to YSAV instead |
PAUSE2 | Wait until a key is pressed, ignoring any existing key press |
RDKEY | Scan the keyboard for key presses and the joystick, and update the key logger |
RDS1 | Scan one axis of the joystick and return its position |
t | As TT217 but don't preserve Y, set it to YSAV instead |
T95 | Print the distance to the selected system |
TT102 | Process number key, save key, hyperspace and chart key presses and update the hyperspace counter |
TT17 | Scan the keyboard for cursor key or joystick movement |
TT214 | Ask a question with a "Y/N?" prompt and return the response |
TT217 | Scan the keyboard until a key is pressed |
U% | Clear the key logger |
YESNO | Wait until either "Y" or "N" is pressed |
ZEKTRAN | Clear the key logger |
Loader
| |
AllowJoystick (Loader) | An unused routine to check the joysticks and configure the title screen to check for the joystick fire button |
BEGIN | Initialise the configuration variables and start the game |
COLD | Initialise the screen mode, clear memory and set up interrupt handlers |
CopyCode2 (Loader) | Copy CODE2 from $4000-$6FFF to $9000-$BFFF |
CopyTrackSector (Loader) | Copy the track/sector list from the disk buffer to trackSector |
DecrementFileSize (Loader) | Decrement the file size in fileSize(1 0) by 1 |
Elite loader (Loader) | Load the SCRN and ELB1 binaries and run the game |
ENTRY | An entry point at the start of the game binary |
LoadFile (Loader) | Load a multi-sector file |
NMIpissoff | Acknowledge NMI interrupts and ignore them |
S% | Checksum, decrypt and unscramble the main game code, and start the game |
SetFilename (Loader) | Set the filename in comnam to ELB1 |
SetLoadVariables1 (Loader) | Configure the file load variables for loading the SCRN file |
SetLoadVariables2 (Loader) | Configure the file load variables for loading the ELB1 file |
Main loop
| |
FRCE | The entry point for the main game loop if we want to jump straight to a specific screen, by pretending to "press" a key, in which case A contains the ASCII code of the key we want to "press" |
GOIN | We jump here from part 3 of the main flight loop if the docking computer is activated by pressing "C" |
M% | The entry point for the main flight loop |
Main flight loop (Part 1 of 16) | Seed the random number generator |
Main flight loop (Part 2 of 16) | Calculate the alpha and beta angles from the current pitch and roll of our ship |
Main flight loop (Part 3 of 16) | Scan for flight keys and process the results |
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 flight loop (Part 5 of 16) | For each nearby ship: If an energy bomb has been set off, potentially kill this ship |
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 flight loop (Part 7 of 16) | For each nearby ship: Check whether we are docking, scooping or colliding with it |
Main flight loop (Part 8 of 16) | For each nearby ship: Process us potentially scooping this item |
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 flight loop (Part 10 of 16) | For each nearby ship: Remove if scooped, or process collisions |
Main flight loop (Part 11 of 16) | For each nearby ship: Process missile lock and firing our laser |
Main flight loop (Part 12 of 16) | For each nearby ship: Draw the ship, remove if killed, loop back |
Main flight loop (Part 13 of 16) | Show energy bomb effect, charge shields and energy banks |
Main flight loop (Part 14 of 16) | Spawn a space station if we are close enough to the planet |
Main flight loop (Part 15 of 16) | Perform altitude checks with the planet and sun and process fuel scooping if appropriate |
Main flight loop (Part 16 of 16) | Process laser pulsing, E.C.M. energy drain, call stardust routine |
Main game loop (Part 1 of 6) | Spawn a trader (a Cobra Mk III, Python, Boa or Anaconda) |
Main game loop (Part 2 of 6) | Call the main flight loop, and potentially spawn a trader, an asteroid, or a cargo canister |
Main game loop (Part 3 of 6) | Potentially spawn a cop, particularly if we've been bad |
Main game loop (Part 4 of 6) | Potentially spawn a lone bounty hunter, a Thargoid, or up to four pirates |
Main game loop (Part 5 of 6) | Cool down lasers, make calls to update the dashboard |
Main game loop (Part 6 of 6) | Process non-flight key presses (docked keys) |
MAL1 | Marks the beginning of the ship analysis loop, so we can jump back here from part 12 of the main flight loop to work our way through each ship in the local bubble. We also jump back here when a ship is removed from the bubble, so we can continue processing from the next ship |
me3 | Used by me2 to jump back into the main game loop after printing an in-flight message |
MLOOP | The entry point for the main game loop. This entry point comes after the call to the main flight loop and spawning routines, so it marks the start of the main game loop for when we are docked (as we don't need to call the main flight loop or spawning routines if we aren't in space) |
TT100 | The entry point for the start of the main game loop, which calls the main flight loop and the moves into the spawning routine |
Market
| |
BAY2 | Jump into the main loop at FRCE, setting the key "pressed" to the Inventory key |
dn | Print the amount of money we have left in the cash pot, then make a short, high beep and delay for 1 second |
gnum | Get a number from the keyboard |
NWDAV4 | Print an "ITEM?" error, make a beep and rejoin the TT210 routine |
NWDAVxx | Used to rejoin this routine from the call to NWDAV4 |
tnpr | Work out if we have space for a specific amount of cargo |
tnpr1 | Work out if we have space for one tonne of cargo |
TT151 | Print the name, price and availability of a market item |
TT152 | Print the unit ("t", "kg" or "g") for a market item |
TT160 | Print "t" (for tonne) and a space |
TT161 | Print "kg" (for kilograms) |
TT163 | Print the headers for the table of market prices |
TT167 | Show the Market Price screen |
TT16a | Print "g" (for grams) |
TT208 | Show the Sell Cargo screen |
TT210 | Show a list of current cargo in our hold, optionally to sell |
TT213 | Show the Inventory screen |
TT219 | Show the Buy Cargo screen |
var | Calculate QQ19+3 = economy * |economic_factor| |
Maths (Arithmetic)
| |
ADD | Calculate (A X) = (A P) + (S R) |
COR1 | Contains an RTS |
DORND | Generate random numbers |
DORND2 | Make sure the C flag doesn't affect the outcome |
DV41 | Calculate (P R) = 256 * DELTA / A |
DV42 | Calculate (P R) = 256 * DELTA / z_hi |
DVID3B2 | Calculate K(3 2 1 0) = (A P+1 P) / (z_sign z_hi z_lo) |
DVID4 | Calculate (P R) = 256 * A / Q |
DVIDT | Calculate (P+1 A) = (A P) / Q |
FMLTU | Calculate A = A * Q / 256 |
FMLTU2 | Calculate A = K * sin(A) |
GC2 | Calculate (Y X) = (A P) * 4 |
GCASH | Calculate (Y X) = P * Q * 4 |
LCASH | Subtract an amount of cash from the cash pot |
LL120 | Calculate (Y X) = (S x1_lo) * XX12+2 or (S x1_lo) / XX12+2 |
LL121 | Calculate (Y X) = (S R) / Q and set the sign to the opposite of the top byte on the stack |
LL122 | Calculate (Y X) = (S R) * Q and set the sign to the opposite of the top byte on the stack |
LL123 | Calculate (Y X) = (S R) / XX12+2 or (S R) * XX12+2 |
LL128 | Contains an RTS |
LL129 | Calculate Q = XX12+2, A = S EOR XX12+3 and (S R) = |S R| |
LL133 | Negate (Y X) and return from the subroutine LL128 Contains an RTS |
LL28 | Calculate R = 256 * A / Q |
LL28+4 | Skips the A >= Q check and always returns with C flag cleared, so this can be called if we know the division will work |
LL31 | Skips the A >= Q check and does not set the R counter, so this can be used for jumping straight into the division loop if R is already set to 254 and we know the division will work |
LL38 | Calculate (S A) = (S R) + (A Q) |
LL5 | Calculate Q = SQRT(R Q) |
LL61 | Calculate (U R) = 256 * A / Q |
LL62 | Calculate 128 - (U R) |
MAD | Calculate (A X) = Q * A + (S R) |
MAS3 | Calculate A = x_hi^2 + y_hi^2 + z_hi^2 in the K% block |
MCASH | Add an amount of cash to the cash pot |
MLS1 | Calculate (A P) = ALP1 * A |
MLS2 | Calculate (S R) = XX(1 0) and (A P) = A * ALP1 |
MLTU2 | Calculate (A P+1 P) = (A ~P) * Q |
MLTU2-2 | Set Q to X, so this calculates (A P+1 P) = (A ~P) * X |
MLU1 | Calculate Y1 = y_hi and (A P) = |y_hi| * Q for Y-th stardust |
MLU2 | Calculate (A P) = |A| * Q |
MU1 | Copy X into P and A, and clear the C flag |
MU11 | Calculate (A P) = P * X |
MU5 | Set K(3 2 1 0) = (A A A A) and clear the C flag |
MU6 | Set P(1 0) = (A A) |
MULT1 | Calculate (A P) = Q * A |
MULT12 | Calculate (S R) = Q * A |
MULT3 | Calculate K(3 2 1 0) = (A P+1 P) * Q |
MULTS-2 | Calculate (A P) = X * A |
MULTU | Calculate (A P) = P * Q |
MUT1 | Calculate R = XX and (A P) = Q * A |
MUT2 | Calculate (S R) = XX(1 0) and (A P) = Q * A |
MUT3 | An unused routine that does the same as MUT2 |
PIX1 | Calculate (YY+1 SYL+Y) = (A P) + (S R) and draw stardust particle |
SPS2 | Calculate (Y X) = A / 10 |
SQUA | Clear bit 7 of A and calculate (A P) = A * A |
SQUA2 | Calculate (A P) = A * A |
TAS1 | Calculate K3 = (x_sign x_hi x_lo) - V(1 0) |
TIS1 | Calculate (A ?) = (-X * A + (S R)) / 96 |
TIS2 | Calculate A = A / Q |
TIS3 | Calculate -(nosev_1 * roofv_1 + nosev_2 * roofv_2) / nosev_3 |
TT113 | Contains an RTS |
VCSU1 | Calculate vector K3(8 0) = [x y z] - coordinates of the sun or space station |
VCSUB | Calculate vector K3(8 0) = [x y z] - coordinates in (A V) |
Maths (Geometry)
| |
FAROF | Compare x_hi, y_hi and z_hi with 224 |
FAROF2 | Compare x_hi, y_hi and z_hi with A |
LL51 | Calculate the dot product of XX15 and XX16 |
m | Do not include A in the calculation |
MA9 | Contains an RTS |
MAS1 | Add an orientation vector coordinate to an INWK coordinate |
MAS2 | Calculate a cap on the maximum distance to the planet or sun |
MAS4 | Calculate a cap on the maximum distance to a ship |
NO1 | Contains an RTS |
NORM | Normalise the three-coordinate vector in XX15 |
PROJ | Project the current ship or planet onto the screen |
SCALEX | Scale the x-coordinate in A to 32 + 0.75 * A |
SCALEY | Scale the y-coordinate in A to 0.375 * A |
SCALEY2 | Scale the y-coordinate in A to 0.75 * A |
SPS1 | Calculate the vector to the planet and store it in XX15 |
SPS1+1 | A BRK instruction |
SPS3 | Copy a space coordinate from the K% block into K3 |
SPS4 | Calculate the vector to the space station |
TA2 | Calculate the length of the vector in XX15 (ignoring the low coordinates), returning it in Q |
TAS2 | Normalise the three-coordinate vector in K3 |
TAS3 | Calculate the dot product of XX15 and an orientation vector |
TAS4 | Calculate the dot product of XX15 and one of the space station's orientation vectors |
TAS6 | Negate the vector in XX15 so it points in the opposite direction |
TIDY | Orthonormalise the orientation vectors for a ship |
Missions
| |
BAYSTEP | Go to the docking bay (i.e. show the Status Mode screen) |
BRIEF | Start mission 1 and show the mission briefing |
BRIEF2 | Start mission 2 |
BRIEF3 | Receive the briefing and plans for mission 2 |
BRIS | Clear the screen, display "INCOMING MESSAGE" and wait for 2 seconds |
BRP | Print an extended token and show the Status Mode screen |
BRPS | Print the extended token in A, show the Status Mode screen and return from the subroutine |
DEBRIEF | Finish mission 1 |
DEBRIEF2 | Finish mission 2 |
PAS1 | Change to the text view for the Constrictor mission briefing |
PAUSE | Wait until a key is pressed for the Constrictor mission briefing and then clear the text view to show the briefing text |
TBRIEF | Start mission 3 |
THERE | Check whether we are in the Constrictor's system in mission 1 |
Moving
| |
MV40 | Rotate the planet or sun's location in space by the amount of pitch and roll of our ship |
MV45 | Rejoin the MVEIT routine after the rotation, tactics and scanner code |
MVEIT (Part 1 of 9) | Move current ship: Tidy the orientation vectors |
MVEIT (Part 2 of 9) | Move current ship: Call tactics routine, remove ship from scanner |
MVEIT (Part 3 of 9) | Move current ship: Move ship forward according to its speed |
MVEIT (Part 4 of 9) | Move current ship: Apply acceleration to ship's speed as a one-off |
MVEIT (Part 5 of 9) | Move current ship: Rotate ship's location by our pitch and roll |
MVEIT (Part 6 of 9) | Move current ship: Move the ship in space according to our speed |
MVEIT (Part 7 of 9) | Move current ship: Rotate ship's orientation vectors by pitch/roll |
MVEIT (Part 8 of 9) | Move current ship: Rotate ship about itself by its own pitch/roll |
MVEIT (Part 9 of 9) | Move current ship: Redraw on scanner, if it hasn't been destroyed |
MVS4 | Apply pitch and roll to an orientation vector |
MVS5 | Apply a 3.6 degree pitch or roll to an orientation vector |
MVT1 | Calculate (x_sign x_hi x_lo) = (x_sign x_hi x_lo) + (A R) |
MVT1-2 | Clear bits 0-6 of A before entering MVT1 |
MVT3 | Calculate K(3 2 1) = (x_sign x_hi x_lo) + K(3 2 1) |
MVT6 | Calculate (A P+2 P+1) = (x_sign x_hi x_lo) + (A P+2 P+1) |
SFS2 | Move a ship in space along one of the coordinate axes |
Save and load
| |
armwat | Implement the arm move delay |
armwat (Loader) | Implement the arm move delay |
BRKBK | Set the standard BRKV handler for the game |
CHECK | Calculate the checksum for the last saved commander data block |
CHECK2 | Calculate the third checksum for the last saved commander data block (Commodore 64 and Apple II versions only) |
COPYNAME | Copy the last saved commander's name from INWK+5 to comnam and pad out the rest of comnam with spaces, so we can use it as a filename |
diskerror | Print a disk error, make a beep and wait for a key press |
drver2 | Restore the stack pointer and return from the RWTS code with the error number in A and the C flag set to indicate an error |
drver2K | Restore the stack pointer and return from the RWTS code with the error number in A and the C flag set to indicate an error |
drverr | Return from the RWTS code with a "Disk I/O error" |
drverr (Loader) | Return from the RWTS code with a "Disk I/O error" |
FILEPR | Display the currently selected media (disk or tape) |
finde | Search the disk catalog for an empty file entry |
findf | Search the disk catalog for an existing file |
findf (Loader) | Search the disk catalog for an existing file |
getsct | Analyse the VTOC sector to allocate one free sector |
getsct (Loader) | Analyse the VTOC sector to allocate one free sector |
gettsl | Read a file's track/sector list |
gettsl (Loader) | Read a file's track/sector list |
GTNMEW | Fetch the name of a commander file to save or load |
isfull | Check the disk to ensure there are least two free sectors, one for the file's track/sector list and one for the file's contents |
JAMESON | Restore the default JAMESON commander |
LOD | Load a commander file |
LOR | Set the C flag and return from the subroutine |
MUTIL3 | Decrypt the commander file |
MUTILATE | Encrypt the commander file in the buffer at comfil |
OTHERFILEPR | Display the non-selected media (disk or tape) |
prenib | Convert 256 8-bit bytes in buffer into 342 6-bit nibbles in buffr2 |
prenib (Loader) | Convert 256 8-bit bytes in buffer into 342 6-bit nibbles in buffr2 |
prterr | Return from the RWTS code with a "Disk write protected" error |
pstnib | Convert 342 6-bit nibbles in buffr2 into 256 8-bit bytes in buffer |
pstnib (Loader) | Convert 342 6-bit nibbles in buffr2 into 256 8-bit bytes in buffer |
rdaddr | Read a track address field |
rdaddr (Loader) | Read a track address field |
rdrght | Check that this is the correct track |
rdrght (Loader) | Check that this is the correct track |
read | Read a sector's worth of data into the buffr2 buffer |
read (Loader) | Read a sector's worth of data into the buffr2 buffer |
rentry | Search the disk catalog for an existing file or an empty file entry |
rentry (Loader) | Search the disk catalog for an existing file or an empty file entry |
rfile | Read a commander file from a DOS disk into the buffer |
rfile3 | Contains an RTS |
rsect | Read a specific sector from disk into the buffer |
rsect (Loader) | Read a specific sector from disk into the buffer |
rttrk | Read or write a sector on the current track |
rttrk (Loader) | Read or write a sector on the current track |
rttrk3 | Successfully return from the RWTS code with no error reported |
rttrk3 (Loader) | Successfully return from the RWTS code with no error reported |
rttrk4 | Turn off the disk motor and return from the RWTS code with the error number in A and the error status in the C flag |
rttrk4 (Loader) | Turn off the disk motor and return from the RWTS code with the error number in A and the error status in the C flag |
rvtoc | Read the VTOC sector into the buffer |
rvtoc (Loader) | Read the VTOC sector into the buffer |
rwts | Read or write a specific sector |
rwts (Loader) | Read or write a specific sector |
seek | Fast seek routine |
seek (Loader) | Fast seek routine |
SVE | Display the disk access menu and process saving of commander files |
TR1 | Copy the last saved commander's name from NA% to INWK |
TRNME | Copy the last saved commander's name from INWK to NA% |
trytr4 | Entry point for track errors, so we can try reading it again (must have the status flags on the stack with the C flag set) |
trytr4 (Loader) | Entry point for track errors, so we can try reading it again (must have the status flags on the stack with the C flag set) |
trytr5 | Re-entry point for the loop from the rdrght subroutine, for when we need to re-calibrate |
trytr5 (Loader) | Re-entry point for the loop from the rdrght subroutine, for when we need to re-calibrate |
trytr6 | Re-entry point for the loop from the rdrght subroutine, for when we need to re-seek |
trytr6 (Loader) | Re-entry point for the loop from the rdrght subroutine, for when we need to re-seek |
trytrk | Try finding a specific track on the disk |
trytrk (Loader) | Try finding a specific track on the disk |
UNMUTILATE | Decrypt the commander file in the buffer at comfil |
wbyte | Write one byte to disk |
wbyte (Loader) | Write one byte to disk |
wbyte2 | Wait for seven cycles before writing instead of nine (this is WNIBL7 in the original source) |
wbyte3 | Write straight away without waiting (this is WNIBL in the original source) |
wfile | Write a commander file from the buffer to a DOS disk |
write | Write a sector's worth of data from the buffr2 buffer to the current track and sector |
write (Loader) | Write a sector's worth of data from the buffr2 buffer to the current track and sector |
wsect | Write a specific sector from the buffer to disk |
wsect (Loader) | Write a specific sector from the buffer to disk |
wsect2 | Read or write a sector, depending on the value of the C flag (clear = read, set = write) |
wsect2 (Loader) | Read or write a sector, depending on the value of the C flag (clear = read, set = write) |
Sound
| |
BEEP | Make a short, high beep |
BELL | Make a standard system beep |
BOOP | Make a long, low beep |
CLICK | Toggle the state of the speaker (i.e. move it in or out) to make a single click |
ECMOF | Switch off the E.C.M. |
EXNO | Make the sound of a laser strike or ship explosion |
EXNO3 | Make the sound of a collision, or an exploding cargo canister or missile |
LASNOISE | Make the sound of our laser firing or the sound of us being hit by lasers |
LASNOISE2 | An unused routine that makes the sound of the energy bomb going off |
SOBEEP | Make a beep as follows: * X = the period of the beep (a bigger value means a lower pitch) |
SOBLIP | Make the sound of the hyperspace drive being engaged, or the sound of the E.C.M. |
SOBOMB | Make the sound of an energy bomb going off |
SOEXPL | Make an explosion sound |
SOHISS | Make the sound of a launch from the station, hyperspace or missile launch |
SOUR | Contains an RTS |
Stardust
| |
FLIP | Reflect the stardust particles in the screen diagonal and redraw the stardust field |
nWq | Create a random cloud of stardust |
NWSTARS | Initialise the stardust field |
STARS | The main routine for processing the stardust |
STARS1 | Process the stardust for the front view |
STARS2 | Process the stardust for the left or right view |
STARS6 | Process the stardust for the rear view |
Start and end
| |
BR1 (Part 1 of 2) | Show the "Load New Commander (Y/N)?" screen and start the game |
BR1 (Part 2 of 2) | Show the "Press Fire or Space, Commander" screen and start the game |
DEATH | Display the death screen |
DEATH2 | Reset most of the game and restart from the title screen |
DFAULT | Reset the current commander data block to the last saved commander |
QU5 | Restart the game using the last saved commander without asking whether to load a new commander file |
RES2 | Reset a number of flight variables and workspaces |
RESET | Reset most variables |
TITLE | Display a title screen with a rotating ship and prompt |
TT170 | Main entry point for the Elite game code |
Status
| |
BAD | Calculate how bad we have been |
BAY | Go to the docking bay (i.e. show the Status Mode screen) |
cmn | Print the commander's name |
cmn-1 | Contains an RTS |
csh | Print the current amount of cash |
EXNO2 | Process us making a kill |
fwl | Print fuel and cash levels |
STATUS | Show the Status Mode screen |
Tactics
| |
ANGRY | Make a ship hostile |
fq1 | Used to add a cargo canister to the universe |
FR1 | Display the "missile jammed" message |
FR1-2 | Clear the C flag and return from the subroutine |
FRMIS | Fire a missile from our ship |
FRS1 | Launch a ship straight ahead of us, below the laser sights |
GOPL | Make the ship head towards the planet |
HI1 | Contains an RTS |
HITCH | Work out if the ship in INWK is in our crosshairs |
SFRMIS | Add an enemy missile to our local bubble of universe |
TA151 | Make the ship head towards the planet TA9-1 Contains an RTS |
TA9-1 | Contains an RTS |
TACTICS (Part 1 of 7) | Apply tactics: Process missiles, both enemy missiles and our own |
TACTICS (Part 2 of 7) | Apply tactics: Escape pod, station, lone Thargon, safe-zone pirate |
TACTICS (Part 3 of 7) | Apply tactics: Calculate dot product to determine ship's aim |
TACTICS (Part 4 of 7) | Apply tactics: Check energy levels, maybe launch escape pod if low |
TACTICS (Part 5 of 7) | Apply tactics: Consider whether to launch a missile at us |
TACTICS (Part 6 of 7) | Apply tactics: Consider firing a laser at us, if aim is true |
TACTICS (Part 7 of 7) | Apply tactics: Set pitch, roll, and acceleration |
yetanotherrts | Contains an RTS |
Text
| |
BPRNT | Print a 32-bit number, left-padded to a specific number of digits, with an optional decimal point |
CHPR | Print a character at the text cursor by poking into screen memory |
CHPR2 | Character print vector handler |
crlf | Tab to column 21 and print a colon |
DASC | DASC does exactly the same as TT26 and prints a character at the text cursor, with support for verified text in extended tokens |
DETOK | Print an extended recursive token from the TKN1 token table |
DETOK2 | Print an extended text token (1-255) |
DETOK3 | Print an extended recursive token from the RUTOK token table |
dn2 | Make a low, long beep and delay for 0.5 seconds |
DOXC | Move the text cursor to a specific column |
DOYC | Move the text cursor to a specific row |
DTEN | Print recursive token number X from the token table pointed to by (A V), used to print tokens from the RUTOK table via calls to DETOK3 |
DTS | Print a single letter in the correct case |
ex | Print a recursive token |
FEED | Print a newline |
INCYC | Move the text cursor to the next row |
letter | Draw a character in the high-resolution screen mode using the game font |
letter2 | Draw a character or indicator bulb bitmap in the high-resolution screen mode |
MT1 | Switch to ALL CAPS when printing extended tokens |
MT13 | Switch to lower case when printing extended tokens |
MT14 | Switch to justified text when printing extended tokens |
MT15 | Switch to left-aligned text when printing extended tokens |
MT16 | Print the character in variable DTW7 |
MT17 | Print the selected system's adjective, e.g. Lavian for Lave |
MT18 | Print a random 1-8 letter word in Sentence Case |
MT19 | Capitalise the next letter |
MT2 | Switch to Sentence Case when printing extended tokens |
MT23 | Move to row 9 and switch to lower case when printing extended tokens |
MT26 | Fetch a line of text from the keyboard |
MT27 | Print the captain's name during mission briefings |
MT28 | Print the location hint during the mission 1 briefing |
MT29 | Move to row 5 and switch to lower case when printing extended tokens |
MT5 | Switch to extended tokens |
MT6 | Switch to standard tokens in Sentence Case |
MT8 | Tab to column 6 and start a new word when printing extended tokens |
MT9 | Clear the screen and set the current view type to 1 |
plf | Print a text token followed by a newline |
plf2 | Print text followed by a newline and indent of 6 characters |
pr2 | Print an 8-bit number, left-padded to 3 digits, and optional point |
pr2+2 | Print the 8-bit number in X to the number of digits in A |
pr5 | Print a 16-bit number, left-padded to 5 digits, and optional point |
pr6 | Print 16-bit number, left-padded to 5 digits, no point |
prq | Print a text token followed by a question mark |
prq+3 | Print a question mark |
qw | Print a recursive token in the range 128-145 |
R5 | Make a beep and jump back into the character-printing routine at CHPR |
RR4 | Restore the registers and return from the subroutine RR6 A re-entry point from the RR5 routine after we print the character in A in the text screen mode |
RR5 | Print a character in the text screen mode |
RR6 | A re-entry point from the RR5 routine after we print the character in A in the text screen mode |
RRafter | A re-entry point from the clss routine to print the character in A |
SETXC | Move the text cursor to a specific column |
SETYC | Move the text cursor to a specific row |
spc | Print a text token followed by a space |
TT11 | Print a 16-bit number, left-padded to n digits, and optional point |
TT162 | Print a space |
TT162+2 | Jump to TT27 to print the text token in A |
TT26 | Print a character at the text cursor, with support for verified text in extended tokens |
TT27 | Print a text token |
TT41 | Print a letter according to Sentence Case |
TT42 | Print a letter in lower case |
TT43 | Print a two-letter token or recursive token 0-95 |
TT44 | Jumps to TT26 to print the character in A (used to enable us to use a branch instruction to jump to TT26) |
TT45 | Print a letter in lower case |
TT46 | Print a character and switch to capitals |
TT48 | Contains an RTS |
TT60 | Print a text token and a paragraph break |
TT67 | Print a newline |
TT67K | Print a newline |
TT68 | Print a text token followed by a colon |
TT69 | Set Sentence Case and print a newline |
TT73 | Print a colon |
TT74 | Print a character |
TTX69 | Print a paragraph break |
VOWEL | Test whether a character is a vowel |
WHITETEXT | Switch to white text |
Tube
| |
coolkey | Clear the C flag and return from the subroutine |
newosrdch | The custom OSRDCH routine for reading characters |
Universe
| |
cpl | Print the selected system name |
GINF | Fetch the address of a ship's data block into INF |
GTHG | Spawn a Thargoid ship and a Thargon companion |
GVL | Calculate the availability of market items |
hy5 | Contains an RTS |
hyp1 | Process a jump to the system closest to (QQ9, QQ10) |
hyp1+3 | Jump straight to the system at (QQ9, QQ10) without first calculating which system is closest. We do this if we already know that (QQ9, QQ10) points to a system |
hyR | Contains an RTS |
jmp | Set the current system to the selected system |
KILLSHP | Remove a ship from our local bubble of universe |
KS1 | Remove the current ship from our local bubble of universe |
KS2 | Check the local bubble for missiles with target lock |
KS3 | Set the SLSP ship line heap pointer after shuffling ship slots |
KS4 | Remove the space station and replace it with the sun |
NwS1 | Flip the sign and double an INWK byte |
NWSHP | Add a new ship to our local bubble of universe |
NWSPS | Add a new space station to our local bubble of universe |
oh | Contains an RTS SPIN2 Remove any randomness: spawn cargo of a specific type (given in X), and always spawn the number given in A |
PDESC | Print the system's extended description or a mission 1 directive |
ping | Set the selected system to the current system |
readdistnce | Calculate the distance between the system with galactic coordinates (A, QQ15+1) and the system at (QQ0, QQ1), returning the result in QQ8(1 0) |
SFS1 | Spawn a child ship from the current (parent) ship |
SFS1-2 | Add a missile to the local bubble that has AI enabled, is hostile, but has no E.C.M. |
SOLAR | Set up various aspects of arriving in a new system |
SOS1 | Update the missile indicators, set up the planet data block |
SPIN | Randomly spawn cargo from a destroyed ship |
SPIN2 | Remove any randomness: spawn cargo of a specific type (given in X), and always spawn the number given in A |
tal | Print the current galaxy number |
TT111 | Set the current system to the nearest system to a point |
TT111-1 | Contains an RTS readdistnce Calculate the distance between the system with galactic coordinates (A, QQ15+1) and the system at (QQ0, QQ1), returning the result in QQ8(1 0) |
TT146 | Print the distance to the selected system in light years |
TT20 | Twist the selected system's seeds four times |
TT24 | Calculate system data from the system seeds |
TT25 | Show the Data on System screen |
TT54 | Twist the selected system's seeds |
TT70 | Display "MAINLY " and jump to TT72 |
TT72 | Used by TT70 to re-enter the routine after displaying "MAINLY" for the economy type |
TT81 | Set the selected system's seeds to those of system 0 |
ypl | Print the current system name |
ypl-1 | Contains an RTS |
Ze | Initialise the INWK workspace to a hostile ship |
ZINF | Reset the INWK workspace and orientation vectors |
Utility routines
| |
backtonormal | Disable the keyboard, set the SVN flag to 0, and return with A = 0 |
BRBR | The standard BRKV handler for the game |
CLDELAY | Delay by iterating through 5 * 256 (1280) empty loops |
DEEOR | Unscramble the main code |
DEEORS | Decrypt a multi-page block of memory |
DELAY | Wait for a specified time, measured in loop iterations |
ENTRY (Transfer program) | Copy the second block of the game code, between CODE2 and STORE, into bank-switched RAM at $D000 |
mvbllop | Only copy Y bytes, rather than a whole page |
mvblockK | Copy a specific number of pages in memory |
SWAPPZERO | An unused routine that swaps bytes in and out of zero page |
ZEBC | Zero-fill pages $B and $C |
ZERO | Reset the local bubble of universe and ship status |
ZES1 | Zero-fill the page whose number is in X |
ZES1k | Zero-fill the page whose number is in X |
ZES2 | Zero-fill a specific page |
ZES2k | Zero-fill a specific page |
ZESNEW | Zero-fill memory from SC(1 0) to the end of the page |