Skip to navigation

BBC Micro Elite

List of all subroutines

Charts
------

  • hm - Select the closest system and redraw the chart crosshairs
  • 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
  • TT22 - Show the Long-range Chart (red key f4)
  • TT23 - Show the Short-range Chart (red key f5)

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

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
  • DIL2 - Update the roll or pitch indicator on the dashboard
  • DILX - Update a bar-based indicator on the dashboard
  • DOT - Draw a dot on the compass
  • ECBLB - Light up the E.C.M. indicator bulb ("E") on the dashboard
  • ECBLB2 - Start up the E.C.M. (indicator, start countdown and make sound)
  • MSBAR - Draw a specific indicator in the dashboard's missile bar
  • msblob - Display the dashboard's missile indicators in green
  • PZW - Fetch the current dashboard colours, to support flashing
  • 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 a circle will fit on-screen
  • CIRCLE - Draw a circle for the planet
  • CIRCLE2 - Draw a circle (for the planet or chart)
  • 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
-------------

  • EDGES - Draw a horizontal line given a centre and a half-width
  • 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
  • LL118 - Move a point along a line until it is on-screen
  • 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
  • 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
  • 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 a horizontal line at row 19 to box it in
  • NLIN4 - Draw a horizontal line at pixel row 19 to box in a title
  • TT15 - Draw a set of crosshairs

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

  • CPIX2 - Draw a single-height dot on the dashboard
  • CPIX4 - Draw a double-height dot on the dashboard
  • PIX (Loader) - Draw a single pixel at a specific coordinate
  • PIXEL - Draw a 1-pixel dot, 2-pixel dash or 4-pixel square
  • PIXEL2 - Draw a stardust particle relative to the screen centre
  • PX3 - Plot a single pixel at (X, Y) within a character block

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

  • PL2 - Remove the planet or sun from the screen
  • PL21 - Return from a planet/sun-drawing routine with a failure flag
  • PL9 (Part 1 of 3) - Draw the planet, with either an equator and meridian, or a crater
  • PL9 (Part 2 of 3) - Draw the planet's equator and meridian
  • PL9 (Part 3 of 3) - Draw the planet's crater
  • PLANET - Draw the planet or sun
  • PLL1 (Loader) - Draw Saturn on the loading screen
  • PLS1 - Calculate (Y A) = nosev_x / z
  • PLS2 - Draw a half-circle
  • PLS22 - Draw a circle or half-circle
  • PLS3 - Calculate (Y A P) = 222 * roofv_x / z
  • PLS4 - Calculate CNT2 = arctan(P / A) / 4
  • PLS5 - Calculate roofv_x / z and roofv_y / z
  • PLS6 - Calculate (X K) = (A P) / (z_sign z_hi z_lo)
  • WPLS2 - Remove the planet from the screen

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

  • DOEXP - Draw an exploding ship
  • LL9 (Part 1 of 11) - Draw ship: Check if ship is exploding, check if ship is in front
  • LL9 (Part 10 of 11) - Draw ship: Calculate the visibility of each of the ship's edges
  • LL9 (Part 11 of 11) - Draw ship: Draw all the visible edges from the ship line heap
  • LL9 (Part 2 of 11) - Draw ship: Check if ship is in field of view, close enough to draw
  • LL9 (Part 3 of 11) - Draw ship: Set up orientation vector, ship coordinate variables
  • LL9 (Part 4 of 11) - Draw ship: Set visibility for exploding ship (all faces visible)
  • LL9 (Part 5 of 11) - Draw ship: Calculate the visibility of each of the ship's faces
  • LL9 (Part 6 of 11) - Draw ship: Calculate the visibility of each of the ship's vertices
  • LL9 (Part 7 of 11) - Draw ship: Calculate the visibility of each of the ship's vertices
  • LL9 (Part 8 of 11) - Draw ship: Calculate the screen coordinates of visible vertices
  • LL9 (Part 9 of 11) - Draw ship: Draw laser beams if the ship is firing its laser at us
  • PROJ - Project the current ship onto the screen
  • SHPPT - Draw a distant ship as a point rather than a full wireframe

Drawing suns
------------

  • FLFLLS - Reset the sun line heap
  • SUN (Part 1 of 4) - Draw the sun: Set up all the variables needed
  • SUN (Part 2 of 4) - Draw the sun: Start from bottom of screen and erase the old sun
  • SUN (Part 3 of 4) - Draw the sun: Continue to move up the screen, drawing the new sun
  • SUN (Part 4 of 4) - Draw the sun: Continue to the top of the screen, erasing old sun
  • WPLS - Remove the sun from the screen

Equipment
---------

  • eq - Subtract the price of equipment from the cash pot
  • EQSHP - Show the Equip Ship screen (red key f3)
  • prx - Return the price of a piece of equipment
  • qv - Print a menu of the four space views, for buying lasers

Flight
------

  • DENGY - Drain some energy from the energy banks
  • ESCAPE - Launch our escape pod
  • Ghy - Perform a galactic hyperspace jump
  • hy6 - Print a message to say no hyperspacing inside the station
  • hyp - Start the hyperspace process
  • LOOK1 - Initialise the space view
  • MJP - Process a mis-jump into witchspace
  • OOPS - Take some damage
  • OUCH - Potentially lose cargo or equipment following damage
  • PLUT - Flip the coordinate axes for the four different views
  • SESCP - Spawn an escape pod from the current (parent) ship
  • SHD - Charge a shield and drain some energy from the energy banks
  • TT110 - Launch from a station or show the front space view
  • TT18 - Try to initiate a jump into hyperspace
  • WARP - Perform an in-system jump
  • wW - Start a hyperspace countdown

Inventory
---------

  • TT210 - Show a list of current cargo in our hold, optionally to sell
  • TT213 - Show the Inventory screen (red key f9)
  • TT214 - Ask a question with a "Y/N?" prompt and return the response

Keyboard
--------

  • CTRL - Scan the keyboard to see if CTRL is currently pressed
  • DK4 - Scan for pause, configuration and secondary flight keys
  • DKJ1 - Read joystick and flight controls
  • DKS1 - Scan the keyboard for a flight key
  • DKS2 - Read the joystick position
  • DKS3 - Toggle a configuration setting and emit a beep
  • DKS4 - Scan the keyboard to see if a specific key is being pressed
  • DOKEY - Scan for the seven primary flight controls
  • RDKEY - Scan the keyboard for a specific key
  • TT102 - Process function key, save, hyperspace and chart key presses
  • TT17 - Scan the keyboard for cursor key or joystick movement
  • TT217 - Scan the keyboard until a key is pressed
  • U% - Clear the key logger (from KY1 through KY19)

Loader
------

Main loop
---------

Market
------

  • gnum - Get a number from the keyboard
  • tnpr - Work out if we have space for a specific amount 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 (red key f7)
  • TT16a - Print "g" (for grams)
  • TT208 - Show the Sell Cargo screen (red key f2)
  • TT219 - Show the Buy Cargo screen (red key f1)
  • var - Calculate QQ19+3 = economy * |economic_factor|

Maths (Arithmetic)
------------------

  • ADD - Calculate (A X) = (A P) + (S R)
  • 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
  • LL123 - Calculate (Y X) = (S R) / XX12+2 or (S R) * XX12+2
  • LL129 - Calculate Q = XX12+2, A = S EOR XX12+3 and (S R) = |S R|
  • LL28 - Calculate R = 256 * A / Q
  • 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
  • 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 flGag
  • 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
  • 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 - Unused routine that does the same as MUT2
  • PIX1 - Calculate (YY+1 SYL+Y) = (A P) + (S R) and draw stardust particle
  • ROOT (Loader) - Calculate ZP = SQRT(ZP(1 0))
  • SPS2 - Calculate (Y X) = A / 10
  • SQUA - Clear bit 7 of A and calculate (A P) = A * A
  • SQUA2 - Calculate (A P) = A * A
  • SQUA2 (Loader) - 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
  • Unused duplicate of MULTU - Unused duplicate of the MULTU routine

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

  • ARCTAN - Calculate A = arctan(P / Q)
  • 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
  • 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
  • NORM - Normalise the three-coordinate vector in XX15
  • SPS1 - Calculate the vector to the planet and store it in XX15
  • SPS3 - Copy a space coordinate from the K% block into K3
  • SPS4 - Calculate the vector to the space station
  • TAS2 - Normalise the three-coordinate vector in K3
  • TAS3 - Calculate the dot product of XX15 and an orientation vector
  • TIDY - Orthonormalise the orientation vectors for a ship

Moving
------

  • MV40 - Rotate the planet or sun by our ship's pitch and roll
  • 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)
  • 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
-------------

  • CHECK - Calculate the checksum for the last saved commander data block
  • GTNME - Get the commander's name
  • LOD - Load a commander file
  • QUS1 - Save or load the commander file
  • SVE - Save the commander file
  • TR1 - Copy the last saved commander's name from NA% to INWK
  • TRNME - Copy the last saved commander's name from INWK to NA%

Screen mode
-----------

  • DET1 - Hide the dashboard (for when we die)
  • IRQ1 - The main screen-mode interrupt handler (IRQ1V points here)
  • IRQ1 (Loader) - The loader's screen-mode interrupt handler (IRQ1V points here)
  • WSCAN - Wait for the vertical sync

Sound
-----

  • BEEP - Make a short, high beep
  • BELL - Make a beep sound
  • ECMOF - Switch off the E.C.M.
  • EXNO - Make the sound of a laser strike or ship explosion
  • EXNO2 - Process us making a kill
  • EXNO3 - Make an explosion sound
  • NO3 - Make a sound from a prepared sound block
  • NOISE - Make the sound whose number is in A
  • NOS1 - Prepare a sound block

Stardust
--------

  • FLIP - Reflect the stardust particles in the screen diagonal
  • 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
-------------

  • DEATH - Display the death screen
  • DEATH2 - Reset most of the game and restart from the title screen
  • RES2 - Reset a number of flight variables and workspaces
  • RES4 - Reset shields and energy banks and lots of flight variables
  • 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)
  • STATUS - Show the Status Mode screen (red key f8)

Tactics
-------

  • ANGRY - Make a ship hostile
  • FR1 - Display the "missile jammed" message
  • FRMIS - Fire a missile from our ship
  • FRS1 - Launch a ship straight ahead of us, below the laser sights
  • HITCH - Work out if the ship in INWK is in our crosshairs
  • SFRMIS - Add an enemy missile to our local bubble of universe
  • 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

Text
----

  • BPRNT - Print a 32-bit number, left-padded to n digits, and optional point
  • cmn - Print the commander's name
  • cpl - Print the selected system name
  • crlf - Tab to column 21 and print a colon
  • csh - Print the current amount of cash
  • dn - Print the amount of cash and beep
  • dn2 - Make a short, high beep and delay for 1 second
  • ee3 - Print the hyperspace countdown in the top-left of the screen
  • ex - Print a recursive token
  • fwl - Print fuel and cash levels
  • 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
  • ou2 - Display "E.C.M.SYSTEM DESTROYED" as an in-flight message
  • ou3 - Display "FUEL SCOOPS DESTROYED" as an in-flight message
  • 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
  • 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
  • qw - Print a recursive token in the range 128-145
  • spc - Print a text token followed by a space
  • tal - Print the current galaxy numbe
  • TT11 - Print a 16-bit number, left-padded to n digits, and optional point
  • TT146 - Print the distance to the selected system in light years
  • TT147 - Print an error when a system is out of hyperspace range
  • TT162 - Print a space
  • TT26 - Print a character at the text cursor (WRCHV points here)
  • TT26 (Loader) - Print a character at the text cursor (WRCHV points here)
  • 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
  • TT45 - Print a letter in lower case
  • TT46 - Print a character and switch to capitals
  • TT60 - Print a text token and a paragraph break
  • TT67 - Print a newline
  • TT68 - Print a text token followed by a colon
  • TT69 - Set Sentence Case and print a newline
  • TT70 - Display "MAINLY " and jump to TT72
  • TT73 - Print a colon
  • TT74 - Print a character
  • TTX69 - Print a paragraph break
  • ypl - Print the current system name

Universe
--------

  • 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 a market item
  • hyp1 - Process a jump to the system closest to (QQ9, QQ10)
  • 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 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
  • ping - Set the selected system to the current system
  • SFS1 - Spawn a child ship from the current (parent) ship
  • SOLAR - Set up various aspects of arriving in a new system
  • SOS1 - Update the missile indicators, set up the planet data block
  • TT111 - Set the current system to the nearest system to a point
  • TT20 - Twist the selected system's seeds four times
  • TT24 - Calculate system data from the system seeds
  • TT25 - Show the Data on System screen (red key f6)
  • TT54 - Twist the selected system's seeds
  • TT81 - Set the selected system's seeds to those of system 0

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

  • CLYNS - Clear the bottom three text rows of the mode 4 screen
  • command (Loader) - Execute an OS command
  • DELAY - Wait for a specified time, in 1/50s of a second
  • DORND - Generate random numbers
  • DORND (Loader) - Generate random numbers
  • FX200 - Set the behaviour of the Escape and Break keys
  • LYN - Clear most of a row of pixels
  • OSB (Loader) - A convenience routine for calling OSBYTE with Y = 0
  • osprint (Loader) - Print a character
  • TT66 - Clear the screen and set the current view type
  • TTX66 - Clear the top part of the screen and draw a white border
  • Ze - Initialise the INWK workspace to a hostile ship
  • ZERO - Zero-fill pages &9, &A, &B, &C and &D
  • ZES1 - Zero-fill the page whose number is in X
  • ZES2 - Zero-fill a specific page
  • ZINF - Reset the INWK workspace