Bank 7 source (Part 2 of 4)Bank 7 source (Part 4 of 4) Bank 7 source (Part 2 of 4)Bank 7 source (Part 4 of 4) Home page Using this site Home page Start at the very beginning Quick start guide All you need to know to start exploring this site All about this project Project history, building the source and more All about this project About this project The story of how this project came to be Terminology used in this commentary Read this before you explore the source code Building Elite from the source How to build your own working copy of Elite Useful links A collection of links to pages I've found useful during this project Acknowledgements The giants on whose shoulders this project stands Site history A short history of this site's development Site map A top-level map of this website To-do list Code that could benefit from a bit more analysis Playing with the source code Playing 8-bit Elite in the 21st century How to play all the versions of Elite analysed here Deep dive articles Over 100 articles on how Elite weaves its magic Index Index of all deep dive articlesDiscover how Elite works under the hood Deep dives Memory maps Details of memory usage in the different versions Memory maps BBC Micro cassette Elite memory map Memory usage in the classic version of Elite, where space is really tight BBC Micro disc Elite memory map Memory usage in the enhanced disc version of Elite 6502 Second Processor Elite memory map Memory usage in the Tube-based version of Elite BBC Master Elite memory map Memory usage in the smoothest version of Elite Acorn Electron Elite memory map Memory usage in the smallest and most basic version of Elite NES Elite memory map Memory usage in the only console-based version of Elite The main loop The main game loop and task scheduler The main loop Program flow of the main game loop The sequence of events in the main game loop and the main flight loop Scheduling tasks with the main loop counter How the main loop counter controls what we do and when we do it Splitting the main loop in the NES version How the main flight loop is split and shared with the combat demo The split-screen mode Elite's custom and split-screen modes The split-screen mode The split-screen mode in BBC Micro Elite Elite's famous split-screen mode, dissected and explained in detail The split-screen mode in NES Elite How the NES version implements a split-screen mode without hardware timers Simulating the local bubble Spawning and managing ships in our local bubble Simulating the local bubble The local bubble of universe The data structures used to simulate the universe around our ship The elusive Cougar They say it is vanishingly rare... but just how rare is the mysterious Cougar? The space station safe zone Details of the calculations behind the space station safe zone Ship data Ship blueprints and ship data blocks Ship data Ship blueprints Specifications for all the different types of ship in the universe Ship blueprints in the disc version How the disc version loads its ship blueprints into memory Ship data blocks Storing data for each of the ships in the local bubble of universe Simulating the universe Procedural galaxies, system seeds, market prices Simulating the universe Galaxy and system seeds How system data is extracted from the galaxy and system seeds Generating system data The algorithms behind the procedural generation of system data Generating system names Producing system names from twisted seeds and two-letter tokens Twisting the system seeds How the system seeds are twisted to produce entire galaxies of stars Market item prices and availability The algorithms behind the generation of each system's cargo market Moving and rotating in space Pitching, rolling and moving in 3D vector space Moving and rotating in space Pitching and rolling Applying our pitch and roll to another ship's orientation in space Pitching and rolling by a fixed angle How other ships manage to pitch and roll in space Program flow of the ship-moving routine A breakdown of the routine that moves the entire universe around us Rotating the universe What happens to the rest of the universe when we rotate our ship? Orientation vectors The three vectors that determine a ship's orientation in space Tidying orthonormal vectors Making the orientation vectors orthonormal, and why this matters Flying and flight controls Docking, space views and the flight keys Flying and flight controls Docking checks The checks that determine whether we are docking... or just crashing The docking computer How the docking computer steers us home in the enhanced versions of Elite Flipping axes between space views Details of how the different space views are implemented The key logger Supporting concurrent in-flight key presses using a key logger Bolting NES controllers onto the key logger How the NES version simulates a joystick and keyboard Tactics and combat Ranks, weapons and intelligent enemy ships Tactics and combat Combat rank The long, long road from Harmless to Elite In the crosshairs How the game knows whether an enemy is being hit by our laser fire Program flow of the tactics routine How ships and missiles work out attack patterns... or how to run away Advanced tactics with the NEWB flags How the enhanced versions of Elite give their ships a bit more personality The scanner and dashboard The 3D elliptical scanner and other indicators The scanner and dashboard The 3D scanner The maths behind Elite's famous 3D elliptical scanner The dashboard indicators How the bar-based dashboard indicators display their data Drawing pixels Poking pixels directly into screen memory Drawing pixels Drawing monochrome pixels in mode 4 Poking screen memory to display monochrome pixels in the space view Drawing colour pixels in mode 5 Poking screen memory to display colour pixels in the dashboard view Drawing pixels in the Electron version Poking pixels into screen memory in the Acorn Electron version of Elite Drawing pixels in the NES version How the NES version pokes pixels into the console's tile-based screen Extended screen coordinates The extended 16-bit screen coordinate system behind the space view Drawing text Poking text characters into screen memory Drawing text Drawing text How Elite draws text on-screen by poking character bitmaps directly into screen memory Fonts in NES Elite The three different fonts used in the Nintendo version of Elite Drawing lines Line-drawing algorithms and efficient clipping Drawing lines Bresenham's line algorithm The main line-drawing algorithm used to draw non-horizontal lines Line-clipping Efficiently clipping an extended line to the part that's on-screen Drawing lines in the NES version Using tiles as stepping stones when drawing lines on the NES Drawing ships Drawing 3D wireframes and flicker-free ships Drawing ships Drawing ships The main routine for drawing 3D wireframe ships in space Back-face culling How Elite draws solid-looking 3D ships by only drawing visible faces Calculating vertex coordinates Determining whether a ship's vertex is visible or hidden from us Flicker-free ship drawing How the BBC Master version reduces when drawing ships Backporting the flicker-free algorithm Applying the BBC Master's flicker-free algorithm to the other versions Drawing circles and ellipses Circles, ellipses, hyperspace and docking effects Drawing circles and ellipses Drawing circles The routines that draw planets and the hyperspace and docking tunnels The ball line heap How we remember the lines used to draw circles so they can be redrawn Drawing ellipses How Elite draws ellipses for the planet's crater, meridian and equator Drawing planets Craters, meridians and the dots of Saturn Drawing planets Drawing craters The algorithms behind the huge craters of planets like Diso Drawing meridians and equators The algorithms behind the meridians and equators of planets like Lave Drawing Saturn on the loading screen How the loader draws the dot-based Saturn in Elite's epic loading screen Drawing suns and explosions Shimmering suns and glittering explosion clouds Drawing suns and explosions Drawing the sun Drawing and storing the sun, and the systems on the Short-range Chart Drawing explosion clouds Drawing and storing explosion clouds for ships whose luck runs out... Stardust How the tiny particles of moving stardust work Stardust Stardust in the front view The algorithms behind the stardust particles in the front view Stardust in the side views The algorithms behind the stardust particles in the side views Missions The three missions in the 6502 versions of Elite Missions The Constrictor mission Hunting high and low for the stolen Constrictor The Thargoid Plans mission Evading the Thargoid threat in the depths of the third galaxy The Trumbles mission Furry fun in the NES version of Elite Text Text tokenisation and the "goat soup" algorithm Text Printing text tokens Printing recursive text tokens, two-letter tokens and control codes Extended text tokens The extended text token system in the enhanced versions of Elite Extended system descriptions The famous "goat soup" algorithm that generates those strange and wonderful system descriptions Printing decimal numbers How to print big decimal numbers with decimal points and padding Multi-language support in NES Elite How the NES version supports English, German and French text Maths Arithmetic, geometry and random numbers Maths Adding sign-magnitude numbers Doing basic arithmetic with sign-magnitude numbers Calculating square roots The algorithm behind the square root routine Shift-and-add multiplication The main algorithm behind Elite's many multiplication routines Multiplication and division using logarithms Faster multiplication and division routines by using logarithm lookup tables Shift-and-subtract division The main algorithm behind Elite's many division routines The sine, cosine and arctan tables The lookup tables used for the planet-drawing trigonometric functions Generating random numbers The algorithm behind Elite's random number generation routines Saving and loading Commander files and competition codes Saving and loading Commander save files A description of each and every byte in the saved commander file The competition code All the information that's hidden in the Elite competition code 6502 Second Processor Elite Tube APIs, scroll texts, speech support and more 6502 Second Processor Elite 6502 Second Processor Tube communication How the 6502 Second Processor version of Elite talks over the Tube The 6502 Second Processor demo mode All about the Star Wars-esque scroll text in the Tube-based version of Elite The TINA hook Adding your own custom code to the 6502 Second Processor version using TINA Secrets of the Executive version Infinite jumps, retro-futuristic fonts, speech support... and Pizzasoft? NES Elite Elite on the Nintendo Entertainment System NES Elite Comparing NES Elite with the other versions The features that make NES Elite so unique Understanding the NES for Elite The NES architecture and how it applies to Elite Splitting NES Elite across multiple ROM banks Details of the MMC1 controller and the 128K game ROM The pattern and nametable buffers How the NES version achieves its beautifully smooth wireframe graphics Bitplanes in NES Elite Squeezing two patterns into one tile using separate bitplanes Drawing vector graphics using NES tiles The art of the impossible: vector graphics on the NES Views and view types in NES Elite Configuring all the different views in the console version Image and data compression How images and data are compressed in NES Elite Displaying two-layer images The beautiful pixel art of the commander and system images Sprite usage in NES Elite Stardust, scanners, images, crosshairs and more The NES combat demo How the scroll text and combat practice works Auto-playing the combat demo The magic of watching Elite playing itself Sound effects in NES Elite The largest set of sound effects in all the 6502 Elites Music in NES Elite How David Whittaker's music module plays The Blue Danube Elite-A How Angus Duggan modified the original Elite Elite-A Making room for the modifications in Elite-A How Angus Duggan found enough spare memory for Elite-A's modifications Buying and flying ships in Elite-A What it's like to save up for and fly your dream ship in Elite-A Ship blueprints in Elite-A The enhanced logic behind Elite-A's sophisticated ship blueprints system The Encyclopedia Galactica Inside the encyclopedia, Elite-A's most recognisable modification The I.F.F. system Friend or foe? Adding ship information to the 3D scanner Fixing ship positions Why Elite spawns certain ships in certain places, and how Elite-A fixes this Special cargo missions Procedurally generating delivery missions and tracking progress Delta 14b joystick support All the controls of Elite in one single handset - the future is here! Tube communication in Elite-A How the 6502 Second Processor version of Elite-A talks over the Tube The original source files How the original Elite-A source was written, edited and compiled Elite hacks Universe editor, flicker-free, teletext and more Index Index of all Elite hacksA list of all the Elite hacks on this site Elite hacks Elite Compendium The best way to play all the hacked and enhanced versions of Acornsoft Elite Elite Compendium About the Elite Compendium Bringing all the best Elite hacks together in one feature-packed disc Playing the Elite Compendium How to download and play the Elite Compendium Technical information Details of all the hacks and enhancements in the Elite Compendium Elite Universe Editor Create your own Elite universes and "press play" to bring them to life Elite Universe Editor An introduction to the Elite Universe Editor Create your own Elite universes and "press play" to bring them to life Playing the Elite Universe Editor How to download and play the Elite Universe Editor A summary of keys All the keys used in all the different versions of the Elite Universe Editor Instructions for the BBC version Full instructions for the Elite Universe Editor on the BBC Micro and Master Instructions for the Commodore 64 version Full instructions for the Elite Universe Editor on the Commodore 64 Technical information Details of how the Elite Universe Editor works under the bonnet Flicker-free Elite Improved ship drawing on the BBC Micro, Commodore 64 and Commodore Plus/4 Flicker-free Elite An introduction to flicker-free Elite Improved ship drawing on the BBC Micro, Commodore 64 and Commodore Plus/4 Playing flicker-free Elite How to download and play flicker-free Elite, on both the BBC and Commodore Technical information Details of how flicker-free Elite weaves its magic Teletext Elite The disc version of BBC Micro Elite, converted to run in teletext Teletext Elite An introduction to Teletext Elite The disc version of BBC Micro Elite, converted to run in teletext Playing Teletext Elite How to download and play Teletext Elite Instructions for Teletext Elite Full instructions for Teletext Elite on the BBC Micro Technical information Details of how Elite was converted to use teletext Elite over Econet Elite that loads over an Econet network and supports live multiplayer scoreboards Elite over Econet About Elite over Econet Adding Econet support and multiplayer scoreboards Playing Elite over Econet How to download and play Elite over Econet Installing Elite over Econet How to install Elite on an Econet fileserver The Elite multiplayer scoreboard Running multiplayer Elite competitions with a live Econet-based scoreboard Technical information Details of how Elite over Econet works Elite 3D BBC Micro Elite in full anaglyph 3D - just add a pair of fancy coloured glasses Elite 3D About Elite 3D Taking 8-bit Elite into another dimension with anaglyph 3D and coloured specs Playing Elite 3D How to download and play Elite 3D, and how to configure the anaglyph settings Configuring Elite 3D How to configure the anaglyph settings in Elite 3D Technical information Details of how Elite 3D works BBC Micro Elite... with music! The title and docking music from the Commodore 64, shoehorned into BBC Micro Elite BBC Micro Elite... with music! About the musical version of BBC Micro Elite BBC Micro and BBC Master Elite, with added title and docking music Playing musical BBC Micro Elite How to download and play the musical version of BBC Micro Elite Technical information How the Commodore 64's music was ported to Elite on the BBC Micro BBC Master disc Elite The disc version of BBC Micro Elite, converted to run on the BBC Master BBC Master disc Elite About BBC Micro disc Elite on the BBC Master The disc version of BBC Micro Elite, converted to run on the BBC Master Playing BBC Micro disc Elite on the BBC Master How to download and play the original disc version of Elite on the BBC Master Technical information Details of how disc Elite was converted from the BBC Micro to the BBC Master Exploring the source code BBC Micro cassette source code Annotated source of the original version of Elite Version information About the BBC Micro cassette versionInformation on the original version of Elite Different variants of the BBC Micro cassette versionCode variations found in cassette Elite BBC Micro cassette source code by file Map of the source code An overview of how the source code for Elite is structured Annotated original source files The source files in their original structure Game loader Loader source The loading screen, copy protection and setup for the main game Main game Workspaces and configuration The main variable workspaces used in Elite Text tokens Elite's tokenised game text Elite A source Part 1 of the main game code Elite B source Part 2 of the main game code Elite C source Part 3 of the main game code Elite D source Part 4 of the main game code Elite E source Part 5 of the main game code Elite F source Part 6 of the main game code Elite G source Part 7 of the main game code Ship blueprints Data for the 13 different ship designs Big Code File Big Code File source Concatenates the individual source code parts into one big game file BBC Micro cassette source code by category Charts Long-range and short-range galactic charts Subroutines 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 Hiding the Elite code from prying eyes Subroutines BEGIN% (Loader) Single-byte decryption and copying routine, run on the stack CHECKER (Loader) Run checksum checks on tokens, loader and tape block count David7 (Loader) Part of the multi-jump obfuscation code in PROT1 DOMOVE (Loader) * Multi-byte decryption and copying routine, run on the stack doPROT1 (Loader) * Routine to self-modify the loader code LBL (Big Code file) Checksum the two pages of code that were copied from UU% to LE% swine (Loader) Resets the machine if the copy protection detects a problem Variables Authors' names The authors' names and a copyright notice, buried in the code Authors' names (Loader) The authors' names, buried in the code BLOCK (Loader) Addresses for the obfuscated jumps that use RTS not JMP CHECKbyt (Loader) Checksum for the validity of the UU% workspace checksum0 Checksum for the entire main game code CHECKV (Loader) The address of the LBL routine in the decryption header David23 (Loader) Address pointer to the start of the 6502 stack David9 (Loader) Address used as part of the stack-based decryption loop FOOLV (Loader) Part of the AFOOL roundabout obfuscation routine MAINSUM (Loader) Two checksums for the decryption header and text token table MHCA (Loader) Used to set one of the vectors in the copy protection code Dashboard The dials, 3D scanner and compass Subroutines 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 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 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 Variables ECBT The character bitmap for the E.C.M. indicator bulb SPBT The bitmap definition for the space station indicator bulb Drawing circles Hyperspace tunnels, launch rings and planets Subroutines 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) 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 The core line-drawing routines Subroutines 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 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 TT15 Draw a set of crosshairs Variables TWFL Ready-made character rows for the left end of a horizontal line in mode 4 TWFR Ready-made character rows for the right end of a horizontal line in mode 4 Drawing pixels How to plot pixels in various colours Subroutines CPIX2 * Draw a single-height dash 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 Variables CTWOS Ready-made single-pixel character row bytes for mode 5 TWOS Ready-made single-pixel character row bytes for mode 4 TWOS (Loader) Ready-made single-pixel character row bytes for mode 4 TWOS2 Ready-made double-pixel character row bytes for mode 4 Drawing planets Planets with meridians and craters Subroutines 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 (Part 1 of 3) (Loader) Draw Saturn on the loading screen (draw the planet) PLL1 (Part 2 of 3) (Loader) Draw Saturn on the loading screen (draw the stars) PLL1 (Part 3 of 3) (Loader) Draw Saturn on the loading screen (draw the rings) PLS1 Calculate (Y A) = nosev_x / z PLS2 Draw a half-ellipse PLS22 * Draw an ellipse or half-ellipse 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+1 P) / (z_sign z_hi z_lo) WP1 Reset the ball line heap WPLS2 Remove the planet from the screen Variables CNT (Loader) A counter for use in drawing Saturn's planetary body CNT2 (Loader) A counter for use in drawing Saturn's background stars CNT3 (Loader) A counter for use in drawing Saturn's rings Drawing ships The celebrated 3D ship plotting process Subroutines DOEXP * Draw an exploding ship 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 LL9 (Part 11 of 12) Draw ship: Add all visible edges to the ship line heap LL9 (Part 12 of 12) Draw ship: Draw all the visible edges from the ship line heap SHPPT Draw a distant ship as a point rather than a full wireframe Variables SHIP_ASTEROID Ship blueprint for an asteroid SHIP_CANISTER Ship blueprint for a cargo canister SHIP_COBRA_MK_3 Ship blueprint for a Cobra Mk III SHIP_CORIOLIS Ship blueprint for a Coriolis space station SHIP_ESCAPE_POD Ship blueprint for an escape pod SHIP_MAMBA Ship blueprint for a Mamba SHIP_MISSILE Ship blueprint for a missile SHIP_PYTHON Ship blueprint for a Python SHIP_SIDEWINDER Ship blueprint for a Sidewinder SHIP_THARGOID Ship blueprint for a Thargoid mothership SHIP_THARGON Ship blueprint for a Thargon SHIP_VIPER Ship blueprint for a Viper XX21 Ship blueprints lookup table Macros EDGE Macro definition for adding edges to ship blueprints FACE Macro definition for adding faces to ship blueprints VERTEX Macro definition for adding vertices to ship blueprints Drawing suns The epic, shimmering Elite sun Subroutines FLFLLS Reset the sun line heap 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 Drawing the screen The split-screen mode and different screen views Subroutines CLYNS Clear the bottom three text rows of the mode 4 screen DET1 Show or 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) LYN Clear most of a row of pixels TT66 Clear the screen and set the current view type TTX66 Clear the top part of the screen and draw a white border WSCAN Wait for the vertical sync Variables B% (Loader) VDU commands for setting the square mode 4 screen block1 (Loader) Palette data for the two dashboard colour scheme block2 (Loader) Palette data for the space part of the screen TVT1 Palette data for space and the two dashboard colour schemes VEC The original value of the IRQ1 vector Equipment Buying and selling weapons and ship upgrades Subroutines 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 Variables PRXS Equipment prices Flight Docking, hyperspace, views, shields and more Subroutines DENGY Drain some energy from the energy banks ee3 Print the hyperspace countdown in the top-left of the screen ESCAPE Launch our escape pod Ghy Perform a galactic hyperspace jump hy6 Print a message to say there is no hyperspacing allowed inside the station hyp Start the hyperspace process 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 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 WARP * Perform an in-system jump wW Start a hyperspace countdown Keyboard Processing key presses and joysticks Subroutines 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 key presses TT102 * Process function 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 Variables KYTB Lookup table for in-flight keyboard controls Loader The loading screen and system setup Subroutines Elite loader (Part 1 of 6) (Loader) Include binaries for recursive tokens, Python blueprint and images Elite loader (Part 2 of 6) (Loader) Perform a number of OS calls, set up sound, push routines on stack Elite loader (Part 3 of 6) (Loader) Move and decrypt recursive tokens, Python blueprint and images Elite loader (Part 4 of 6) (Loader) Copy more code onto stack, decrypt TUT block, set up IRQ1 handler Elite loader (Part 5 of 6) (Loader) Load main game code, decrypt it, move it to the correct location Elite loader (Part 6 of 6) (Loader) Set up interrupt vectors, calculate checksums, run main game code Main loop The core loop that runs Elite Subroutines 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 peaceful Cobra Mk III) 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 (red function keys, docked keys) Market Market prices, selling, buying and inventory Subroutines 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 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) TT210 Show a list of current cargo in our hold, optionally to sell TT213 * Show the Inventory screen (red key f9) TT219 * Show the Buy Cargo screen (red key f1) var Calculate QQ19+3 = economy * |economic_factor| Variables QQ23 Market prices table Macros ITEM Macro definition for the market prices table Maths (Arithmetic) Addition, subtraction, multiplication, division Subroutines ADD * Calculate (A X) = (A P) + (S R) DORND * Generate random numbers DORND (Loader) * Generate random numbers 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 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 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 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 An unused duplicate of the MULTU routine Maths (Geometry) Vectors, coordinates, dot products and matrices Subroutines 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 PROJ Project the current ship or planet onto the screen 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 Variables ACT Arctan table SNE Sine/cosine table Moving Moving and rotating ships and planets in space Subroutines MV40 Rotate the planet or sun's location in space by the amount of pitch and roll of our ship 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 Commander files and competition codes Subroutines CHECK Calculate the checksum for the last saved commander data block GTNME Fetch the name of a commander file to save or load 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% Variables CHK First checksum byte for the saved commander data file CHK2 Second checksum byte for the saved commander data file NA% The data block for the last saved commander SVN The "saving in progress" flag Sound Explosions, laser fire, hyperspace and more Subroutines BEEP Make a short, high beep BELL Make a standard system beep ECMOF Switch off the E.C.M. EXNO Make the sound of a laser strike or ship explosion 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 Variables E% (Loader) Sound envelope definitions SFX Sound data Macros FNE (Loader) Macro definition for defining a sound envelope Stardust Stardust generation and movement Subroutines 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 The title screen... and the Game Over screen Subroutines 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 QU5 Reset the current commander data block to the last saved commander 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 Showing the commander's status and rank Subroutines 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 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 (red key f8) Tactics AI tactics for enemy ships and missiles Subroutines 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 The game's recursive text tokenisation system Subroutines BPRNT * Print a 32-bit number, left-padded to a specific number of digits, with an optional decimal point crlf Tab to column 21 and print a colon dn2 Make a short, high beep and delay for 1 second ex Print a recursive token 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 TT11 Print a 16-bit number, left-padded to n digits, and optional point TT162 Print a space TT26 * Print a character at the text cursor by poking into screen memory 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 TT73 Print a colon TT74 Print a character TTX69 Print a paragraph break Variables QQ16 The two-letter token lookup table QQ18 The recursive token table for tokens 0-148 RLINE The OSWORD configuration block used to fetch a line of text from the keyboard TENS A constant used when printing large numbers in BPRNT XC (Loader) The x-coordinate of the text cursor YC (Loader) The y-coordinate of the text cursor Macros CHAR Macro definition for characters in the recursive token table CONT Macro definition for control codes in the recursive token table RTOK Macro definition for recursive tokens in the recursive token table TWOK Macro definition for two-letter tokens in the token table Universe Ship spawning, local bubble, system/market data Subroutines 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 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 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 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 tal Print the current galaxy number TT111 Set the current system to the nearest system to a point 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 (red key f6) TT54 * Twist the selected system's seeds TT70 Display "MAINLY " and jump to TT72 TT81 Set the selected system's seeds to those of system 0 ypl Print the current system name Ze Initialise the INWK workspace to a hostile ship ZINF Reset the INWK workspace and orientation vectors Variables UNIV Table of pointers to the local universe's ship data blocks Utility routines Memory/screen clearing, delay routines Subroutines command (Loader) Execute an OS command DELAY Wait for a specified time, in 1/50s of a second FX200 Set the behaviour of the ESCAPE and BREAK keys OSB (Loader) A convenience routine for calling OSBYTE with Y = 0 osprint (Loader) Print a character 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 Variables M2 (Loader) Used for testing the 6522 System VIA status byte in IRQ1 MESS1 (Loader) Contains an OS command string for loading the main game code oscliv (Loader) Contains the address of OSCLIV, for executing OS commands Workspaces Collections of important variables into blocks Workspaces K% * Ship data blocks and ship line heaps S% Vector addresses, compass colour and configuration settings T% Current commander data and stardust data blocks UU% (Loader) Marker for a block that is moved as part of the obfuscation WP Ship slots, variables XX3 Temporary storage space for complex calculations ZP * Lots of important variables are stored in the zero page workspace as it is quicker and more space-efficient to access memory here ZP (Big Code file) * Important variables used by the loader ZP (Loader) * Important variables used by the loader BBC Micro disc source code An enhanced version with missions and more ships Version information About the BBC Micro disc versionInformation on the enhanced version of Elite Different variants of the BBC Micro disc versionCode variations found in disc Elite BBC Micro disc source code by file Map of the source code An overview of how the source code for Elite is structured Annotated original source files The source files in their original structure Game loader Loader 1 source Initial setup and disc copy protection Loader 2 source The mode 7 screen setup for the main game Text tokens Elite's tokenised game text Missile ship blueprint The ship blueprint for the missile Loader 3 source The Saturn loading screen and main game loader Sideways RAM Loader source The main game loader for the sideways RAM variant Main game docked code Docked workspaces The main variable workspaces used when docked Elite A docked source Part 1 of the main docked code Elite B docked source Part 2 of the main docked code Elite C docked source Part 3 of the main docked code Elite D docked source Part 4 of the main docked code Elite E docked source Part 5 of the main docked code Elite F docked source Part 6 of the main docked code Elite G docked source Part 7 of the main docked code Elite H docked source Part 8 of the main docked code Ship hangar blueprints Data for ships in the ship hangar Main game flight code Flight workspaces The main variable workspaces used in flight Elite A flight source Part 1 of the main flight code Elite B flight source Part 2 of the main flight code Elite C flight source Part 3 of the main flight code Elite D flight source Part 4 of the main flight code Elite E flight source Part 5 of the main flight code Elite F flight source Part 6 of the main flight code Elite G flight source Part 7 of the main flight code Elite H flight source Part 8 of the main flight code Ship blueprint files Ship blueprints A source The D.MOA ship blueprints file Ship blueprints B source The D.MOB ship blueprints file Ship blueprints C source The D.MOC ship blueprints file Ship blueprints D source The D.MOD ship blueprints file Ship blueprints E source The D.MOE ship blueprints file Ship blueprints F source The D.MOF ship blueprints file Ship blueprints G source The D.MOG ship blueprints file Ship blueprints H source The D.MOH ship blueprints file Ship blueprints I source The D.MOI ship blueprints file Ship blueprints J source The D.MOJ ship blueprints file Ship blueprints K source The D.MOK ship blueprints file Ship blueprints L source The D.MOL ship blueprints file Ship blueprints M source The D.MOM ship blueprints file Ship blueprints N source The D.MON ship blueprints file Ship blueprints O source The D.MOO ship blueprints file Ship blueprints P source The D.MOP ship blueprints file BBC Micro disc source code by category Charts Long-range and short-range galactic charts Subroutines hm (Docked) Select the closest system and redraw the chart crosshairs hm (Flight) Select the closest system and redraw the chart crosshairs HME2 (Docked) Search the galaxy for a system TT103 (Docked) Draw a small set of crosshairs on a chart TT103 (Flight) Draw a small set of crosshairs on a chart TT105 (Docked) Draw crosshairs on the Short-range Chart, with clipping TT105 (Flight) Draw crosshairs on the Short-range Chart, with clipping TT114 (Flight) Display either the Long-range or Short-range Chart TT123 (Docked) Move galactic coordinates by a signed delta TT123 (Flight) Move galactic coordinates by a signed delta TT16 (Docked) Move the crosshairs on a chart TT16 (Flight) Move the crosshairs on a chart TT22 (Docked) * Show the Long-range Chart (red key f4) TT22 (Flight) * Show the Long-range Chart (red key f4) TT23 (Docked) * Show the Short-range Chart (red key f5) TT23 (Flight) * Show the Short-range Chart (red key f5) Copy protection Hiding the Elite code from prying eyes Subroutines BEGIN (Loader 1) Decrypt the loader code using a rolling EOR that uses the decryption routine itself to seed the decryption CHECK (Loader 3) Calculate a checksum from two 256-byte portions of the loader code LOAD (Loader 1) Load a hidden file from disc (not used in this version as disc protection is disabled) LOAD (Loader 2) This code accesses the disc directly (not used in this version as disc protection is disabled) LOADcode (Loader 2) LOAD routine, bundled up in the loader so it can be moved to &0400 to be run OSBmod (Loader 3) Calculate a checksum on &0F00 to &0FFF (the test is disabled in this version) PROT1 (Loader 3) Part of the CHKSM copy protection checksum calculation PROT2 (Loader 3) Part of the CHKSM copy protection checksum calculation PROT3 (Loader 3) Part of the CHKSM copy protection checksum calculation Unused copy protection routine (Loader 2) This code doesn't appear to be run in this version Variables BLOCK (Loader 1) These bytes are copied and decrypted by the loader routine (not used in this version as disc protection is disabled) Checksum (Docked) Contains a checksum at &55FF that is checked by the loader PARAMS1 (Loader 1) OSWORD parameter block for accessing a specific track on the disc (not used in this version as disc protection is disabled) PARAMS2 (Loader 1) OSWORD parameter block for accessing a specific track on the disc (not used in this version as disc protection is disabled) PARAMS3 (Loader 1) OSWORD parameter block for loading the ELITE3 loader file (not used in this version as disc protection is disabled) Dashboard The dials, 3D scanner and compass Subroutines ABORT (Docked) Disarm missiles and update the dashboard indicators ABORT (Flight) Disarm missiles and update the dashboard indicators ABORT2 (Docked) Set/unset the lock target for a missile and update the dashboard ABORT2 (Flight) Set/unset the lock target for a missile and update the dashboard BULB (Docked) Draw an indicator bulb on the dashboard BULB (Flight) Draw an indicator bulb on the dashboard BUMP2 (Docked) Bump up the value of the pitch or roll dashboard indicator BUMP2 (Flight) Bump up the value of the pitch or roll dashboard indicator cntr (Docked) Apply damping to the pitch or roll dashboard indicator cntr (Flight) Apply damping to the pitch or roll dashboard indicator COMPAS (Flight) * Update the compass DIALS (Part 1 of 4) (Docked) Update the dashboard: speed indicator DIALS (Part 1 of 4) (Flight) Update the dashboard: speed indicator DIALS (Part 2 of 4) (Docked) Update the dashboard: pitch and roll indicators DIALS (Part 2 of 4) (Flight) Update the dashboard: pitch and roll indicators DIALS (Part 3 of 4) (Docked) Update the dashboard: four energy banks DIALS (Part 3 of 4) (Flight) Update the dashboard: four energy banks DIALS (Part 4 of 4) (Docked) Update the dashboard: shields, fuel, laser & cabin temp, altitude DIALS (Part 4 of 4) (Flight) Update the dashboard: shields, fuel, laser & cabin temp, altitude DIL2 (Docked) Update the roll or pitch indicator on the dashboard DIL2 (Flight) Update the roll or pitch indicator on the dashboard DILX (Docked) * Update a bar-based indicator on the dashboard DILX (Flight) * Update a bar-based indicator on the dashboard DOT (Flight) Draw a dash on the compass ECBLB (Flight) Light up the E.C.M. indicator bulb ("E") on the dashboard ECBLB2 (Flight) Start up the E.C.M. (light up the indicator, start the countdown and make the E.C.M. sound) MSBAR (Docked) Draw a specific indicator in the dashboard's missile bar MSBAR (Flight) Draw a specific indicator in the dashboard's missile bar msblob (Docked) Display the dashboard's missile indicators in green msblob (Flight) Display the dashboard's missile indicators in green PZW (Docked) Fetch the current dashboard colours, to support flashing PZW (Flight) Fetch the current dashboard colours, to support flashing REDU2 (Docked) Reduce the value of the pitch or roll dashboard indicator REDU2 (Flight) Reduce the value of the pitch or roll dashboard indicator SCAN (Flight) * Display the current ship on the scanner SCANCOL (Flight) Set the correct colour on the scanner for the current ship type SP1 (Flight) Draw the space station on the compass SP2 (Flight) Draw a dot on the compass, given the planet/station vector SPBLB (Docked) Light up the space station indicator ("S") on the dashboard SPBLB (Flight) Light up the space station indicator ("S") on the dashboard WPSHPS (Docked) Clear the scanner, reset the ball line and sun line heaps WPSHPS (Flight) Clear the scanner, reset the ball line and sun line heaps Variables ECBT (Flight) The character bitmap for the E.C.M. indicator bulb SPBT (Docked) The bitmap definition for the space station indicator bulb SPBT (Flight) The bitmap definition for the space station indicator bulb Drawing circles Hyperspace tunnels, launch rings and planets Subroutines BLINE (Docked) * Draw a circle segment and add it to the ball line heap BLINE (Flight) * Draw a circle segment and add it to the ball line heap CHKON (Docked) Check whether any part of a circle appears on the extended screen CHKON (Flight) Check whether any part of a circle appears on the extended screen CIRCLE (Docked) Draw a circle for the planet CIRCLE (Flight) Draw a circle for the planet CIRCLE2 (Docked) * Draw a circle (for the planet or chart) CIRCLE2 (Flight) * Draw a circle (for the planet or chart) HFS2 (Docked) * Draw the launch or hyperspace tunnel HFS2 (Flight) * Draw the launch or hyperspace tunnel LAUN (Docked) Make the launch sound and draw the launch tunnel LAUN (Flight) Make the launch sound and draw the launch tunnel LL164 (Docked) Make the hyperspace sound and draw the hyperspace tunnel LL164 (Flight) Make the hyperspace sound and draw the hyperspace tunnel TT128 (Docked) * Draw a circle on a chart TT128 (Flight) * Draw a circle on a chart TT14 (Docked) Draw a circle with crosshairs on a chart TT14 (Flight) Draw a circle with crosshairs on a chart Drawing lines The core line-drawing routines Subroutines EDGES (Docked) Draw a horizontal line given a centre and a half-width EDGES (Flight) Draw a horizontal line given a centre and a half-width HLOIN (Docked) * Draw a horizontal line from (X1, Y1) to (X2, Y1) HLOIN (Flight) * Draw a horizontal line from (X1, Y1) to (X2, Y1) HLOIN2 (Docked) Remove a line from the sun line heap and draw it on-screen HLOIN2 (Flight) Remove a line from the sun line heap and draw it on-screen LASLI (Flight) Draw the laser lines for when we fire our lasers LL118 (Docked) Move a point along a line until it is on-screen LL118 (Flight) Move a point along a line until it is on-screen LL145 (Part 1 of 4) (Docked) * Clip line: Work out which end-points are on-screen, if any LL145 (Part 1 of 4) (Flight) * Clip line: Work out which end-points are on-screen, if any LL145 (Part 2 of 4) (Docked) Clip line: Work out if any part of the line is on-screen LL145 (Part 2 of 4) (Flight) Clip line: Work out if any part of the line is on-screen LL145 (Part 3 of 4) (Docked) Clip line: Calculate the line's gradient LL145 (Part 3 of 4) (Flight) Clip line: Calculate the line's gradient LL145 (Part 4 of 4) (Docked) Clip line: Call the routine in LL188 to do the actual clipping LL145 (Part 4 of 4) (Flight) Clip line: Call the routine in LL188 to do the actual clipping LOIN (Part 1 of 7) (Docked) * Draw a line: Calculate the line gradient in the form of deltas LOIN (Part 1 of 7) (Flight) * Draw a line: Calculate the line gradient in the form of deltas LOIN (Part 2 of 7) (Docked) Draw a line: Line has a shallow gradient, step right along x-axis LOIN (Part 2 of 7) (Flight) Draw a line: Line has a shallow gradient, step right along x-axis LOIN (Part 3 of 7) (Docked) Draw a shallow line going right and up or left and down LOIN (Part 3 of 7) (Flight) Draw a shallow line going right and up or left and down LOIN (Part 4 of 7) (Docked) Draw a shallow line going right and down or left and up LOIN (Part 4 of 7) (Flight) Draw a shallow line going right and down or left and up LOIN (Part 5 of 7) (Docked) Draw a line: Line has a steep gradient, step up along y-axis LOIN (Part 5 of 7) (Flight) Draw a line: Line has a steep gradient, step up along y-axis LOIN (Part 6 of 7) (Docked) Draw a steep line going up and left or down and right LOIN (Part 6 of 7) (Flight) Draw a steep line going up and left or down and right LOIN (Part 7 of 7) (Docked) Draw a steep line going up and right or down and left LOIN (Part 7 of 7) (Flight) Draw a steep line going up and right or down and left NLIN (Docked) Draw a horizontal line at pixel row 23 to box in a title NLIN (Flight) Draw a horizontal line at pixel row 23 to box in a title NLIN2 (Docked) Draw a screen-wide horizontal line at the pixel row in A NLIN2 (Flight) Draw a screen-wide horizontal line at the pixel row in A NLIN3 (Docked) Print a title and draw a horizontal line at row 19 to box it in NLIN3 (Flight) Print a title and draw a horizontal line at row 19 to box it in NLIN4 (Docked) Draw a horizontal line at pixel row 19 to box in a title NLIN4 (Flight) Draw a horizontal line at pixel row 19 to box in a title TT15 (Docked) Draw a set of crosshairs TT15 (Flight) Draw a set of crosshairs Variables TWFL (Docked) Ready-made character rows for the left end of a horizontal line in mode 4 TWFL (Flight) Ready-made character rows for the left end of a horizontal line in mode 4 TWFR (Docked) Ready-made character rows for the right end of a horizontal line in mode 4 TWFR (Flight) Ready-made character rows for the right end of a horizontal line in mode 4 Drawing pixels How to plot pixels in various colours Subroutines CPIX2 (Docked) * Draw a single-height dash on the dashboard CPIX2 (Flight) * Draw a single-height dash on the dashboard CPIX4 (Docked) Draw a double-height dot on the dashboard CPIX4 (Flight) Draw a double-height dot on the dashboard PIX (Loader 3) Draw a single pixel at a specific coordinate PIXEL (Docked) * Draw a 1-pixel dot, 2-pixel dash or 4-pixel square PIXEL (Flight) * Draw a 1-pixel dot, 2-pixel dash or 4-pixel square PIXEL2 (Docked) Draw a stardust particle relative to the screen centre PIXEL2 (Flight) Draw a stardust particle relative to the screen centre PX3 (Docked) Plot a single pixel at (X, Y) within a character block PX3 (Flight) Plot a single pixel at (X, Y) within a character block Variables CTWOS (Docked) Ready-made single-pixel character row bytes for mode 5 CTWOS (Flight) Ready-made single-pixel character row bytes for mode 5 TWOS (Docked) Ready-made single-pixel character row bytes for mode 4 TWOS (Flight) Ready-made single-pixel character row bytes for mode 4 TWOS (Loader 3) Ready-made single-pixel character row bytes for mode 4 TWOS2 (Docked) Ready-made double-pixel character row bytes for mode 4 TWOS2 (Flight) Ready-made double-pixel character row bytes for mode 4 Drawing planets Planets with meridians and craters Subroutines PL2 (Flight) Remove the planet or sun from the screen PL21 (Docked) Return from a planet/sun-drawing routine with a failure flag PL21 (Flight) Return from a planet/sun-drawing routine with a failure flag PL9 (Part 1 of 3) (Flight) * Draw the planet, with either an equator and meridian, or a crater PL9 (Part 2 of 3) (Flight) Draw the planet's equator and meridian PL9 (Part 3 of 3) (Flight) Draw the planet's crater PLANET (Flight) Draw the planet or sun PLL1 (Part 1 of 3) (Loader 3) Draw Saturn on the loading screen (draw the planet) PLL1 (Part 2 of 3) (Loader 3) Draw Saturn on the loading screen (draw the stars) PLL1 (Part 3 of 3) (Loader 3) Draw Saturn on the loading screen (draw the rings) PLS1 (Flight) Calculate (Y A) = nosev_x / z PLS2 (Flight) Draw a half-ellipse PLS22 (Flight) * Draw an ellipse or half-ellipse PLS3 (Flight) Calculate (Y A P) = 222 * roofv_x / z PLS4 (Flight) Calculate CNT2 = arctan(P / A) / 4 PLS5 (Flight) Calculate roofv_x / z and roofv_y / z PLS6 (Flight) Calculate (X K) = (A P+1 P) / (z_sign z_hi z_lo) WP1 (Docked) Reset the ball line heap WP1 (Flight) Reset the ball line heap WPLS2 (Flight) Remove the planet from the screen Variables CNT (Loader 3) A counter for use in drawing Saturn's planetary body CNT2 (Loader 3) A counter for use in drawing Saturn's background stars CNT3 (Loader 3) A counter for use in drawing Saturn's rings RAND (Loader 3) The random number seed used for drawing Saturn Drawing ships The celebrated 3D ship plotting process Subroutines DOEXP (Docked) * Draw an exploding ship DOEXP (Flight) * Draw an exploding ship LL9 (Part 1 of 12) (Docked) Draw ship: Check if ship is exploding, check if ship is in front LL9 (Part 1 of 12) (Flight) Draw ship: Check if ship is exploding, check if ship is in front LL9 (Part 2 of 12) (Docked) Draw ship: Check if ship is in field of view, close enough to draw LL9 (Part 2 of 12) (Flight) Draw ship: Check if ship is in field of view, close enough to draw LL9 (Part 3 of 12) (Docked) Draw ship: Set up orientation vector, ship coordinate variables LL9 (Part 3 of 12) (Flight) Draw ship: Set up orientation vector, ship coordinate variables LL9 (Part 4 of 12) (Docked) Draw ship: Set visibility for exploding ship (all faces visible) LL9 (Part 4 of 12) (Flight) Draw ship: Set visibility for exploding ship (all faces visible) LL9 (Part 5 of 12) (Docked) Draw ship: Calculate the visibility of each of the ship's faces LL9 (Part 5 of 12) (Flight) Draw ship: Calculate the visibility of each of the ship's faces LL9 (Part 6 of 12) (Docked) Draw ship: Calculate the visibility of each of the ship's vertices LL9 (Part 6 of 12) (Flight) Draw ship: Calculate the visibility of each of the ship's vertices LL9 (Part 7 of 12) (Docked) Draw ship: Calculate the visibility of each of the ship's vertices LL9 (Part 7 of 12) (Flight) Draw ship: Calculate the visibility of each of the ship's vertices LL9 (Part 8 of 12) (Docked) Draw ship: Calculate the screen coordinates of visible vertices LL9 (Part 8 of 12) (Flight) Draw ship: Calculate the screen coordinates of visible vertices LL9 (Part 9 of 12) (Docked) Draw ship: Draw laser beams if the ship is firing its laser at us LL9 (Part 9 of 12) (Flight) Draw ship: Draw laser beams if the ship is firing its laser at us LL9 (Part 10 of 12) (Docked) Draw ship: Calculate the visibility of each of the ship's edges LL9 (Part 10 of 12) (Flight) Draw ship: Calculate the visibility of each of the ship's edges LL9 (Part 11 of 12) (Docked) Draw ship: Add all visible edges to the ship line heap LL9 (Part 11 of 12) (Flight) Draw ship: Add all visible edges to the ship line heap LL9 (Part 12 of 12) (Docked) Draw ship: Draw all the visible edges from the ship line heap LL9 (Part 12 of 12) (Flight) Draw ship: Draw all the visible edges from the ship line heap SHPPT (Docked) Draw a distant ship as a point in the middle of the screen SHPPT (Flight) Draw a distant ship as a point rather than a full wireframe Variables E% (Docked) Ship blueprints default NEWB flags for the ship hangar E% (Ship blueprints A) Ship blueprints default NEWB flags for the D.MOA file E% (Ship blueprints B) Ship blueprints default NEWB flags for the D.MOB file E% (Ship blueprints C) Ship blueprints default NEWB flags for the D.MOC file E% (Ship blueprints D) Ship blueprints default NEWB flags for the D.MOD file E% (Ship blueprints E) Ship blueprints default NEWB flags for the D.MOE file E% (Ship blueprints F) Ship blueprints default NEWB flags for the D.MOF file E% (Ship blueprints G) Ship blueprints default NEWB flags for the D.MOG file E% (Ship blueprints H) Ship blueprints default NEWB flags for the D.MOH file E% (Ship blueprints I) Ship blueprints default NEWB flags for the D.MOI file E% (Ship blueprints J) Ship blueprints default NEWB flags for the D.MOJ file E% (Ship blueprints K) Ship blueprints default NEWB flags for the D.MOK file E% (Ship blueprints L) Ship blueprints default NEWB flags for the D.MOL file E% (Ship blueprints M) Ship blueprints default NEWB flags for the D.MOM file E% (Ship blueprints N) Ship blueprints default NEWB flags for the D.MON file E% (Ship blueprints O) Ship blueprints default NEWB flags for the D.MOO file E% (Ship blueprints P) Ship blueprints default NEWB flags for the D.MOP file SHIP_ADDER (Ship blueprints B) Ship blueprint for an Adder SHIP_ADDER (Ship blueprints G) Ship blueprint for an Adder SHIP_ADDER (Ship blueprints I) Ship blueprint for an Adder SHIP_ADDER (Ship blueprints M) Ship blueprint for an Adder SHIP_ANACONDA (Ship blueprints L) Ship blueprint for an Anaconda SHIP_ASP_MK_2 (Ship blueprints N) Ship blueprint for an Asp Mk II SHIP_ASP_MK_2 (Ship blueprints P) Ship blueprint for an Asp Mk II SHIP_ASTEROID (Ship blueprints C) Ship blueprint for an asteroid SHIP_ASTEROID (Ship blueprints D) Ship blueprint for an asteroid SHIP_ASTEROID (Ship blueprints H) Ship blueprint for an asteroid SHIP_ASTEROID (Ship blueprints K) Ship blueprint for an asteroid SHIP_ASTEROID (Ship blueprints N) Ship blueprint for an asteroid SHIP_ASTEROID (Ship blueprints O) Ship blueprint for an asteroid SHIP_ASTEROID (Ship blueprints P) Ship blueprint for an asteroid SHIP_BOA (Ship blueprints C) Ship blueprint for a Boa SHIP_BOA (Ship blueprints F) Ship blueprint for a Boa SHIP_BOULDER (Ship blueprints B) Ship blueprint for a boulder SHIP_BOULDER (Ship blueprints E) Ship blueprint for a boulder SHIP_BOULDER (Ship blueprints F) Ship blueprint for a boulder SHIP_BOULDER (Ship blueprints G) Ship blueprint for a boulder SHIP_BOULDER (Ship blueprints P) Ship blueprint for a boulder SHIP_CANISTER (Docked) Ship blueprint for a cargo canister SHIP_CANISTER (Ship blueprints A) Ship blueprint for a cargo canister SHIP_CANISTER (Ship blueprints B) Ship blueprint for a cargo canister SHIP_CANISTER (Ship blueprints C) Ship blueprint for a cargo canister SHIP_CANISTER (Ship blueprints D) Ship blueprint for a cargo canister SHIP_CANISTER (Ship blueprints E) Ship blueprint for a cargo canister SHIP_CANISTER (Ship blueprints F) Ship blueprint for a cargo canister SHIP_CANISTER (Ship blueprints G) Ship blueprint for a cargo canister SHIP_CANISTER (Ship blueprints H) Ship blueprint for a cargo canister SHIP_CANISTER (Ship blueprints I) Ship blueprint for a cargo canister SHIP_CANISTER (Ship blueprints J) Ship blueprint for a cargo canister SHIP_CANISTER (Ship blueprints K) Ship blueprint for a cargo canister SHIP_CANISTER (Ship blueprints L) Ship blueprint for a cargo canister SHIP_CANISTER (Ship blueprints M) Ship blueprint for a cargo canister SHIP_CANISTER (Ship blueprints N) Ship blueprint for a cargo canister SHIP_CANISTER (Ship blueprints O) Ship blueprint for a cargo canister SHIP_CANISTER (Ship blueprints P) Ship blueprint for a cargo canister SHIP_COBRA_MK_1 (Ship blueprints D) Ship blueprint for a Cobra Mk I SHIP_COBRA_MK_1 (Ship blueprints E) Ship blueprint for a Cobra Mk I SHIP_COBRA_MK_1 (Ship blueprints J) Ship blueprint for a Cobra Mk I SHIP_COBRA_MK_1 (Ship blueprints K) Ship blueprint for a Cobra Mk I SHIP_COBRA_MK_1 (Ship blueprints M) Ship blueprint for a Cobra Mk I SHIP_COBRA_MK_1 (Ship blueprints O) Ship blueprint for a Cobra Mk I SHIP_COBRA_MK_3 (Docked) Ship blueprint for a Cobra Mk III SHIP_COBRA_MK_3 (Ship blueprints B) Ship blueprint for a Cobra Mk III SHIP_COBRA_MK_3 (Ship blueprints C) Ship blueprint for a Cobra Mk III SHIP_COBRA_MK_3 (Ship blueprints D) Ship blueprint for a Cobra Mk III SHIP_COBRA_MK_3 (Ship blueprints E) Ship blueprint for a Cobra Mk III SHIP_COBRA_MK_3 (Ship blueprints F) Ship blueprint for a Cobra Mk III SHIP_COBRA_MK_3 (Ship blueprints G) Ship blueprint for a Cobra Mk III SHIP_COBRA_MK_3 (Ship blueprints K) Ship blueprint for a Cobra Mk III SHIP_COBRA_MK_3 (Ship blueprints L) Ship blueprint for a Cobra Mk III SHIP_COBRA_MK_3 (Ship blueprints N) Ship blueprint for a Cobra Mk III SHIP_COBRA_MK_3 (Ship blueprints O) Ship blueprint for a Cobra Mk III SHIP_COBRA_MK_3 (Ship blueprints P) Ship blueprint for a Cobra Mk III SHIP_COBRA_MK_3_P (Ship blueprints A) Ship blueprint for a Cobra Mk III (pirate) SHIP_COBRA_MK_3_P (Ship blueprints H) Ship blueprint for a Cobra Mk III (pirate) SHIP_COBRA_MK_3_P (Ship blueprints I) Ship blueprint for a Cobra Mk III (pirate) SHIP_COBRA_MK_3_P (Ship blueprints J) Ship blueprint for a Cobra Mk III (pirate) SHIP_COBRA_MK_3_P (Ship blueprints M) Ship blueprint for a Cobra Mk III (pirate) SHIP_CONSTRICTOR (Docked) Ship blueprint for a Constrictor SHIP_CONSTRICTOR (Ship blueprints G) Ship blueprint for a Constrictor SHIP_CORIOLIS (Ship blueprints A) Ship blueprint for a Coriolis space station SHIP_CORIOLIS (Ship blueprints C) Ship blueprint for a Coriolis space station SHIP_CORIOLIS (Ship blueprints E) Ship blueprint for a Coriolis space station SHIP_CORIOLIS (Ship blueprints G) Ship blueprint for a Coriolis space station SHIP_CORIOLIS (Ship blueprints I) Ship blueprint for a Coriolis space station SHIP_CORIOLIS (Ship blueprints K) Ship blueprint for a Coriolis space station SHIP_CORIOLIS (Ship blueprints M) Ship blueprint for a Coriolis space station SHIP_CORIOLIS (Ship blueprints O) Ship blueprint for a Coriolis space station SHIP_DODO (Ship blueprints B) Ship blueprint for a Dodecahedron ("Dodo") space station SHIP_DODO (Ship blueprints D) Ship blueprint for a Dodecahedron ("Dodo") space station SHIP_DODO (Ship blueprints F) Ship blueprint for a Dodecahedron ("Dodo") space station SHIP_DODO (Ship blueprints H) Ship blueprint for a Dodecahedron ("Dodo") space station SHIP_DODO (Ship blueprints J) Ship blueprint for a Dodecahedron ("Dodo") space station SHIP_DODO (Ship blueprints L) Ship blueprint for a Dodecahedron ("Dodo") space station SHIP_DODO (Ship blueprints N) Ship blueprint for a Dodecahedron ("Dodo") space station SHIP_DODO (Ship blueprints P) Ship blueprint for a Dodecahedron ("Dodo") space station SHIP_ESCAPE_POD (Ship blueprints A) Ship blueprint for an escape pod SHIP_ESCAPE_POD (Ship blueprints B) Ship blueprint for an escape pod SHIP_ESCAPE_POD (Ship blueprints C) Ship blueprint for an escape pod SHIP_ESCAPE_POD (Ship blueprints D) Ship blueprint for an escape pod SHIP_ESCAPE_POD (Ship blueprints E) Ship blueprint for an escape pod SHIP_ESCAPE_POD (Ship blueprints F) Ship blueprint for an escape pod SHIP_ESCAPE_POD (Ship blueprints G) Ship blueprint for an escape pod SHIP_ESCAPE_POD (Ship blueprints H) Ship blueprint for an escape pod SHIP_ESCAPE_POD (Ship blueprints I) Ship blueprint for an escape pod SHIP_ESCAPE_POD (Ship blueprints J) Ship blueprint for an escape pod SHIP_ESCAPE_POD (Ship blueprints K) Ship blueprint for an escape pod SHIP_ESCAPE_POD (Ship blueprints L) Ship blueprint for an escape pod SHIP_ESCAPE_POD (Ship blueprints N) Ship blueprint for an escape pod SHIP_ESCAPE_POD (Ship blueprints O) Ship blueprint for an escape pod SHIP_ESCAPE_POD (Ship blueprints P) Ship blueprint for an escape pod SHIP_FER_DE_LANCE (Ship blueprints A) Ship blueprint for a Fer-de-Lance SHIP_FER_DE_LANCE (Ship blueprints L) Ship blueprint for a Fer-de-Lance SHIP_GECKO (Ship blueprints D) Ship blueprint for a Gecko SHIP_GECKO (Ship blueprints E) Ship blueprint for a Gecko SHIP_GECKO (Ship blueprints F) Ship blueprint for a Gecko SHIP_GECKO (Ship blueprints J) Ship blueprint for a Gecko SHIP_GECKO (Ship blueprints K) Ship blueprint for a Gecko SHIP_GECKO (Ship blueprints M) Ship blueprint for a Gecko SHIP_GECKO (Ship blueprints N) Ship blueprint for a Gecko SHIP_KRAIT (Docked) Ship blueprint for a Krait SHIP_KRAIT (Ship blueprints A) Ship blueprint for a Krait SHIP_KRAIT (Ship blueprints B) Ship blueprint for a Krait SHIP_KRAIT (Ship blueprints C) Ship blueprint for a Krait SHIP_KRAIT (Ship blueprints E) Ship blueprint for a Krait SHIP_KRAIT (Ship blueprints G) Ship blueprint for a Krait SHIP_KRAIT (Ship blueprints H) Ship blueprint for a Krait SHIP_KRAIT (Ship blueprints I) Ship blueprint for a Krait SHIP_KRAIT (Ship blueprints J) Ship blueprint for a Krait SHIP_KRAIT (Ship blueprints M) Ship blueprint for a Krait SHIP_KRAIT (Ship blueprints N) Ship blueprint for a Krait SHIP_KRAIT (Ship blueprints O) Ship blueprint for a Krait SHIP_KRAIT (Ship blueprints P) Ship blueprint for a Krait SHIP_MAMBA (Ship blueprints A) Ship blueprint for a Mamba SHIP_MAMBA (Ship blueprints B) Ship blueprint for a Mamba SHIP_MAMBA (Ship blueprints E) Ship blueprint for a Mamba SHIP_MAMBA (Ship blueprints G) Ship blueprint for a Mamba SHIP_MAMBA (Ship blueprints I) Ship blueprint for a Mamba SHIP_MAMBA (Ship blueprints J) Ship blueprint for a Mamba SHIP_MAMBA (Ship blueprints L) Ship blueprint for a Mamba SHIP_MAMBA (Ship blueprints M) Ship blueprint for a Mamba SHIP_MAMBA (Ship blueprints O) Ship blueprint for a Mamba SHIP_MISSILE (Missile ship blueprint) Ship blueprint for a missile SHIP_MORAY (Ship blueprints K) Ship blueprint for a Moray SHIP_PLATE (Ship blueprints A) Ship blueprint for an alloy plate SHIP_PLATE (Ship blueprints B) Ship blueprint for an alloy plate SHIP_PLATE (Ship blueprints E) Ship blueprint for an alloy plate SHIP_PLATE (Ship blueprints G) Ship blueprint for an alloy plate SHIP_PLATE (Ship blueprints I) Ship blueprint for an alloy plate SHIP_PLATE (Ship blueprints J) Ship blueprint for an alloy plate SHIP_PLATE (Ship blueprints O) Ship blueprint for an alloy plate SHIP_PLATE (Ship blueprints P) Ship blueprint for an alloy plate SHIP_PYTHON (Docked) Ship blueprint for a Python SHIP_PYTHON (Ship blueprints A) Ship blueprint for a Python SHIP_PYTHON (Ship blueprints H) Ship blueprint for a Python SHIP_PYTHON (Ship blueprints K) Ship blueprint for a Python SHIP_PYTHON_P (Ship blueprints I) Ship blueprint for a Python (pirate) SHIP_PYTHON_P (Ship blueprints O) Ship blueprint for a Python (pirate) SHIP_SHUTTLE (Docked) Ship blueprint for a Shuttle SHIP_SHUTTLE (Ship blueprints H) Ship blueprint for a Shuttle SHIP_SIDEWINDER (Ship blueprints A) Ship blueprint for a Sidewinder SHIP_SIDEWINDER (Ship blueprints C) Ship blueprint for a Sidewinder SHIP_SIDEWINDER (Ship blueprints D) Ship blueprint for a Sidewinder SHIP_SIDEWINDER (Ship blueprints E) Ship blueprint for a Sidewinder SHIP_SIDEWINDER (Ship blueprints F) Ship blueprint for a Sidewinder SHIP_SIDEWINDER (Ship blueprints H) Ship blueprint for a Sidewinder SHIP_SIDEWINDER (Ship blueprints I) Ship blueprint for a Sidewinder SHIP_SIDEWINDER (Ship blueprints J) Ship blueprint for a Sidewinder SHIP_SIDEWINDER (Ship blueprints K) Ship blueprint for a Sidewinder SHIP_SIDEWINDER (Ship blueprints L) Ship blueprint for a Sidewinder SHIP_SIDEWINDER (Ship blueprints M) Ship blueprint for a Sidewinder SHIP_SIDEWINDER (Ship blueprints N) Ship blueprint for a Sidewinder SHIP_SIDEWINDER (Ship blueprints P) Ship blueprint for a Sidewinder SHIP_SPLINTER (Ship blueprints C) Ship blueprint for a splinter SHIP_SPLINTER (Ship blueprints D) Ship blueprint for a splinter SHIP_SPLINTER (Ship blueprints H) Ship blueprint for a splinter SHIP_SPLINTER (Ship blueprints K) Ship blueprint for a splinter SHIP_SPLINTER (Ship blueprints N) Ship blueprint for a splinter SHIP_SPLINTER (Ship blueprints O) Ship blueprint for a splinter SHIP_SPLINTER (Ship blueprints P) Ship blueprint for a splinter SHIP_THARGOID (Ship blueprints C) Ship blueprint for a Thargoid mothership SHIP_THARGOID (Ship blueprints D) Ship blueprint for a Thargoid mothership SHIP_THARGON (Ship blueprints C) Ship blueprint for a Thargon SHIP_THARGON (Ship blueprints D) Ship blueprint for a Thargon SHIP_TRANSPORTER (Docked) Ship blueprint for a Transporter SHIP_TRANSPORTER (Ship blueprints F) Ship blueprint for a Transporter SHIP_VIPER (Docked) Ship blueprint for a Viper SHIP_VIPER (Ship blueprints A) Ship blueprint for a Viper SHIP_VIPER (Ship blueprints B) Ship blueprint for a Viper SHIP_VIPER (Ship blueprints C) Ship blueprint for a Viper SHIP_VIPER (Ship blueprints D) Ship blueprint for a Viper SHIP_VIPER (Ship blueprints E) Ship blueprint for a Viper SHIP_VIPER (Ship blueprints F) Ship blueprint for a Viper SHIP_VIPER (Ship blueprints G) Ship blueprint for a Viper SHIP_VIPER (Ship blueprints H) Ship blueprint for a Viper SHIP_VIPER (Ship blueprints I) Ship blueprint for a Viper SHIP_VIPER (Ship blueprints J) Ship blueprint for a Viper SHIP_VIPER (Ship blueprints K) Ship blueprint for a Viper SHIP_VIPER (Ship blueprints L) Ship blueprint for a Viper SHIP_VIPER (Ship blueprints M) Ship blueprint for a Viper SHIP_VIPER (Ship blueprints N) Ship blueprint for a Viper SHIP_VIPER (Ship blueprints O) Ship blueprint for a Viper SHIP_VIPER (Ship blueprints P) Ship blueprint for a Viper SHIP_WORM (Ship blueprints B) Ship blueprint for a Worm SHIP_WORM (Ship blueprints L) Ship blueprint for a Worm XX21 (Docked) Ship blueprints lookup table for the ship hangar XX21 (Ship blueprints A) Ship blueprints lookup table for the D.MOA file XX21 (Ship blueprints B) Ship blueprints lookup table for the D.MOB file XX21 (Ship blueprints C) Ship blueprints lookup table for the D.MOC file XX21 (Ship blueprints D) Ship blueprints lookup table for the D.MOD file XX21 (Ship blueprints E) Ship blueprints lookup table for the D.MOE file XX21 (Ship blueprints F) Ship blueprints lookup table for the D.MOF file XX21 (Ship blueprints G) Ship blueprints lookup table for the D.MOG file XX21 (Ship blueprints H) Ship blueprints lookup table for the D.MOH file XX21 (Ship blueprints I) Ship blueprints lookup table for the D.MOI file XX21 (Ship blueprints J) Ship blueprints lookup table for the D.MOJ file XX21 (Ship blueprints K) Ship blueprints lookup table for the D.MOK file XX21 (Ship blueprints L) Ship blueprints lookup table for the D.MOL file XX21 (Ship blueprints M) Ship blueprints lookup table for the D.MOM file XX21 (Ship blueprints N) Ship blueprints lookup table for the D.MON file XX21 (Ship blueprints O) Ship blueprints lookup table for the D.MOO file XX21 (Ship blueprints P) Ship blueprints lookup table for the D.MOP file Macros EDGE (Docked) Macro definition for adding edges to ship blueprints EDGE (Missile ship blueprint) Macro definition for adding edges to ship blueprints EDGE (Ship blueprints A) Macro definition for adding edges to ship blueprints EDGE (Ship blueprints B) Macro definition for adding edges to ship blueprints EDGE (Ship blueprints C) Macro definition for adding edges to ship blueprints EDGE (Ship blueprints D) Macro definition for adding edges to ship blueprints EDGE (Ship blueprints E) Macro definition for adding edges to ship blueprints EDGE (Ship blueprints F) Macro definition for adding edges to ship blueprints EDGE (Ship blueprints G) Macro definition for adding edges to ship blueprints EDGE (Ship blueprints H) Macro definition for adding edges to ship blueprints EDGE (Ship blueprints I) Macro definition for adding edges to ship blueprints EDGE (Ship blueprints J) Macro definition for adding edges to ship blueprints EDGE (Ship blueprints K) Macro definition for adding edges to ship blueprints EDGE (Ship blueprints L) Macro definition for adding edges to ship blueprints EDGE (Ship blueprints M) Macro definition for adding edges to ship blueprints EDGE (Ship blueprints N) Macro definition for adding edges to ship blueprints EDGE (Ship blueprints O) Macro definition for adding edges to ship blueprints EDGE (Ship blueprints P) Macro definition for adding edges to ship blueprints FACE (Docked) Macro definition for adding faces to ship blueprints FACE (Missile ship blueprint) Macro definition for adding faces to ship blueprints FACE (Ship blueprints A) Macro definition for adding faces to ship blueprints FACE (Ship blueprints B) Macro definition for adding faces to ship blueprints FACE (Ship blueprints C) Macro definition for adding faces to ship blueprints FACE (Ship blueprints D) Macro definition for adding faces to ship blueprints FACE (Ship blueprints E) Macro definition for adding faces to ship blueprints FACE (Ship blueprints F) Macro definition for adding faces to ship blueprints FACE (Ship blueprints G) Macro definition for adding faces to ship blueprints FACE (Ship blueprints H) Macro definition for adding faces to ship blueprints FACE (Ship blueprints I) Macro definition for adding faces to ship blueprints FACE (Ship blueprints J) Macro definition for adding faces to ship blueprints FACE (Ship blueprints K) Macro definition for adding faces to ship blueprints FACE (Ship blueprints L) Macro definition for adding faces to ship blueprints FACE (Ship blueprints M) Macro definition for adding faces to ship blueprints FACE (Ship blueprints N) Macro definition for adding faces to ship blueprints FACE (Ship blueprints O) Macro definition for adding faces to ship blueprints FACE (Ship blueprints P) Macro definition for adding faces to ship blueprints VERTEX (Docked) Macro definition for adding vertices to ship blueprints VERTEX (Missile ship blueprint) Macro definition for adding vertices to ship blueprints VERTEX (Ship blueprints A) Macro definition for adding vertices to ship blueprints VERTEX (Ship blueprints B) Macro definition for adding vertices to ship blueprints VERTEX (Ship blueprints C) Macro definition for adding vertices to ship blueprints VERTEX (Ship blueprints D) Macro definition for adding vertices to ship blueprints VERTEX (Ship blueprints E) Macro definition for adding vertices to ship blueprints VERTEX (Ship blueprints F) Macro definition for adding vertices to ship blueprints VERTEX (Ship blueprints G) Macro definition for adding vertices to ship blueprints VERTEX (Ship blueprints H) Macro definition for adding vertices to ship blueprints VERTEX (Ship blueprints I) Macro definition for adding vertices to ship blueprints VERTEX (Ship blueprints J) Macro definition for adding vertices to ship blueprints VERTEX (Ship blueprints K) Macro definition for adding vertices to ship blueprints VERTEX (Ship blueprints L) Macro definition for adding vertices to ship blueprints VERTEX (Ship blueprints M) Macro definition for adding vertices to ship blueprints VERTEX (Ship blueprints N) Macro definition for adding vertices to ship blueprints VERTEX (Ship blueprints O) Macro definition for adding vertices to ship blueprints VERTEX (Ship blueprints P) Macro definition for adding vertices to ship blueprints Drawing suns The epic, shimmering Elite sun Subroutines FLFLLS (Docked) Reset the sun line heap FLFLLS (Flight) Reset the sun line heap SUN (Part 1 of 4) (Docked) Draw the sun: Set up all the variables needed to draw the sun SUN (Part 1 of 4) (Flight) Draw the sun: Set up all the variables needed to draw the sun SUN (Part 2 of 4) (Docked) Draw the sun: Start from the bottom of the screen and erase the old sun line by line SUN (Part 2 of 4) (Flight) Draw the sun: Start from the bottom of the screen and erase the old sun line by line SUN (Part 3 of 4) (Docked) Draw the sun: Continue to move up the screen, drawing the new sun line by line SUN (Part 3 of 4) (Flight) Draw the sun: Continue to move up the screen, drawing the new sun line by line SUN (Part 4 of 4) (Docked) Draw the sun: Continue to the top of the screen, erasing the old sun line by line SUN (Part 4 of 4) (Flight) Draw the sun: Continue to the top of the screen, erasing the old sun line by line WPLS (Docked) Remove the sun from the screen WPLS (Flight) Remove the sun from the screen Drawing the screen The split-screen mode and different screen views Subroutines CLYNS (Docked) Clear the bottom three text rows of the mode 4 screen CLYNS (Flight) Clear the bottom three text rows of the mode 4 screen DET1 (Docked) Show or hide the dashboard (for when we die) DET1 (Flight) Show or hide the dashboard (for when we die) IRQ1 (Loader 3) * The main screen-mode interrupt handler (IRQ1V points here) LYN (Docked) Clear most of a row of pixels LYN (Flight) Clear most of a row of pixels TT66 (Docked) Clear the screen and set the current view type TT66 (Flight) Clear the screen and set the current view type TTX66 (Docked) Clear the top part of the screen and draw a white border TTX66 (Flight) Clear the top part of the screen and draw a white border WSCAN (Docked) Wait for the vertical sync WSCAN (Flight) Wait for the vertical sync Variables B% (Loader 1) VDU commands for switching to a mode 7 screen B% (Loader 3) VDU commands for setting the square mode 4 screen TVT1 (Loader 3) Palette data for space and the two dashboard colour schemes VEC (Missile ship blueprint) The original value of the IRQ1 vector Equipment Buying and selling weapons and ship upgrades Subroutines eq (Docked) Subtract the price of equipment from the cash pot EQSHP (Docked) * Show the Equip Ship screen (red key f3) prx (Docked) Return the price of a piece of equipment qv (Docked) Print a menu of the four space views, for buying lasers refund (Docked) Install a new laser, processing a refund if applicable Variables PRXS (Docked) Equipment prices Flight Docking, hyperspace, views, shields and more Subroutines DCS1 (Flight) Calculate the vector from the ideal docking position to the ship DENGY (Docked) Drain some energy from the energy banks DENGY (Flight) Drain some energy from the energy banks DOCKIT (Flight) Apply docking manoeuvres to the ship in INWK DOENTRY (Docked) Dock at the space station, show the ship hangar and work out any mission progression ee3 (Docked) Print the hyperspace countdown in the top-left of the screen ee3 (Flight) Print the hyperspace countdown in the top-left of the screen ESCAPE (Flight) Launch our escape pod Ghy (Docked) Perform a galactic hyperspace jump Ghy (Flight) Perform a galactic hyperspace jump hyp (Docked) Start the hyperspace process hyp (Flight) Start the hyperspace process LOOK1 (Flight) Initialise the space view me1 (Docked) Erase an old in-flight message and display a new one me1 (Flight) Erase an old in-flight message and display a new one me2 (Docked) Remove an in-flight message from the space view me2 (Flight) Remove an in-flight message from the space view mes9 (Docked) Print a text token, possibly followed by " DESTROYED" mes9 (Flight) Print a text token, possibly followed by " DESTROYED" MESS (Docked) Display an in-flight message MESS (Flight) Display an in-flight message MJP (Flight) Process a mis-jump into witchspace OOPS (Flight) Take some damage ou2 (Flight) Display "E.C.M.SYSTEM DESTROYED" as an in-flight message ou3 (Flight) Display "FUEL SCOOPS DESTROYED" as an in-flight message OUCH (Flight) Potentially lose cargo or equipment following damage PU1 (Flight) Flip the coordinate axes for the four different views SESCP (Flight) Spawn an escape pod from the current (parent) ship SHD (Docked) Charge a shield and drain some energy from the energy banks SHD (Flight) Charge a shield and drain some energy from the energy banks SIGHT (Docked) Draw the laser crosshairs SIGHT (Flight) Draw the laser crosshairs TT110 (Docked) Launch from a station or show the front space view TT110 (Flight) Launch from a station or show the front space view TT147 (Docked) Print an error when a system is out of hyperspace range TT147 (Flight) Print an error when a system is out of hyperspace range TT18 (Flight) Try to initiate a jump into hyperspace TTX110 (Docked) Set the current system to the nearest system and return to hyp TTX110 (Flight) Set the current system to the nearest system and return to hyp WARP (Flight) * Perform an in-system jump wW (Docked) Start a hyperspace countdown wW (Flight) Start a hyperspace countdown Keyboard Processing key presses and joysticks Subroutines CTRL (Docked) Scan the keyboard to see if CTRL is currently pressed CTRL (Flight) Scan the keyboard to see if CTRL is currently pressed DK4 (Docked) Scan for pause, configuration and secondary flight keys DK4 (Flight) Scan for pause, configuration and secondary flight keys DKJ1 (Docked) Read joystick and flight controls DKJ1 (Flight) Read joystick and flight controls DKS1 (Flight) Scan the keyboard for a flight key DKS2 (Docked) Read the joystick position DKS2 (Flight) Read the joystick position DKS3 (Docked) Toggle a configuration setting and emit a beep DKS3 (Flight) Toggle a configuration setting and emit a beep DKS4 (Docked) Scan the keyboard to see if a specific key is being pressed DKS4 (Flight) Scan the keyboard to see if a specific key is being pressed DOKEY (Docked) * Scan for the joystick DOKEY (Flight) * Scan for the seven primary flight controls and apply the docking computer manoeuvring code FLKB (Docked) Flush the keyboard buffer FLKB (Flight) Flush the keyboard buffer PAUSE2 (Docked) Wait until a key is pressed, ignoring any existing key press RDKEY (Docked) Scan the keyboard for key presses RDKEY (Flight) Scan the keyboard for key presses TT102 (Docked) * Process function key, save key, hyperspace and chart key presses TT102 (Flight) * Process function key, save key, hyperspace and chart key presses and update the hyperspace counter TT17 (Docked) Scan the keyboard for cursor key or joystick movement TT17 (Flight) Scan the keyboard for cursor key or joystick movement TT214 (Docked) Ask a question with a "Y/N?" prompt and return the response TT217 (Docked) Scan the keyboard until a key is pressed U% (Flight) Clear the key logger Variables KYTB (Flight) Lookup table for in-flight keyboard controls Loader The loading screen and system setup Subroutines BEGIN (Docked) Initialise the configuration variables and start the game BRBR1 (Loader 3) Loader break handler: print a newline and the error message, and then hang the computer DEEOR (Docked) Decrypt the main docked code between &1300 and &5FFF and the main game loop DEEOR (Flight) Decrypt the main flight code between &1300 and &55FF and jump into the main game loop DOBEGIN (Docked) Decrypt the main docked code, initialise the configuration variables and start the game DOENTRY (Flight) Load and run the docked code Elite loader (Loader 1) Reset vectors, change to mode 7, and load and run the ELITE3 loader Elite loader (Part 1 of 2) (Loader 2) Various copy protection checks, and make sure there is no Tube Elite loader (Part 1 of 3) (Loader 3) Set up the split screen mode, move code around, set up the sound envelopes and configure the system Elite loader (Part 2 of 2) (Loader 2) Load and run the ELITE4 loader Elite loader (Part 2 of 3) (Loader 3) Include binaries for recursive tokens, Missile blueprint and images Elite loader (Part 3 of 3) (Loader 3) Include binaries for the loading screen images FileHandler (Sideways RAM Loader) The custom file handler that checks whether OSFILE is loading a ship blueprint file and if so, redirects the load to sideways RAM INBAY (Docked) An unused routine that is never run INBAY (Flight) Load and run the main docked code in T.CODE LOAD (Loader 3) Load the main docked code, set up various vectors, run a checksum and start the game LOADcode (Loader 3) Encrypted LOAD routine, bundled up in the loader so it can be moved to &0B00 to be run LoadRom (Sideways RAM Loader) Copy a pre-generated ship blueprints ROM image from address &3400 into sideways RAM loadrom% (Sideways RAM Loader) Entry point for the ROM-loading routine LOADSCR (Loader 2) Show the mode 7 Acornsoft loading screen LoadShipFiles (Sideways RAM Loader) Load all the ship blueprint files into sideways RAM LOGOS (Loader 2) Print a large Acornsoft logo as part of the loading screen LOMOD (Flight) Load a new ship blueprints file MakeRom (Sideways RAM Loader) Create a ROM image in sideways RAM that contains all the ship blueprint files makerom% (Sideways RAM Loader) Entry point for the routine to create the Elite ROM image in sideways RAM ProcessBlueprint (Sideways RAM Loader) Process a blueprint entry from the loaded blueprint file, copying the blueprint into sideways RAM if it hasn't already been copied PROT1 (Loader 2) Various copy protection shenanigans in preparation for showing the Acornsoft loading screen PROT4 (Loader 3) Fetch the address of the keyboard translation table before carrying on with the copy protection prstr (Loader 2) Print the NOP-terminated string immediately following the JSR instruction that called the routine RSHIPS (Flight) Launch from the station, load a new set of ship blueprints and jump into the main game loop SCRAM (Docked) Decrypt the main docked code, reset the flight variables and start the game SetEdgesOffset (Sideways RAM Loader) Calculate the edges offset within sideways RAM for the blueprint we are processing and set it in bytes #3 and #16 of the blueprint TestBBC (Sideways RAM Loader) Fetch details on all the ROMs in the BBC Micro (i.e. the host) and populate the sram%, used%, dupl% and eliterom% variables testbbc% (Sideways RAM Loader) Entry point for the ROM-testing routine TestPro (Sideways RAM Loader) Test whether we are running this on a co-processor testpro% (Sideways RAM Loader) Entry point for the co-processor detection routine TVT1code (Loader 3) Code block at &1100-&11E2 that remains resident in both docked and flight mode (palettes, screen mode routine and commander data) Variables copyMatch (Sideways RAM Loader) The start of the copyright string from a valid ROM bank, used to check whether a ROM bank contains a ROM image coriolisStation (Sideways RAM Loader) The address in sideways RAM of the ship blueprint for the Coriolis space station dupl% (Sideways RAM Loader) A table for storing the status of each ROM bank ECHAR (Loader 2) Character definitions for the Electron to mimic the graphics characters of the BBC Micro's mode 7 teletext screen eliterom% (Sideways RAM Loader) The number of the bank containing the Elite ROM eliteRomHeader (Sideways RAM Loader) The ROM header code that gets copied to &8000 to create a sideways RAM image containing the ship blueprint files filenamePattern (Sideways RAM Loader) The filename pattern for which we intercept OSFILE to return the ship blueprints from sideways RAM LOGO (Loader 2) Tables containing the Acornsoft logo for the BBC Micro and Acorn Electron LTLI (Flight) The OS command string for loading the docked code in file T.CODE MESS1 (Loader 1) The OS command string for switching to the disc filing system MESS1 (Loader 2) The OS command string for loading the ELITE4 loader MESS1 (Loader 3) The OS command string for changing the disc directory to E MESS2 (Loader 1) The OS command string for loading the ELITE3 binary osfileBlock (Sideways RAM Loader) OSFILE configuration block for loading a ship blueprint file proflag% (Sideways RAM Loader) A flag to record whether we are running this on a co-processor RDLI (Docked) The OS command string for running the flight code in file D.CODE ROM (Sideways RAM Loader) The ROM header code that forms the first part of the sideways RAM image containing the ship blueprint files shipFilename (Sideways RAM Loader) The filename of the ship blueprint file to load with OSFILE SHIPI (Flight) The OS command string for loading a ship blueprints file sram% (Sideways RAM Loader) A table for storing the status of each ROM bank titleMatch (Sideways RAM Loader) The title of the Elite ROM, used to check whether the ROM is already installed in a ROM bank used% (Sideways RAM Loader) A table for storing the status of each ROM bank Main loop The core loop that runs Elite Subroutines Main flight loop (Part 1 of 16) (Flight) Seed the random number generator Main flight loop (Part 2 of 16) (Flight) Calculate the alpha and beta angles from the current pitch and roll of our ship Main flight loop (Part 3 of 16) (Flight) Scan for flight keys and process the results Main flight loop (Part 4 of 16) (Flight) 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) (Flight) For each nearby ship: If an energy bomb has been set off, potentially kill this ship Main flight loop (Part 6 of 16) (Flight) 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) (Flight) For each nearby ship: Check whether we are docking, scooping or colliding with it Main flight loop (Part 8 of 16) (Flight) For each nearby ship: Process us potentially scooping this item Main flight loop (Part 9 of 16) (Flight) 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) (Flight) For each nearby ship: Remove if scooped, or process collisions Main flight loop (Part 11 of 16) (Flight) For each nearby ship: Process missile lock and firing our laser Main flight loop (Part 12 of 16) (Flight) For each nearby ship: Draw the ship, remove if killed, loop back Main flight loop (Part 13 of 16) (Flight) Show energy bomb effect, charge shields and energy banks Main flight loop (Part 14 of 16) (Flight) Spawn a space station if we are close enough to the planet Main flight loop (Part 15 of 16) (Flight) Perform altitude checks with the planet and sun and process fuel scooping if appropriate Main flight loop (Part 16 of 16) (Flight) Process laser pulsing, E.C.M. energy drain, call stardust routine Main game loop (Part 1 of 6) (Flight) Spawn a trader (a Cobra Mk III, Python, Boa or Anaconda) Main game loop (Part 2 of 6) (Docked) * Potentially spawn a trader, an asteroid, or a cargo canister (though this has no effect when docked) Main game loop (Part 2 of 6) (Flight) * Call the main flight loop, and potentially spawn a trader, an asteroid, or a cargo canister Main game loop (Part 3 of 6) (Flight) Potentially spawn a cop, particularly if we've been bad Main game loop (Part 4 of 6) (Flight) Potentially spawn a lone bounty hunter or up to four pirates Main game loop (Part 5 of 6) (Docked) Cool down lasers, make calls to update the dashboard Main game loop (Part 5 of 6) (Flight) Cool down lasers, make calls to update the dashboard Main game loop (Part 6 of 6) (Docked) Process non-flight key presses (red function keys, docked keys) Main game loop (Part 6 of 6) (Flight) Process non-flight key presses (red function keys, docked keys) Market Market prices, selling, buying and inventory Subroutines dn (Docked) Print the amount of money we have left in the cash pot, then make a short, high beep and delay for 1 second gnum (Docked) Get a number from the keyboard NWDAV4 (Docked) Print an "ITEM?" error, make a beep and rejoin the TT210 routine tnpr (Docked) Work out if we have space for a specific amount of cargo tnpr (Flight) Work out if we have space for a specific amount of cargo tnpr1 (Flight) Work out if we have space for one tonne of cargo TT151 (Docked) Print the name, price and availability of a market item TT151 (Flight) Print the name, price and availability of a market item TT152 (Docked) Print the unit ("t", "kg" or "g") for a market item TT152 (Flight) Print the unit ("t", "kg" or "g") for a market item TT160 (Docked) Print "t" (for tonne) and a space TT160 (Flight) Print "t" (for tonne) and a space TT161 (Docked) Print "kg" (for kilograms) TT161 (Flight) Print "kg" (for kilograms) TT163 (Docked) Print the headers for the table of market prices TT163 (Flight) Print the headers for the table of market prices TT167 (Docked) * Show the Market Price screen (red key f7) TT167 (Flight) * Show the Market Price screen (red key f7) TT16a (Docked) Print "g" (for grams) TT16a (Flight) Print "g" (for grams) TT208 (Docked) * Show the Sell Cargo screen (red key f2) TT210 (Docked) Show a list of current cargo in our hold, optionally to sell TT210 (Flight) Show a list of current cargo in our hold, optionally to sell TT213 (Docked) * Show the Inventory screen (red key f9) TT213 (Flight) * Show the Inventory screen (red key f9) TT219 (Docked) * Show the Buy Cargo screen (red key f1) var (Docked) Calculate QQ19+3 = economy * |economic_factor| var (Flight) Calculate QQ19+3 = economy * |economic_factor| Variables QQ23 (Docked) Market prices table QQ23 (Flight) Market prices table Macros ITEM (Docked) Macro definition for the market prices table ITEM (Flight) Macro definition for the market prices table Maths (Arithmetic) Addition, subtraction, multiplication, division Subroutines ADD (Docked) * Calculate (A X) = (A P) + (S R) ADD (Flight) * Calculate (A X) = (A P) + (S R) DORND (Docked) * Generate random numbers DORND (Flight) * Generate random numbers DORND (Loader 3) * Generate random numbers DV41 (Docked) Calculate (P R) = 256 * DELTA / A DV41 (Flight) Calculate (P R) = 256 * DELTA / A DV42 (Docked) Calculate (P R) = 256 * DELTA / z_hi DV42 (Flight) Calculate (P R) = 256 * DELTA / z_hi DVID3B2 (Docked) Calculate K(3 2 1 0) = (A P+1 P) / (z_sign z_hi z_lo) DVID3B2 (Flight) Calculate K(3 2 1 0) = (A P+1 P) / (z_sign z_hi z_lo) DVID4 (Docked) * Calculate (P R) = 256 * A / Q DVID4 (Flight) * Calculate (P R) = 256 * A / Q DVIDT (Docked) Calculate (P+1 A) = (A P) / Q DVIDT (Flight) Calculate (P+1 A) = (A P) / Q FMLTU (Docked) Calculate A = A * Q / 256 FMLTU (Flight) Calculate A = A * Q / 256 FMLTU2 (Docked) Calculate A = K * sin(A) FMLTU2 (Flight) Calculate A = K * sin(A) GC2 (Docked) Calculate (Y X) = (A P) * 4 GC2 (Flight) Calculate (Y X) = (A P) * 4 GCASH (Docked) Calculate (Y X) = P * Q * 4 GCASH (Flight) Calculate (Y X) = P * Q * 4 LCASH (Docked) Subtract an amount of cash from the cash pot LL120 (Docked) Calculate (Y X) = (S x1_lo) * XX12+2 or (S x1_lo) / XX12+2 LL120 (Flight) Calculate (Y X) = (S x1_lo) * XX12+2 or (S x1_lo) / XX12+2 LL123 (Docked) Calculate (Y X) = (S R) / XX12+2 or (S R) * XX12+2 LL123 (Flight) Calculate (Y X) = (S R) / XX12+2 or (S R) * XX12+2 LL129 (Docked) Calculate Q = XX12+2, A = S EOR XX12+3 and (S R) = |S R| LL129 (Flight) Calculate Q = XX12+2, A = S EOR XX12+3 and (S R) = |S R| LL28 (Docked) Calculate R = 256 * A / Q LL28 (Flight) Calculate R = 256 * A / Q LL38 (Docked) Calculate (S A) = (S R) + (A Q) LL38 (Flight) Calculate (S A) = (S R) + (A Q) LL5 (Docked) Calculate Q = SQRT(R Q) LL5 (Flight) Calculate Q = SQRT(R Q) LL61 (Docked) Calculate (U R) = 256 * A / Q LL61 (Flight) Calculate (U R) = 256 * A / Q LL62 (Docked) Calculate 128 - (U R) LL62 (Flight) Calculate 128 - (U R) MAD (Docked) Calculate (A X) = Q * A + (S R) MAD (Flight) Calculate (A X) = Q * A + (S R) MAS3 (Flight) Calculate A = x_hi^2 + y_hi^2 + z_hi^2 in the K% block MCASH (Docked) Add an amount of cash to the cash pot MCASH (Flight) Add an amount of cash to the cash pot MLS1 (Flight) Calculate (A P) = ALP1 * A MLS2 (Docked) Calculate (S R) = XX(1 0) and (A P) = A * ALP1 MLS2 (Flight) Calculate (S R) = XX(1 0) and (A P) = A * ALP1 MLTU2 (Docked) Calculate (A P+1 P) = (A ~P) * Q MLTU2 (Flight) Calculate (A P+1 P) = (A ~P) * Q MLU1 (Docked) Calculate Y1 = y_hi and (A P) = |y_hi| * Q for Y-th stardust MLU1 (Flight) Calculate Y1 = y_hi and (A P) = |y_hi| * Q for Y-th stardust MLU2 (Docked) Calculate (A P) = |A| * Q MLU2 (Flight) Calculate (A P) = |A| * Q MU1 (Docked) Copy X into P and A, and clear the C flag MU1 (Flight) Copy X into P and A, and clear the C flag MU11 (Docked) Calculate (A P) = P * X MU11 (Flight) Calculate (A P) = P * X MU5 (Docked) Set K(3 2 1 0) = (A A A A) and clear the C flag MU5 (Flight) Set K(3 2 1 0) = (A A A A) and clear the C flag MU6 (Docked) Set P(1 0) = (A A) MU6 (Flight) Set P(1 0) = (A A) MULT1 (Docked) Calculate (A P) = Q * A MULT1 (Flight) Calculate (A P) = Q * A MULT12 (Docked) Calculate (S R) = Q * A MULT12 (Flight) Calculate (S R) = Q * A MULT3 (Flight) Calculate K(3 2 1 0) = (A P+1 P) * Q MULTU (Docked) * Calculate (A P) = P * Q MULTU (Flight) * Calculate (A P) = P * Q MUT1 (Docked) Calculate R = XX and (A P) = Q * A MUT1 (Flight) Calculate R = XX and (A P) = Q * A MUT2 (Docked) Calculate (S R) = XX(1 0) and (A P) = Q * A MUT2 (Flight) Calculate (S R) = XX(1 0) and (A P) = Q * A MUT3 (Docked) An unused routine that does the same as MUT2 MUT3 (Flight) An unused routine that does the same as MUT2 PIX1 (Docked) Calculate (YY+1 SYL+Y) = (A P) + (S R) and draw stardust particle PIX1 (Flight) Calculate (YY+1 SYL+Y) = (A P) + (S R) and draw stardust particle ROOT (Loader 3) Calculate ZP = SQRT(ZP(1 0)) SPS2 (Flight) Calculate (Y X) = A / 10 SQUA (Docked) Clear bit 7 of A and calculate (A P) = A * A SQUA (Flight) Clear bit 7 of A and calculate (A P) = A * A SQUA2 (Docked) Calculate (A P) = A * A SQUA2 (Flight) Calculate (A P) = A * A SQUA2 (Loader 3) Calculate (A P) = A * A TAS1 (Flight) Calculate K3 = (x_sign x_hi x_lo) - V(1 0) TIS1 (Docked) Calculate (A ?) = (-X * A + (S R)) / 96 TIS1 (Flight) Calculate (A ?) = (-X * A + (S R)) / 96 TIS2 (Docked) Calculate A = A / Q TIS2 (Flight) Calculate A = A / Q TIS3 (Docked) Calculate -(nosev_1 * roofv_1 + nosev_2 * roofv_2) / nosev_3 TIS3 (Flight) Calculate -(nosev_1 * roofv_1 + nosev_2 * roofv_2) / nosev_3 Unused duplicate of MULTU (Docked) An unused duplicate of the MULTU routine Unused duplicate of MULTU (Flight) An unused duplicate of the MULTU routine VCSU1 (Flight) Calculate vector K3(8 0) = [x y z] - coordinates of the sun or space station VCSUB (Flight) Calculate vector K3(8 0) = [x y z] - coordinates in (A V) Maths (Geometry) Vectors, coordinates, dot products and matrices Subroutines ARCTAN (Flight) Calculate A = arctan(P / Q) FAROF (Flight) Compare x_hi, y_hi and z_hi with 224 FAROF2 (Flight) Compare x_hi, y_hi and z_hi with A LL51 (Docked) Calculate the dot product of XX15 and XX16 LL51 (Flight) Calculate the dot product of XX15 and XX16 MAS1 (Flight) Add an orientation vector coordinate to an INWK coordinate MAS2 (Flight) Calculate a cap on the maximum distance to the planet or sun MAS4 (Flight) Calculate a cap on the maximum distance to a ship NORM (Docked) * Normalise the three-coordinate vector in XX15 NORM (Flight) * Normalise the three-coordinate vector in XX15 PROJ (Flight) Project the current ship or planet onto the screen SPS1 (Docked) Calculate the vector to the planet and store it in XX15 SPS1 (Flight) Calculate the vector to the planet and store it in XX15 SPS3 (Docked) Copy a space coordinate from the K% block into K3 SPS3 (Flight) Copy a space coordinate from the K% block into K3 SPS4 (Flight) Calculate the vector to the space station TAS2 (Docked) Normalise the three-coordinate vector in K3 TAS2 (Flight) Normalise the three-coordinate vector in K3 TAS3 (Docked) Calculate the dot product of XX15 and an orientation vector TAS3 (Flight) Calculate the dot product of XX15 and an orientation vector TAS4 (Flight) Calculate the dot product of XX15 and one of the space station's orientation vectors TAS6 (Flight) Negate the vector in XX15 so it points in the opposite direction TIDY (Docked) * Orthonormalise the orientation vectors for a ship TIDY (Flight) * Orthonormalise the orientation vectors for a ship Variables ACT (Text tokens) Arctan table SNE (Text tokens) Sine/cosine table Missions Hunting stolen ships and evading Thargoids Subroutines BRIEF (Docked) Start mission 1 and show the mission briefing BRIEF2 (Docked) Start mission 2 BRIEF3 (Docked) Receive the briefing and plans for mission 2 BRIS (Docked) Clear the screen, display "INCOMING MESSAGE" and wait for 2 seconds BRP (Docked) Print an extended token and show the Status Mode screen DEBRIEF (Docked) Finish mission 1 DEBRIEF2 (Docked) Finish mission 2 PAS1 (Docked) Display a rotating ship at space coordinates (0, 112, 256) and scan the keyboard PAUSE (Docked) Display a rotating ship, waiting until a key is pressed, then remove the ship from the screen THERE (Flight) Check whether we are in the Constrictor's system in mission 1 Moving Moving and rotating ships and planets in space Subroutines MV40 (Flight) Rotate the planet or sun's location in space by the amount of pitch and roll of our ship MVEIT (Part 1 of 9) (Docked) Move current ship: Tidy the orientation vectors MVEIT (Part 1 of 9) (Flight) Move current ship: Tidy the orientation vectors MVEIT (Part 2 of 9) (Flight) Move current ship: Call tactics routine, remove ship from scanner MVEIT (Part 3 of 9) (Flight) Move current ship: Move ship forward according to its speed MVEIT (Part 4 of 9) (Flight) Move current ship: Apply acceleration to ship's speed as a one-off MVEIT (Part 5 of 9) (Flight) Move current ship: Rotate ship's location by our pitch and roll MVEIT (Part 6 of 9) (Flight) Move current ship: Move the ship in space according to our speed MVEIT (Part 7 of 9) (Docked) Move current ship: Rotate ship's orientation vectors by pitch/roll MVEIT (Part 7 of 9) (Flight) Move current ship: Rotate ship's orientation vectors by pitch/roll MVEIT (Part 8 of 9) (Docked) Move current ship: Rotate ship about itself by its own pitch/roll MVEIT (Part 8 of 9) (Flight) Move current ship: Rotate ship about itself by its own pitch/roll MVEIT (Part 9 of 9) (Docked) Move current ship: Redraw on scanner, if it hasn't been destroyed MVEIT (Part 9 of 9) (Flight) Move current ship: Redraw on scanner, if it hasn't been destroyed MVS4 (Docked) * Apply pitch and roll to an orientation vector MVS4 (Flight) * Apply pitch and roll to an orientation vector MVS5 (Docked) Apply a 3.6 degree pitch or roll to an orientation vector MVS5 (Flight) Apply a 3.6 degree pitch or roll to an orientation vector MVT1 (Docked) Calculate (x_sign x_hi x_lo) = (x_sign x_hi x_lo) + (A R) MVT1 (Flight) Calculate (x_sign x_hi x_lo) = (x_sign x_hi x_lo) + (A R) MVT3 (Docked) Calculate K(3 2 1) = (x_sign x_hi x_lo) + K(3 2 1) MVT3 (Flight) Calculate K(3 2 1) = (x_sign x_hi x_lo) + K(3 2 1) MVT6 (Docked) Calculate (A P+2 P+1) = (x_sign x_hi x_lo) + (A P+2 P+1) MVT6 (Flight) Calculate (A P+2 P+1) = (x_sign x_hi x_lo) + (A P+2 P+1) SFS2 (Flight) Move a ship in space along one of the coordinate axes Save and load Commander files and competition codes Subroutines BRKBK (Docked) Set the standard BRKV handler for the game CAT (Docked) Catalogue a disc, wait for a key press and display the disc access menu CATD (Loader 3) Load disc sectors 0 and 1 to &0E00 and &0F00 respectively CATDcode (Loader 3) The CATD routine, bundled up in the loader so it can be moved to &0D7A to be run CATS (Docked) Ask for a disc drive number and print a catalogue of that drive CHECK (Docked) Calculate the checksum for the last saved commander data block DELT (Docked) Catalogue a disc, ask for a filename to delete, and delete the file GTDRV (Docked) Get an ASCII disc drive number from the keyboard GTNMEW (Docked) Fetch the name of a commander file to save or load LOD (Docked) * Load a commander file MEBRK (Docked) The BRKV handler for disc access operations QUS1 (Docked) Save or load the commander file retry (Docked) Scan the keyboard until a key is pressed and display the disc access menu SVE (Docked) * Save the commander file TR1 (Docked) Copy the last saved commander's name from NA% to INWK TRNME (Docked) Copy the last saved commander's name from INWK to NA% Variables CHK (Loader 3) First checksum byte for the saved commander data file CHK2 (Loader 3) Second checksum byte for the saved commander data file CTLI (Docked) The OS command string for cataloguing a disc DELI (Docked) The OS command string for deleting a file NA% (Loader 3) The data block for the last saved commander S1% (Loader 3) The drive and directory number used when saving or loading a commander file stack (Docked) Temporary storage for the stack pointer when switching the BRKV handler between BRBR and MEBRK Ship hangar The ship hangar that's displayed on docking Subroutines HALL (Docked) Draw the ships in the ship hangar, then draw the hangar HANGER (Docked) Display the ship hangar HAS1 (Docked) Draw a ship in the ship hangar HAS2 (Docked) Draw a hangar background line from left to right HAS3 (Docked) Draw a hangar background line from right to left UNWISE (Docked) Switch the main line-drawing routine between EOR and OR logic Variables HATB (Docked) Ship hangar group table Sound Explosions, laser fire, hyperspace and more Subroutines BEEP (Docked) Make a short, high beep BEEP (Flight) Make a short, high beep BELL (Docked) Make a standard system beep BELL (Flight) Make a standard system beep ECMOF (Docked) Switch off the E.C.M. ECMOF (Flight) Switch off the E.C.M. EXNO (Docked) Make the sound of a laser strike or ship explosion EXNO (Flight) Make the sound of a laser strike or ship explosion EXNO3 (Docked) Make an explosion sound EXNO3 (Flight) Make an explosion sound NO3 (Docked) Make a sound from a prepared sound block NO3 (Flight) Make a sound from a prepared sound block NOISE (Docked) * Make the sound whose number is in A NOISE (Flight) * Make the sound whose number is in A NOS1 (Docked) Prepare a sound block NOS1 (Flight) Prepare a sound block Variables E% (Loader 3) Sound envelope definitions SFX (Docked) Sound data SFX (Flight) Sound data Macros FNE (Loader 3) Macro definition for defining a sound envelope Stardust Stardust generation and movement Subroutines FLIP (Docked) Reflect the stardust particles in the screen diagonal and redraw the stardust field FLIP (Flight) Reflect the stardust particles in the screen diagonal and redraw the stardust field nWq (Flight) Create a random cloud of stardust NWSTARS (Flight) Initialise the stardust field STARS (Flight) * The main routine for processing the stardust STARS1 (Flight) Process the stardust for the front view STARS2 (Flight) Process the stardust for the left or right view STARS6 (Flight) Process the stardust for the rear view Start and end The title screen... and the Game Over screen Subroutines BR1 (Part 1 of 2) (Docked) Show the "Load New Commander (Y/N)?" screen and start the game BR1 (Part 2 of 2) (Docked) Show the "Press Fire or Space, Commander" screen and start the game DEATH (Flight) * Display the death screen DEATH2 (Docked) Reset most of the game and restart from the title screen DEATH2 (Flight) Reset most of the game and restart from the title screen DFAULT (Docked) Reset the current commander data block to the last saved commander RES2 (Docked) Reset a number of flight variables and workspaces RES2 (Flight) Reset a number of flight variables and workspaces RESET (Docked) Reset most variables RESET (Flight) Reset most variables TITLE (Docked) * Display a title screen with a rotating ship and prompt TT170 (Docked) * Main entry point for the Elite game code Status Showing the commander's status and rank Subroutines BAD (Docked) Calculate how bad we have been BAD (Flight) Calculate how bad we have been BAY (Docked) Go to the docking bay (i.e. show the Status Mode screen) cmn (Docked) Print the commander's name cmn (Flight) Print the commander's name csh (Docked) Print the current amount of cash csh (Flight) Print the current amount of cash EXNO2 (Docked) Process us making a kill EXNO2 (Flight) Process us making a kill fwl (Docked) Print fuel and cash levels fwl (Flight) Print fuel and cash levels STATUS (Docked) * Show the Status Mode screen (red key f8) STATUS (Flight) * Show the Status Mode screen (red key f8) Tactics AI tactics for enemy ships and missiles Subroutines ANGRY (Flight) Make a ship hostile FR1 (Flight) Display the "missile jammed" message FRMIS (Flight) Fire a missile from our ship FRS1 (Flight) Launch a ship straight ahead of us, below the laser sights HITCH (Flight) * Work out if the ship in INWK is in our crosshairs SFRMIS (Flight) Add an enemy missile to our local bubble of universe TACTICS (Part 1 of 7) (Flight) Apply tactics: Process missiles, both enemy missiles and our own TACTICS (Part 2 of 7) (Flight) * Apply tactics: Escape pod, station, lone Thargon, safe-zone pirate TACTICS (Part 3 of 7) (Flight) Apply tactics: Calculate dot product to determine ship's aim TACTICS (Part 4 of 7) (Flight) Apply tactics: Check energy levels, maybe launch escape pod if low TACTICS (Part 5 of 7) (Flight) Apply tactics: Consider whether to launch a missile at us TACTICS (Part 6 of 7) (Flight) Apply tactics: Consider firing a laser at us, if aim is true TACTICS (Part 7 of 7) (Flight) Apply tactics: Set pitch, roll, and acceleration Text The game's recursive text tokenisation system Subroutines BPRNT (Docked) * Print a 32-bit number, left-padded to a specific number of digits, with an optional decimal point BPRNT (Flight) * Print a 32-bit number, left-padded to a specific number of digits, with an optional decimal point CHPR (Docked) Print a character at the text cursor by poking into screen memory crlf (Docked) Tab to column 21 and print a colon crlf (Flight) Tab to column 21 and print a colon DETOK (Docked) Print an extended recursive token from the TKN1 token table DETOK2 (Docked) Print an extended text token (1-255) DETOK3 (Docked) Print an extended recursive token from the RUTOK token table dn2 (Docked) Make a short, high beep and delay for 1 second ex (Docked) Print a recursive token ex (Flight) Print a recursive token FEED (Docked) Print a newline MT1 (Docked) Switch to ALL CAPS when printing extended tokens MT13 (Docked) Switch to lower case when printing extended tokens MT14 (Docked) Switch to justified text when printing extended tokens MT15 (Docked) Switch to left-aligned text when printing extended tokens MT16 (Docked) Print the character in variable DTW7 MT17 (Docked) Print the selected system's adjective, e.g. Lavian for Lave MT18 (Docked) Print a random 1-8 letter word in Sentence Case MT19 (Docked) Capitalise the next letter MT2 (Docked) Switch to Sentence Case when printing extended tokens MT23 (Docked) Move to row 10, switch to white text, and switch to lower case when printing extended tokens MT26 (Docked) Fetch a line of text from the keyboard MT27 (Docked) Print the captain's name during mission briefings MT28 (Docked) Print the location hint during the mission 1 briefing MT29 (Docked) Move to row 6, switch to white text, and switch to lower case when printing extended tokens MT5 (Docked) Switch to extended tokens MT6 (Docked) Switch to standard tokens in Sentence Case MT8 (Docked) Tab to column 6 and start a new word when printing extended tokens MT9 (Docked) Clear the screen and set the current view type to 1 plf (Docked) Print a text token followed by a newline plf (Flight) Print a text token followed by a newline plf2 (Docked) Print text followed by a newline and indent of 6 characters plf2 (Flight) Print text followed by a newline and indent of 6 characters pr2 (Docked) Print an 8-bit number, left-padded to 3 digits, and optional point pr2 (Flight) Print an 8-bit number, left-padded to 3 digits, and optional point pr5 (Docked) Print a 16-bit number, left-padded to 5 digits, and optional point pr5 (Flight) Print a 16-bit number, left-padded to 5 digits, and optional point pr6 (Docked) Print 16-bit number, left-padded to 5 digits, no point pr6 (Flight) Print 16-bit number, left-padded to 5 digits, no point prq (Docked) Print a text token followed by a question mark prq (Flight) Print a text token followed by a question mark qw (Docked) Print a recursive token in the range 128-145 qw (Flight) Print a recursive token in the range 128-145 spc (Docked) Print a text token followed by a space spc (Flight) Print a text token followed by a space TT11 (Docked) Print a 16-bit number, left-padded to n digits, and optional point TT11 (Flight) Print a 16-bit number, left-padded to n digits, and optional point TT162 (Docked) Print a space TT162 (Flight) Print a space TT26 (Docked) * Print a character at the text cursor, with support for verified text in extended tokens TT26 (Flight) * Print a character at the text cursor by poking into screen memory TT27 (Docked) * Print a text token TT27 (Flight) * Print a text token TT41 (Docked) Print a letter according to Sentence Case TT41 (Flight) Print a letter according to Sentence Case TT42 (Docked) Print a letter in lower case TT42 (Flight) Print a letter in lower case TT43 (Docked) Print a two-letter token or recursive token 0-95 TT43 (Flight) Print a two-letter token or recursive token 0-95 TT45 (Docked) Print a letter in lower case TT45 (Flight) Print a letter in lower case TT46 (Docked) Print a character and switch to capitals TT46 (Flight) Print a character and switch to capitals TT60 (Docked) Print a text token and a paragraph break TT60 (Flight) Print a text token and a paragraph break TT67 (Docked) Print a newline TT67 (Flight) Print a newline TT68 (Docked) Print a text token followed by a colon TT68 (Flight) Print a text token followed by a colon TT69 (Docked) Set Sentence Case and print a newline TT69 (Flight) Set Sentence Case and print a newline TT73 (Docked) Print a colon TT73 (Flight) Print a colon TT74 (Docked) Print a character TT74 (Flight) Print a character TTX69 (Docked) Print a paragraph break TTX69 (Flight) Print a paragraph break VOWEL (Docked) Test whether a character is a vowel Variables DTW1 (Docked) A mask for applying the lower case part of Sentence Case to extended text tokens DTW2 (Docked) A flag that indicates whether we are currently printing a word DTW3 (Docked) A flag for switching between standard and extended text tokens DTW4 (Docked) Flags that govern how justified extended text tokens are printed DTW5 (Docked) The size of the justified text buffer at BUF DTW6 (Docked) A flag to denote whether printing in lower case is enabled for extended text tokens DTW8 (Docked) A mask for capitalising the next letter in an extended text token JMTB (Docked) The extended token table for jump tokens 1-32 (DETOK) MTIN (Docked) Lookup table for random tokens in the extended token table (0-37) QQ16 (Docked) The two-letter token lookup table QQ18 (Text tokens) The recursive token table for tokens 0-148 RLINE (Docked) The OSWORD configuration block used to fetch a line of text from the keyboard RUGAL (Docked) The criteria for systems with extended description overrides RUPLA (Docked) System numbers that have extended description overrides RUTOK (Docked) The second extended token table for recursive tokens 0-26 (DETOK3) TENS (Docked) A constant used when printing large numbers in BPRNT TENS (Flight) A constant used when printing large numbers in BPRNT TKN1 (Docked) The first extended token table for recursive tokens 0-255 (DETOK) TKN2 (Docked) The extended two-letter token lookup table Macros CHAR (Text tokens) Macro definition for characters in the recursive token table CONT (Text tokens) Macro definition for control codes in the recursive token table ECHR (Docked) Macro definition for characters in the extended token table EJMP (Docked) Macro definition for jump tokens in the extended token table ERND (Docked) Macro definition for random tokens in the extended token table ETOK (Docked) Macro definition for recursive tokens in the extended token table ETWO (Docked) Macro definition for two-letter tokens in the extended token table RTOK (Text tokens) Macro definition for recursive tokens in the recursive token table TOKN (Docked) Macro definition for standard tokens in the extended token table TWOK (Text tokens) Macro definition for two-letter tokens in the token table Universe Ship spawning, local bubble, system/market data Subroutines cpl (Docked) Print the selected system name cpl (Flight) Print the selected system name GINF (Docked) Fetch the address of a ship's data block into INF GINF (Flight) Fetch the address of a ship's data block into INF GTHG (Flight) Spawn a Thargoid ship and a Thargon companion GVL (Flight) Calculate the availability of market items hyp1 (Docked) Process a jump to the system closest to (QQ9, QQ10) hyp1 (Flight) Process a jump to the system closest to (QQ9, QQ10) jmp (Docked) Set the current system to the selected system jmp (Flight) Set the current system to the selected system KILLSHP (Flight) * Remove a ship from our local bubble of universe KS1 (Flight) Remove the current ship from our local bubble of universe KS2 (Flight) Check the local bubble for missiles with target lock KS3 (Flight) Set the SLSP ship line heap pointer after shuffling ship slots KS4 (Flight) Remove the space station and replace it with the sun NwS1 (Docked) Flip the sign and double an INWK byte NwS1 (Flight) Flip the sign and double an INWK byte NWSHP (Docked) Add a new ship to our local bubble of universe NWSHP (Flight) Add a new ship to our local bubble of universe NWSPS (Flight) Add a new space station to our local bubble of universe PDESC (Docked) Print the system's extended description or a mission 1 directive ping (Docked) Set the selected system to the current system ping (Flight) Set the selected system to the current system SFS1 (Flight) * Spawn a child ship from the current (parent) ship SOLAR (Flight) Set up various aspects of arriving in a new system SOS1 (Flight) Update the missile indicators, set up the planet data block SPIN (Flight) Randomly spawn cargo from a destroyed ship tal (Docked) Print the current galaxy number tal (Flight) Print the current galaxy number TT111 (Docked) Set the current system to the nearest system to a point TT111 (Flight) Set the current system to the nearest system to a point TT146 (Docked) Print the distance to the selected system in light years TT146 (Flight) Print the distance to the selected system in light years TT20 (Docked) Twist the selected system's seeds four times TT20 (Flight) Twist the selected system's seeds four times TT24 (Docked) * Calculate system data from the system seeds TT24 (Flight) * Calculate system data from the system seeds TT25 (Docked) * Show the Data on System screen (red key f6) TT25 (Flight) * Show the Data on System screen (red key f6) TT54 (Docked) * Twist the selected system's seeds TT54 (Flight) * Twist the selected system's seeds TT70 (Docked) Display "MAINLY " and jump to TT72 TT70 (Flight) Display "MAINLY " and jump to TT72 TT81 (Docked) Set the selected system's seeds to those of system 0 TT81 (Flight) Set the selected system's seeds to those of system 0 ypl (Docked) Print the current system name ypl (Flight) Print the current system name Ze (Docked) Initialise the INWK workspace to a hostile ship Ze (Flight) Initialise the INWK workspace to a hostile ship ZINF (Docked) Reset the INWK workspace and orientation vectors ZINF (Flight) Reset the INWK workspace and orientation vectors Variables UNIV (Docked) Table of pointers to the local universe's ship data blocks UNIV (Flight) Table of pointers to the local universe's ship data blocks Utility routines Memory/screen clearing, delay routines Subroutines BRBR (Docked) The standard BRKV handler for the game DELAY (Docked) Wait for a specified time, in 1/50s of a second DELAY (Flight) Wait for a specified time, in 1/50s of a second FX200 (Docked) Set the behaviour of the ESCAPE and BREAK keys GTNMES (Docked) An unused routine that fetches the name of a commander file MPL (Loader 2) Move two pages of memory from LOADcode to LOAD and jump to ENTRY2 MVBL (Loader 3) Decrypt and move a multi-page block of memory MVPG (Loader 3) Decrypt and move a page of memory OSB (Loader 3) A convenience routine for calling OSBYTE with Y = 0 ZEBC (Docked) Zero-fill pages &B and &C ZERO (Docked) Reset the local bubble of universe and ship status ZERO (Flight) Reset the local bubble of universe and ship status ZES1 (Docked) Zero-fill the page whose number is in X ZES1 (Flight) Zero-fill the page whose number is in X ZES2 (Docked) Zero-fill a specific page ZES2 (Flight) Zero-fill a specific page Variables brkd (Docked) The brkd counter for error handling Unused block (Docked) These bytes appear to be unused (the same block appears in both the flight and docked code) Unused block (Flight) These bytes appear to be unused (the same block appears in both the flight and docked code) Workspaces Collections of important variables into blocks Workspaces K% (Docked) * Ship data blocks and ship line heaps K% (Flight) * Ship data blocks and ship line heaps S% (Docked) Entry points and vector addresses in the main docked code S% (Flight) Entry points and vector addresses in the main flight code UP (Docked) Ship slots, variables UP (Flight) Ship slots, variables WP (Docked) Variables WP (Flight) Variables XX3 (Docked) Temporary storage space for complex calculations XX3 (Flight) Temporary storage space for complex calculations ZP (Docked) * Lots of important variables are stored in the zero page workspace as it is quicker and more space-efficient to access memory here ZP (Flight) * Lots of important variables are stored in the zero page workspace as it is quicker and more space-efficient to access memory here ZP (Loader 1) * Important variables used by the loader ZP (Loader 2) * Important variables used by the loader ZP (Loader 3) * Important variables used by the loader ZP (Sideways RAM Loader) * Important variables used by the sideways RAM loader 6502 Second Processor source code The fastest and most colourful version of Elite Version information About the 6502 Second Processor versionInformation on the fastest version of Elite Different variants of the 6502 Second Processor versionCode variations found in 6502 Second Processor Elite 6502 Second Processor source code by file Map of the source code An overview of how the source code for Elite is structured Annotated original source files The source files in their original structure Game loader Loader 1 source The Saturn loading screen, copy protection and setup for the main game Loader 2 source The rest of the loading screen and main game loader Main game Workspaces and configuration The main variable workspaces used in Elite Text tokens Elite's tokenised game text Elite A source Part 1 of the main game code Elite B source Part 2 of the main game code Elite C source Part 3 of the main game code Elite D source Part 4 of the main game code Elite E source Part 5 of the main game code Elite F source Part 6 of the main game code Elite G source Part 7 of the main game code Elite H source Part 8 of the main game code Elite I source Part 9 of the main game code Elite J source Part 10 of the main game code Ship blueprints Data for the 33 different ship designs I/O processor source I/O processor source The I/O processor source Big Code File Big Code File source Concatenates the individual source code parts into one big game file 6502 Second Processor source code by category Charts Long-range and short-range galactic charts Subroutines 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 TT22 * Show the Long-range Chart (red key f4) TT23 * Show the Short-range Chart (red key f5) Copy protection Hiding the Elite code from prying eyes Subroutines Checksum Checksum the code from &1000 to &9FFF and check against S%-1 DEEOR Decrypt bytes between &1300 and &9FFF by EOR'ing them with their page offset do65C02 (I/O processor) Reverse the order of all bytes between the addresses in (1 0) and (3 2) and start the game SOMEPROT (I/O processor) Implement the OSWORD 249 command (some copy protection) Variables copyright (Loader 1) A copyright notice, buried in the code Firebird The name "Firebird", buried in the code of the Executive version Dashboard The dials, 3D scanner and compass Subroutines ABORT Disarm missiles and update the dashboard indicators ABORT2 Set/unset the lock target for a missile and update the dashboard ADPARAMS (I/O processor) Implement the OSWRCH 137 command (add a dashboard parameter and update the dashboard when all are received) 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 * Update the dashboard indicators and flight variables by sending a #RDPARAMS command to the I/O processor DIALS (Part 1 of 4) (I/O processor) Update the dashboard: speed indicator DIALS (Part 2 of 4) (I/O processor) Update the dashboard: pitch and roll indicators DIALS (Part 3 of 4) (I/O processor) Update the dashboard: four energy banks DIALS (Part 4 of 4) (I/O processor) Update the dashboard: shields, fuel, laser & cabin temp, altitude DIL2 (I/O processor) Update the roll or pitch indicator on the dashboard DILX (I/O processor) * Update a bar-based indicator on the dashboard DOBULB (I/O processor) Implement the #DOBULB 0 command (draw the space station indicator bulb) DOT (I/O processor) Implement the #DOdot command (draw a dash on the compass) ECBLB Light up the E.C.M. indicator bulb ("E") on the dashboard by sending a #DOBULB 255 command to the I/O processor ECBLB (I/O processor) Implement the #DOBULB 255 command (draw the E.C.M. indicator bulb) 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 by sending a #DOmsbar command to the I/O processor MSBAR (I/O processor) Implement the #DOmsbar command (draw a specific indicator in the dashboard's missile bar) msblob Display the dashboard's missile indicators in green PZW (I/O processor) Fetch the current dashboard colours, to support flashing PZW2 (I/O processor) Fetch the current dashboard colours for non-striped indicators, to support flashing RDPARAMS (I/O processor) Implement the #RDPARAMS command (start receiving a new set of parameters for updating the dashboard) REDU2 Reduce the value of the pitch or roll dashboard indicator SC48 (I/O processor) Implement the #onescan command (draw a ship on the 3D scanner) 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 by sending a #DOBULB 0 command to the I/O processor WPSHPS Clear the scanner, reset the ball line and sun line heaps Variables ECBT (I/O processor) The character bitmap for the E.C.M. indicator bulb SCANpars The scanner buffer to send with the #onescan command SPBT (I/O processor) The bitmap definition for the space station indicator bulb Demo Star Wars scroll texts and a huge Elite logo Subroutines DEMON Show the demo GRIDSET Populate the line coordinate tables with the lines for the scroll text GRS1 Populate the line coordinate tables with the lines for a single scroll text character SLIDE Display a Star Wars scroll text TWIST Pitch the current ship by a small angle in a positive direction ZZAAP Draw a vertical red laser line from (128, 67) to (128, 160) Variables acorn The text for the demo's opening scroll text byian The text for the demo's middle scroll text executive Extra text for the demo in the Executive version HIMCNT Used as a loop counter for the Cobra's slow approach in the demo LTDEF Line definitions for characters in the Star Wars scroll text NOFX The x-coordinates of the scroll text letter grid NOFY The y-coordinates of the scroll text letter grid true3 The text for the demo's final scroll text Drawing circles Hyperspace tunnels, launch rings and planets Subroutines 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) DOHFX (I/O processor) Implement the #DOHFX command (update the hyperspace effect flag) 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 LS2FL Draw the contents of the ball line heap by sending an OSWRCH 129 command to the I/O processor TT128 * Draw a circle on a chart TT14 Draw a circle with crosshairs on a chart Drawing lines The core line-drawing routines Subroutines ADDBYT (I/O processor) Implement the OSWRCH 130 command (add a byte to a line and draw it when all bytes are received) BEGINLIN (I/O processor) Implement the OSWRCH 129 command (start receiving a new line to draw) EDGES Draw a horizontal line given a centre and a half-width HBFL Draw the sun lines in the horizontal line buffer in orange by sending an OSWORD 247 command to the I/O processor HBZE Reset the horizontal line buffer HLOIN * Add a sun line to the horizontal line buffer HLOIN (I/O processor) * Implement the OSWORD 247 command (draw the sun lines in the horizontal line buffer in orange) HLOIN2 Remove a line from the sun line heap and draw it on-screen HLOIN2 (I/O processor) Draw a horizontal line in a specific colour LASLI Draw the laser lines for when we fire our lasers LBFL Draw the lines in the multi-segment line buffer by sending an OSWRCH 129 command to the I/O processor 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 LL30 Draw a one-segment line by sending an OSWRCH 129 command to the I/O processor LOIN Add a line segment to the multi-segment line buffer LOIN (Part 1 of 7) (I/O processor) * Draw a line: Calculate the line gradient in the form of deltas LOIN (Part 2 of 7) (I/O processor) Draw a line: Line has a shallow gradient, step right along x-axis LOIN (Part 3 of 7) (I/O processor) Draw a shallow line going right and up or left and down LOIN (Part 4 of 7) (I/O processor) Draw a shallow line going right and down or left and up LOIN (Part 5 of 7) (I/O processor) Draw a line: Line has a steep gradient, step up along y-axis LOIN (Part 6 of 7) (I/O processor) Draw a steep line going up and left or down and right LOIN (Part 7 of 7) (I/O processor) 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 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 TT15 Draw a set of crosshairs Variables HBUF The horizontal line buffer to send with the OSWORD 247 command LBUF The multi-segment line buffer used by LOIN LSX2 The ball line heap for storing x-coordinates LSY2 The ball line heap for storing y-coordinates TABLE (I/O processor) The line buffer for line data transmitted from the parasite TWFL Ready-made character rows for the left end of a horizontal line in mode 4 TWFR Ready-made character rows for the right end of a horizontal line in mode 4 Drawing pixels How to plot pixels in various colours Subroutines CPIX2 (I/O processor) * Draw a single-height dash on the dashboard CPIX4 (I/O processor) Draw a double-height dot on the dashboard DOT Draw a dash on the compass by sending a #DOdot command to the I/O processor PBFL Draw the pixel in the pixel buffer by sending an OSWORD 241 command to the I/O processor PBZE Reset the pixel buffer PIX (Loader 1) Draw a single pixel at a specific coordinate PIXEL * Add a white dot at a specific distance to the pixel buffer (2-pixel dash or 4-pixel square) PIXEL (I/O processor) * Implement the OSWORD 241 command (draw space view pixels) PIXEL2 Draw a stardust particle relative to the screen centre PIXEL3 Add a coloured dot at a specific distance to the pixel buffer (1-pixel dot, 2-pixel dash or 4-pixel square) Variables CTWOS Ready-made single-pixel character row bytes for mode 5 CTWOS (I/O processor) Ready-made single-pixel character row bytes for mode 2 orange (I/O processor) Lookup table for 2-pixel mode 1 orange pixels for the sun PBUF The pixel buffer to send with the OSWORD 241 command PXCL (I/O processor) A four-colour mode 1 pixel byte that represents a dot's distance TWFL (I/O processor) Ready-made character rows for the left end of a horizontal line TWFR (I/O processor) Ready-made character rows for the right end of a horizontal line TWOS Ready-made single-pixel character row bytes for mode 4 TWOS (I/O processor) Ready-made single-pixel character row bytes for mode 1 TWOS (Loader 1) Ready-made single-pixel character row bytes for mode 1 TWOS2 Ready-made double-pixel character row bytes for mode 4 TWOS2 (I/O processor) Ready-made double-pixel character row bytes for mode 1 ylookup (I/O processor) Lookup table for converting pixel y-coordinate to page number of screen address Drawing planets Planets with meridians and craters Subroutines 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 (Part 1 of 3) (Loader 1) Draw Saturn on the loading screen (draw the planet) PLL1 (Part 2 of 3) (Loader 1) Draw Saturn on the loading screen (draw the stars) PLL1 (Part 3 of 3) (Loader 1) Draw Saturn on the loading screen (draw the rings) PLS1 Calculate (Y A) = nosev_x / z PLS2 Draw a half-ellipse PLS22 * Draw an ellipse or half-ellipse 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+1 P) / (z_sign z_hi z_lo) Variables CNT (Loader 1) A counter for use in drawing Saturn's planetary body CNT2 (Loader 1) A counter for use in drawing Saturn's background stars CNT3 (Loader 1) A counter for use in drawing Saturn's rings RAND (Loader 1) The random number seed used for drawing Saturn Drawing ships The celebrated 3D ship plotting process Subroutines DOEXP * Draw an exploding ship 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 LL9 (Part 11 of 12) Draw ship: Add all visible edges to the ship line heap LL9 (Part 12 of 12) Draw ship: Draw all the visible edges from the ship line heap SHPPT Draw a distant ship as a point rather than a full wireframe Variables E% Ship blueprints default NEWB flags scacol Ship colours on the scanner SHIP_ADDER Ship blueprint for an Adder SHIP_ANACONDA Ship blueprint for an Anaconda SHIP_ASP_MK_2 Ship blueprint for an Asp Mk II SHIP_ASTEROID Ship blueprint for an asteroid SHIP_BOA Ship blueprint for a Boa SHIP_BOULDER Ship blueprint for a boulder SHIP_CANISTER Ship blueprint for a cargo canister SHIP_COBRA_MK_1 Ship blueprint for a Cobra Mk I SHIP_COBRA_MK_3 Ship blueprint for a Cobra Mk III SHIP_COBRA_MK_3_P Ship blueprint for a Cobra Mk III (pirate) SHIP_CONSTRICTOR Ship blueprint for a Constrictor SHIP_CORIOLIS Ship blueprint for a Coriolis space station SHIP_COUGAR Ship blueprint for a Cougar SHIP_DODO Ship blueprint for a Dodecahedron ("Dodo") space station SHIP_ESCAPE_POD Ship blueprint for an escape pod SHIP_FER_DE_LANCE Ship blueprint for a Fer-de-Lance SHIP_GECKO Ship blueprint for a Gecko SHIP_KRAIT Ship blueprint for a Krait SHIP_LOGO Ship blueprint for the Elite logo SHIP_MAMBA Ship blueprint for a Mamba SHIP_MISSILE Ship blueprint for a missile SHIP_MORAY Ship blueprint for a Moray SHIP_PLATE Ship blueprint for an alloy plate SHIP_PYTHON Ship blueprint for a Python SHIP_PYTHON_P Ship blueprint for a Python (pirate) SHIP_ROCK_HERMIT Ship blueprint for a rock hermit (asteroid) SHIP_SHUTTLE Ship blueprint for a Shuttle SHIP_SIDEWINDER Ship blueprint for a Sidewinder SHIP_SPLINTER Ship blueprint for a splinter SHIP_THARGOID Ship blueprint for a Thargoid mothership SHIP_THARGON Ship blueprint for a Thargon SHIP_TRANSPORTER Ship blueprint for a Transporter SHIP_VIPER Ship blueprint for a Viper SHIP_WORM Ship blueprint for a Worm shpcol Ship colours XX21 Ship blueprints lookup table Macros EDGE Macro definition for adding edges to ship blueprints FACE Macro definition for adding faces to ship blueprints VERTEX Macro definition for adding vertices to ship blueprints Drawing suns The epic, shimmering Elite sun Subroutines FLFLLS Reset the sun line heap 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 Drawing the screen The split-screen mode and different screen views Subroutines cls (I/O processor) Clear the top part of the screen and draw a white border CLYNS Clear the bottom three text rows of the mode 1 screen by sending a #clyns command to the I/O processor CLYNS (I/O processor) Implement the #clyns command (clear the bottom of the screen) DET1 Show or hide the dashboard (for when we die) by sending a #DODIALS command to the I/O processor DODIALS (I/O processor) Implement the #DODIALS command (show or hide the dashboard) DOVDU19 Change the mode 1 palette by sending a #SETVDU19 command to the I/O processor IRQ1 (I/O processor) * The main screen-mode interrupt handler (IRQ1V points here) SETVDU19 (I/O processor) Implement the #SETVDU19 command (change mode 1 palette) TRADEMODE Clear the screen and set up a printable trading screen TT66 Clear the screen and set the current view type TTX66 Send control code 11 to the I/O processor to clear the top part of the screen and draw a white border TTX66 (I/O processor) Clear the top part of the screen and draw a white border WSCAN Ask the I/O processor to wait for the vertical sync by sending a #wscn command to the I/O processor WSCAN (I/O processor) Implement the #wscn command (wait for the vertical sync) Variables B% (Loader 1) VDU commands for setting the square mode 1 screen TVT1 (I/O processor) Palette data for the mode 2 part of the screen (the dashboard) TVT3 (I/O processor) Palette data for the mode 1 part of the screen (the top part) Equipment Buying and selling weapons and ship upgrades Subroutines 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 refund Install a new laser, processing a refund if applicable Variables PRXS Equipment prices Flight Docking, hyperspace, views, shields and more Subroutines 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, show the ship hangar and work out any mission progression DOFE21 (I/O processor) Implement the #DOFE21 command (show the energy bomb effect) 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 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 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 WARP * Perform an in-system jump wW Start a hyperspace countdown Keyboard Processing key presses and joysticks Subroutines 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 DKS2 Read the joystick position DKS3 Toggle a configuration setting and emit a beep DKS4 Scan for a particular key press by sending a #DODKS4 command to the I/O processor DODKS4 (I/O processor) Implement the #DODKS4 command (scan the keyboard to see if a specific key is being pressed) DOKEY * Scan for the seven primary flight controls and apply the docking computer manoeuvring code DOVIAE (I/O processor) Implement the #VIAE command (enable/disable interrupts) FLKB Flush the keyboard buffer KEYBOARD (I/O processor) Implement the OSWORD 240 command (scan the keyboard and joystick and log the results) PAUSE2 Wait until a key is pressed, ignoring any existing key press RDKEY Scan the keyboard for key presses by sending an OSWORD 240 command to the I/O processor TT102 * Process function 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 ZEKTRAN Reset the key logger buffer at KTRAN Variables KTRAN The key logger buffer that gets updated by the OSWORD 240 command KYTB Lookup table for in-flight keyboard controls KYTB (I/O processor) Lookup table for in-flight keyboard controls TRANTABLE Translation table from internal key number to ASCII Macros DKS4 (I/O processor) Scan the keyboard to see if a specific key is being pressed Loader The loading screen and system setup Subroutines BEGIN Initialise the configuration variables and start the game COLD Copy the recursive tokens and ship blueprints to their correct locations Elite loader (Loader 1) Check for a 6502 Second Processor, perform a number of OS calls, set up sound and run the second loader Elite loader (Part 1 of 2) (Loader 2) Move loading screen binaries into screen memory and load and run the main game code Elite loader (Part 2 of 2) (Loader 2) Include binaries for loading screen and dashboard images S% Checksum, decrypt and unscramble the main game code, and start the game STARTUP (I/O processor) Set the various vectors, interrupts and timers, and terminate the loading process so the vector handlers can take over Variables MESS1 (Loader 1) The OS command string for changing the disc directory to E MESS2 (Loader 1) The OS command string for running the second part of the loader in file ELITEa MESS2 (Loader 2) The OS command string for running the I/O processor's main game code in file I.CODE MESS3 (Loader 2) The OS command string for running the parasite's main game code in file P.CODE RDLI The OS command string for running the flight code in file D.CODE in the disc version of Elite Main loop The core loop that runs Elite Subroutines 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 (red function keys, docked keys) Market Market prices, selling, buying and inventory Subroutines 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 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 (red key f7) TT16a Print "g" (for grams) TT208 * Show the Sell Cargo screen (red key f2) TT210 Show a list of current cargo in our hold, optionally to sell TT213 * Show the Inventory screen (red key f9) TT219 * Show the Buy Cargo screen (red key f1) var Calculate QQ19+3 = economy * |economic_factor| Variables QQ23 Market prices table Macros ITEM Macro definition for the market prices table Maths (Arithmetic) Addition, subtraction, multiplication, division Subroutines ADD * Calculate (A X) = (A P) + (S R) ADD (I/O processor) * Calculate (A X) = (A P) + (S R) DORND * Generate random numbers DORND (Loader 1) * Generate random numbers 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 DVID4 (I/O processor) * 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 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 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 ROOT (Loader 1) 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 1) 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 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) Variables antilog Binary antilogarithm table antilog (I/O processor) Binary antilogarithm table antilogODD Binary antilogarithm table antilogODD (I/O processor) Binary antilogarithm table log Binary logarithm table (high byte) log (I/O processor) Binary logarithm table (high byte) logL Binary logarithm table (low byte) logL (I/O processor) Binary logarithm table (low byte) Maths (Geometry) Vectors, coordinates, dot products and matrices Subroutines 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 PROJ Project the current ship or planet onto the screen 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 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 Variables ACT Arctan table SNE Sine/cosine table Missions Hunting stolen ships and evading Thargoids Subroutines 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 DEBRIEF Finish mission 1 DEBRIEF2 Finish mission 2 PAS1 Display a rotating ship at space coordinates (0, 112, 256) and scan the keyboard PAUSE Display a rotating ship, waiting until a key is pressed, then remove the ship from the screen THERE Check whether we are in the Constrictor's system in mission 1 Moving Moving and rotating ships and planets in space Subroutines MV40 Rotate the planet or sun's location in space by the amount of pitch and roll of our ship 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 Commander files and competition codes Subroutines BRKBK Set the standard BRKV handler for the game CAT Catalogue a disc, wait for a key press and display the disc access menu CATS Ask for a disc drive number and print a catalogue of that drive CHECK Calculate the checksum for the last saved commander data block DELT Catalogue a disc, ask for a filename to delete, and delete the file DOCATF (I/O processor) Implement the #DOCATF command (update the disc catalogue flag) DODOSVN Set the SVN ("save in progress") flag by sending a #DOsvn command to the I/O processor DOSVN (I/O processor) Implement the #DOSVN command (update the "save in progress" flag) GTDRV Get an ASCII disc drive number from the keyboard GTNMEW Fetch the name of a commander file to save or load LOD * Load a commander file MEBRK The BRKV handler for disc access operations QUS1 Save or load the commander file retry Scan the keyboard until a key is pressed and display the disc access menu savscr Save a screenshot if CTRL-D is pressed when the game is paused SVE * Display the disc 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% Variables CHK First checksum byte for the saved commander data file CHK2 Second checksum byte for the saved commander data file CTLI The OS command string for cataloguing a disc DELI The OS command string for deleting a file NA% The data block for the last saved commander oscobl OSFILE configuration block for saving a screenshot oscobl2 Master OSFILE configuration block for saving a screenshot S1% The drive and directory number used when saving or loading a commander file scname Filename to be used when saving a screenshot stack Temporary storage for the stack pointer when switching the BRKV handler between BRBR and MEBRK Ship hangar The ship hangar that's displayed on docking Subroutines HAL3 (I/O processor) Draw a hangar background line from left to right, stopping when it bumps into existing on-screen content HALL Draw the ships in the ship hangar, then draw the hangar by sending an OSWORD 248 command to the I/O processor HANGER (I/O processor) Implement the OSWORD 248 command (display the ship hangar) HAS1 Draw a ship in the ship hangar HAS2 (I/O processor) Draw a hangar background line from left to right HAS3 (I/O processor) Draw a hangar background line from right to left UNWISE Switch the main line-drawing routine between EOR and OR logic Variables HATB Ship hangar group table Sound Explosions, laser fire, hyperspace and more Subroutines BEEP Make a short, high beep BELL Make a standard system beep ECMOF Switch off the E.C.M. EXNO Make the sound of a laser strike or ship explosion 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 TALK Speak using the Watford Electronics Beeb Speech Synthesiser Variables E% (Loader 1) Sound envelope definitions SFX Sound data SPEECH Phrases for the Watford Electronics Beeb Speech Synthesiser Macros FNE (Loader 1) Macro definition for defining a sound envelope Stardust Stardust generation and movement Subroutines 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 The title screen... and the Game Over screen Subroutines 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 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 Showing the commander's status and rank Subroutines 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 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 (red key f8) Tactics AI tactics for enemy ships and missiles Subroutines 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 The game's recursive text tokenisation system Subroutines BPRNT * Print a 32-bit number, left-padded to a specific number of digits, with an optional decimal point CHPR Send a character to the I/O processor for printing or processing crlf Tab to column 21 and print a colon 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 short, high beep and delay for 1 second DOCOL Set the text colour by sending a #SETCOL command to the I/O processor DOCOL (I/O processor) Implement the #SETCOL command (set the current colour) DOXC Move the text cursor to a specified column by sending a #SETXC command to the I/O processor DOYC Move the text cursor to a specified row by sending a #SETYC command to the I/O processor ex Print a recursive token FEED Print a newline INCYC Move the text cursor to the next row label Send a two-byte OSWRCH command to the I/O processor 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 10, switch to white text, 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 6, switch to white text, 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 POSWRCH (I/O processor) Print a character on the printer only 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 prilf (I/O processor) Implement the #prilf command (print a blank line on the printer) printer (I/O processor) Implement the #printcode command (print a character on the printer and screen) prq Print a text token followed by a question mark qw Print a recursive token in the range 128-145 SETXC (I/O processor) Implement the #SETXC command (move the text cursor to a specific column) SETYC (I/O processor) Implement the #SETYC command (move the text cursor to a specific row) spc Print a text token followed by a space tosend (I/O processor) Print a printable character and return to the printer routine TT11 Print a 16-bit number, left-padded to n digits, and optional point TT162 Print a space TT26 * Print a character at the text cursor, with support for verified text in extended tokens TT26 (I/O processor) * Print a character at the text cursor by poking into screen memory 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 TT67 (I/O processor) 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 Variables DTW1 A mask for applying the lower case part of Sentence Case to extended text tokens DTW2 A flag that indicates whether we are currently printing a word DTW3 A flag for switching between standard and extended text tokens DTW4 Flags that govern how justified extended text tokens are printed DTW5 The size of the justified text buffer at BUF DTW6 A flag to denote whether printing in lower case is enabled for extended text tokens DTW8 A mask for capitalising the next letter in an extended text token FONT% (I/O processor) A copy of the character definition bitmap table from the MOS ROM JMTB The extended token table for jump tokens 1-32 (DETOK) MTIN Lookup table for random tokens in the extended token table (0-37) printflag A flag that determines whether to send text output to the printer as well as the screen QQ16 The two-letter token lookup table QQ18 The recursive token table for tokens 0-148 RLINE The OSWORD configuration block used to fetch a line of text from the keyboard RUGAL The criteria for systems with extended description overrides RUPLA System numbers that have extended description overrides RUTOK The second extended token table for recursive tokens 0-26 (DETOK3) TENS A constant used when printing large numbers in BPRNT TKN1 The first extended token table for recursive tokens 0-255 (DETOK) TKN2 The extended two-letter token lookup table Macros CHAR Macro definition for characters in the recursive token table CONT Macro definition for control codes in the recursive token table ECHR Macro definition for characters in the extended token table EJMP Macro definition for jump tokens in the extended token table ERND Macro definition for random tokens in the extended token table ETOK Macro definition for recursive tokens in the extended token table ETWO Macro definition for two-letter tokens in the extended token table RTOK Macro definition for recursive tokens in the recursive token table TOKN Macro definition for standard tokens in the extended token table TWOK Macro definition for two-letter tokens in the token table Tube Communicating with the Second Processor in Elite Subroutines newosrdch (I/O processor) The custom OSRDCH routine for reading characters NWOSWD (I/O processor) The custom OSWORD routine PUTBACK (I/O processor) Reset the OSWRCH vector in WRCHV to point to USOSWRCH USOSWRCH (I/O processor) The custom OSWRCH routine for writing characters and implementing jump table commands Variables JMPTAB (I/O processor) The lookup table for OSWRCH jump commands (128-147) OSWVECS (I/O processor) The lookup table for OSWORD jump commands (240-255) Universe Ship spawning, local bubble, system/market data Subroutines 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 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 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 PDESC Print the system's extended description or a mission 1 directive 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 SPIN Randomly spawn cargo from a destroyed ship STORE Copy the ship data block at INWK back to the K% workspace tal Print the current galaxy number TT111 Set the current system to the nearest system to a point 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 (red key f6) TT54 * Twist the selected system's seeds TT70 Display "MAINLY " and jump to TT72 TT81 Set the selected system's seeds to those of system 0 ypl Print the current system name Ze Initialise the INWK workspace to a hostile ship ZINF Reset the INWK workspace and orientation vectors ZINF2 Reset the INWK workspace and orientation vectors Variables spasto Contains the address of the Coriolis space station's ship blueprint UNIV Table of pointers to the local universe's ship data blocks Utility routines Memory/screen clearing, delay routines Subroutines 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 DELAY Wait for a specified time, in 1/50s of a second DOBRK (I/O processor) Implement the OSWRCH 145 command (execute a BRK instruction) FX200 Set the behaviour of the ESCAPE and BREAK keys MVBL (Loader 2) Move a multi-page block of memory from one location to another OSB (Loader 1) A convenience routine for calling OSBYTE with Y = 0 SCLI2 Execute an OS command, setting the SVN flag while it's running 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 ZES1 (I/O processor) Zero-fill the page whose number is in X ZES2 Zero-fill a specific page ZES2 (I/O processor) Zero-fill a specific page ZEVB Zero-fill the Y1VB variable Variables brkd The brkd counter for error handling F% Denotes the end of the main game code, from Elite A to Elite J Macros MVE (Loader 2) Move a one-page block of memory from one location to another Workspaces Collections of important variables into blocks Workspaces I/O variables (I/O processor) Various variables used by the I/O processor K% * Ship data blocks LP Variables used for displaying the scrolling text in the demo Parasite variables Various variables used by the parasite TINA (I/O processor) The code block for the TINA hook UP Ship slots, variables WP Variables XX3 Temporary storage space for complex calculations ZP * Lots of important variables are stored in the zero page workspace as it is quicker and more space-efficient to access memory here ZP (I/O processor) * Important variables used by the I/O processor ZP (Loader 1) * Important variables used by the loader ZP (Loader 2) * Important variables used by the loader BBC Master source code The smoothest animation of all the BBC versions Version information About the BBC Master versionInformation on the smoothest version of Elite Different variants of the BBC Master versionCode variations found in BBC Master Elite BBC Master source code by file Map of the source code An overview of how the source code for Elite is structured Annotated original source files The source files in their original structure Game loader Loader source The loading screen and setup for the main game Main game Workspaces and configuration The main variable workspaces used in Elite Elite A source Part 1 of the main game code Elite B source Part 2 of the main game code Elite C source Part 3 of the main game code Elite D source Part 4 of the main game code Elite E source Part 5 of the main game code Elite F source Part 6 of the main game code Elite G source Part 7 of the main game code Elite H source Part 8 of the main game code Game data Game data source The game data file, which contains the dashboard image, ship blueprints and text tokens Ship blueprints Data for the 33 different ship designs Text tokens Elite's tokenised game text BBC Master source code by category Charts Long-range and short-range galactic charts Subroutines 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 TT22 * Show the Long-range Chart (red key f4) TT23 * Show the Short-range Chart (red key f5) Dashboard The dials, 3D scanner and compass Subroutines ABORT Disarm missiles and update the dashboard indicators ABORT2 Set/unset the lock target for a missile and update 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 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 msblob Display the dashboard's missile indicators in green PZW Fetch the current dashboard colours, to support flashing PZW2 Fetch the current dashboard colours for non-striped indicators, 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 Variables ECBT The character bitmap for the E.C.M. indicator bulb SPBT The bitmap definition for the space station indicator bulb Drawing circles Hyperspace tunnels, launch rings and planets Subroutines 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) 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 The core line-drawing routines Subroutines 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 DVLOIN Draw a horizontal line from (A, 24) to (A, 152) 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 Draw a one-segment line 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 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 TT15 Draw a set of crosshairs Variables BOMBPOS A set of x-coordinates that are used as the basis for the energy bomb's zig-zag lightning bolt BOMBTBX This is where we store the x-coordinates for the energy bomb's zig-zag lightning bolt BOMBTBY This is where we store the y-coordinates for the energy bomb's zig-zag lightning bolt SIGHTCOL Colours for the crosshair sights on the different laser types Drawing pixels How to plot pixels in various colours Subroutines CPIXK Draw a single-height dash 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 Variables CTWOS Ready-made single-pixel character row bytes for mode 2 orange Lookup table for 2-pixel mode 1 orange pixels for the sun PXCL A four-colour mode 1 pixel byte that represents a dot's distance TWFL Ready-made character rows for the left end of a horizontal line TWFR Ready-made character rows for the right end of a horizontal line TWOS Ready-made single-pixel character row bytes for mode 1 TWOS (Loader) Ready-made single-pixel character row bytes for mode 1 TWOS2 Ready-made double-pixel character row bytes for mode 1 ylookup Lookup table for converting pixel y-coordinate to page number of screen address Drawing planets Planets with meridians and craters Subroutines 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 (Part 1 of 3) (Loader) Draw Saturn on the loading screen (draw the planet) PLL1 (Part 2 of 3) (Loader) Draw Saturn on the loading screen (draw the stars) PLL1 (Part 3 of 3) (Loader) Draw Saturn on the loading screen (draw the rings) PLS1 Calculate (Y A) = nosev_x / z PLS2 Draw a half-ellipse PLS22 * Draw an ellipse or half-ellipse 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+1 P) / (z_sign z_hi z_lo) WP1 Reset the ball line heap WPLS2 Remove the planet from the screen Variables CNT (Loader) A counter for use in drawing Saturn's planetary body CNT2 (Loader) A counter for use in drawing Saturn's background stars CNT3 (Loader) A counter for use in drawing Saturn's rings RAND (Loader) The random number seed used for drawing Saturn Drawing ships The celebrated 3D ship plotting process Subroutines DOEXP * Draw an exploding ship 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 SHPPT Draw a distant ship as a point rather than a full wireframe Variables coltabl Colours for ship explosions E% (Game data) Ship blueprints default NEWB flags exlook An unused block of explosion data scacol Ship colours on the scanner SHIP_ADDER (Game data) Ship blueprint for an Adder SHIP_ANACONDA (Game data) Ship blueprint for an Anaconda SHIP_ASP_MK_2 (Game data) Ship blueprint for an Asp Mk II SHIP_ASTEROID (Game data) Ship blueprint for an asteroid SHIP_BOA (Game data) Ship blueprint for a Boa SHIP_BOULDER (Game data) Ship blueprint for a boulder SHIP_CANISTER (Game data) Ship blueprint for a cargo canister SHIP_COBRA_MK_1 (Game data) Ship blueprint for a Cobra Mk I SHIP_COBRA_MK_3 (Game data) Ship blueprint for a Cobra Mk III SHIP_COBRA_MK_3_P (Game data) Ship blueprint for a Cobra Mk III (pirate) SHIP_CONSTRICTOR (Game data) Ship blueprint for a Constrictor SHIP_CORIOLIS (Game data) Ship blueprint for a Coriolis space station SHIP_COUGAR (Game data) Ship blueprint for a Cougar SHIP_DODO (Game data) Ship blueprint for a Dodecahedron ("Dodo") space station SHIP_ESCAPE_POD (Game data) Ship blueprint for an escape pod SHIP_FER_DE_LANCE (Game data) Ship blueprint for a Fer-de-Lance SHIP_GECKO (Game data) Ship blueprint for a Gecko SHIP_KRAIT (Game data) Ship blueprint for a Krait SHIP_MAMBA (Game data) Ship blueprint for a Mamba SHIP_MISSILE (Game data) Ship blueprint for a missile SHIP_MORAY (Game data) Ship blueprint for a Moray SHIP_PLATE (Game data) Ship blueprint for an alloy plate SHIP_PYTHON (Game data) Ship blueprint for a Python SHIP_PYTHON_P (Game data) Ship blueprint for a Python (pirate) SHIP_ROCK_HERMIT (Game data) Ship blueprint for a rock hermit (asteroid) SHIP_SHUTTLE (Game data) Ship blueprint for a Shuttle SHIP_SIDEWINDER (Game data) Ship blueprint for a Sidewinder SHIP_SPLINTER (Game data) Ship blueprint for a splinter SHIP_THARGOID (Game data) Ship blueprint for a Thargoid mothership SHIP_THARGON (Game data) Ship blueprint for a Thargon SHIP_TRANSPORTER (Game data) Ship blueprint for a Transporter SHIP_VIPER (Game data) Ship blueprint for a Viper SHIP_WORM (Game data) Ship blueprint for a Worm shpcol Ship colours XX21 (Game data) Ship blueprints lookup table Macros EDGE (Game data) Macro definition for adding edges to ship blueprints FACE (Game data) Macro definition for adding faces to ship blueprints VERTEX (Game data) Macro definition for adding vertices to ship blueprints Drawing suns The epic, shimmering Elite sun Subroutines FLFLLS Reset the sun line heap 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 Drawing the screen The split-screen mode and different screen views Subroutines cls Clear the top part of the screen and draw a white border CLYNS Clear the bottom three text rows of the mode 4 screen DET1 Show or hide the dashboard (for when we die) DOVDU19 Change the mode 1 palette IRQ1 * The main screen-mode interrupt handler (IRQ1V points here) 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 and draw a white border TTX66K Clear the top part of the screen and draw a white border WSCAN Implement the #wscn command (wait for the vertical sync) Variables B% (Loader) VDU commands for setting the square mode 1 screen TVT1 Palette data for the mode 2 part of the screen (the dashboard) TVT3 Palette data for the mode 1 part of the screen (the top part) VEC The original value of the IRQ1 vector VSCAN Defines the split position in the split-screen mode Equipment Buying and selling weapons and ship upgrades Subroutines 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 refund Install a new laser, processing a refund if applicable Variables PRXS Equipment prices Flight Docking, hyperspace, views, shields and more Subroutines 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, show the ship hangar 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 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 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 WARP * Perform an in-system jump wW Start a hyperspace countdown Keyboard Processing key presses and joysticks Subroutines CTRL Scan the keyboard to see if CTRL is currently pressed CTRLmc Scan the Master Compact keyboard to see if CTRL is currently pressed DJOY Scan the keyboard for cursor key or digital joystick movement DK4 Scan for pause, configuration and secondary flight keys DKS3 Toggle a configuration setting and emit a beep DKS4mc Scan the Master Compact keyboard to see if a specific key is being pressed DKS5 Scan the keyboard to see if a specific key is being pressed DOKEY * Scan for the seven primary flight controls and apply the docking computer manoeuvring code FILLKL Scan the keyboard for a flight key and update the key logger FLKB Flush the keyboard buffer PAUSE2 Wait until a key is pressed, ignoring any existing key press RDFIRE Read the fire button on either the analogue or digital joystick RDJOY Read from either the analogue or digital joystick RDKEY Scan the keyboard for key presses RETURN Scan the keyboard to see if RETURN is currently pressed SHIFT Scan the keyboard to see if SHIFT is currently pressed TT102 * Process function key, save key, hyperspace and chart key presses and update the hyperspace counter TT17 Scan the keyboard for cursor key or joystick movement TT17X Scan the digital joystick for movement TT214 Ask a question with a "Y/N?" prompt and return the response TT217 Scan the keyboard until a key is pressed YESNO Wait until either "Y" or "N" is pressed ZEKTRAN Clear the key logger Variables IKNS Lookup table for in-flight keyboard controls KTRAN The key logger buffer that gets updated by the OSWORD 240 command TGINT The keys used to toggle configuration settings when the game is paused TRTB% Translation table from internal key number to ASCII Loader The loading screen and system setup Subroutines BEGIN Initialise the configuration variables and start the game Elite loader (Loader) Perform a number of OS calls, check for sideways RAM, load and move the main game data, and load and run the main game code S% Move code, set up break handler and start the game SETINTS Set the various vectors, interrupts and timers Variables Dashboard image (Game data) The binary for the dashboard image MESS1 (Loader) The OS command string for loading the BDATA binary MESS2 (Loader) The OS command string for loading the main game code binary MESS3 (Loader) The OS command string for changing the disc directory to E Main loop The core loop that runs Elite Subroutines 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 (red function keys, docked keys) Market Market prices, selling, buying and inventory Subroutines 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 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 (red key f7) TT16a Print "g" (for grams) TT208 * Show the Sell Cargo screen (red key f2) TT210 Show a list of current cargo in our hold, optionally to sell TT213 * Show the Inventory screen (red key f9) TT219 * Show the Buy Cargo screen (red key f1) var Calculate QQ19+3 = economy * |economic_factor| Variables QQ23 Market prices table Macros ITEM Macro definition for the market prices table Maths (Arithmetic) Addition, subtraction, multiplication, division Subroutines ADD * Calculate (A X) = (A P) + (S R) ADDK Calculate (A X) = (A P) + (S R) DORND * Generate random numbers DORND (Loader) * Generate random numbers 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 DVID4K 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 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 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 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 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) Variables alogh Binary antilogarithm table log Binary logarithm table (high byte) logL Binary logarithm table (low byte) Maths (Geometry) Vectors, coordinates, dot products and matrices Subroutines 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 PROJ Project the current ship or planet onto the screen SCALEX Scale the x-coordinate in A SCALEY Scale the y-coordinate in A SCALEY2 Scale the y-coordinate in A 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 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 Variables ACT (Game data) Arctan table SNE (Game data) Sine/cosine table Missions Hunting stolen ships and evading Thargoids Subroutines 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 DEBRIEF Finish mission 1 DEBRIEF2 Finish mission 2 PAS1 Display a rotating ship at space coordinates (0, 120, 256) and scan the keyboard PAUSE Display a rotating ship, waiting until a key is pressed, then remove the ship from the screen TBRIEF Start mission 3 THERE Check whether we are in the Constrictor's system in mission 1 Moving Moving and rotating ships and planets in space Subroutines MV40 Rotate the planet or sun's location in space by the amount of pitch and roll of our ship 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 Commander files and competition codes Subroutines CATS Ask for a disc drive number and print a catalogue of that drive CHECK Calculate the checksum for the last saved commander data block COLD Set the standard BRKV handler for the game DELT Catalogue a disc, ask for a filename to delete, and delete the file FILEPR Display the currently selected media (disc or tape) GTDIR Fetch the name of an ADFS directory on the Master Compact and change to that directory GTDRV Get an ASCII disc drive number from the keyboard GTNMEW Fetch the name of a commander file to save or load JAMESON Restore the default JAMESON commander LOD * Load a commander file OTHERFILEPR Display the non-selected media (disc or tape) rfile Load the commander file SVE * Display the disc 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% wfile Save the commander file Variables CHK First checksum byte for the saved commander data file CHK2 Second checksum byte for the saved commander data file CTLI The OS command string for cataloguing a disc DELI The OS command string for deleting a file DIRI The OS command string for changing directory on the Master Compact lodosc The OS command string for loading a commander file NA% The data block for the last saved commander NA2% The data block for the default commander oldlong Contains the length of the last saved commander name S1% The drive and directory number used when saving or loading a commander file savosc The OS command string for saving a commander file stackpt Temporary storage for the stack pointer when jumping to the break handler at NEWBRK thislong Contains the length of the most recently entered commander name Ship hangar The ship hangar that's displayed on docking Subroutines HAL3 Draw a hangar background line from left to right, stopping when it bumps into existing on-screen content HALL Draw the ships in the ship hangar, then draw the hangar HANGER Display the ship hangar HAS1 Draw a ship in the ship hangar HAS2 Draw a hangar background line from left to right HAS3 Draw a hangar background line from right to left Variables HANGFLAG The number of ships being displayed in the ship hangar HATB Ship hangar group table Sound Explosions, laser fire, hyperspace and more Subroutines BEEP Make a short, high beep BELL Make a standard system beep BOOP Make a long, low beep ECMOF Switch off the E.C.M. ELASNO Make the sound of us being hit EXNO Make the sound of a laser strike or ship explosion EXNO3 Make an explosion sound LASNO Make the sound of our laser firing NOISE * Make the sound whose number is in Y by populating the sound buffer SOFLUSH Reset the sound buffer and turn off all sound channels SOINT Process the contents of the sound buffer and send it to the sound chip SOUS1 Write sound data directly to the 76489 sound chip Variables SFXBT Sound data block 2 SFXFQ Sound data block 3 SFXPR Sound data block 1 SFXVC Sound data block 4 SOFH Sound chip data mask for choosing a tone channel in the range 0-2 SOFLG The sound buffer where the data to be sent to the sound chip is processed SOOFF Sound chip data to turn the volume down on all channels and to act as a mask for choosing a tone channel in the range 0-2 Stardust Stardust generation and movement Subroutines 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 The title screen... and the Game Over screen Subroutines 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 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 Showing the commander's status and rank Subroutines 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 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 (red key f8) Variables KWH% (Game data) Integer number of kills awarded for destroying each type of ship KWL% (Game data) Fractional number of kills awarded for destroying each type of ship Tactics AI tactics for enemy ships and missiles Subroutines 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 yetanotherrts Contains an RTS Text The game's recursive text tokenisation system Subroutines 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 crlf Tab to column 21 and print a colon 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 short, high 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 ex Print a recursive token FEED Print a newline INCYC Move the text cursor to the next row 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 10, switch to white text, 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 6, switch to white text, 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 NUMBOR An unused routine that prints a number in hexadecimal OUTX Print the character in Q before returning to gnum 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 TT11 Print a 16-bit number, left-padded to n digits, and optional point TT162 Print a space 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 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 TT67X 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 Variables DTW1 A mask for applying the lower case part of Sentence Case to extended text tokens DTW2 A flag that indicates whether we are currently printing a word DTW3 A flag for switching between standard and extended text tokens DTW4 Flags that govern how justified extended text tokens are printed DTW5 The size of the justified text buffer at BUF DTW6 A flag to denote whether printing in lower case is enabled for extended text tokens DTW8 A mask for capitalising the next letter in an extended text token FONT% A copy of the character definition bitmap table from the MOS ROM JMTB The extended token table for jump tokens 1-32 (DETOK) MTIN Lookup table for random tokens in the extended token table (0-37) QQ16 The two-letter token lookup table QQ18 (Game data) The recursive token table for tokens 0-148 RLINE The OSWORD configuration block used to fetch a line of text from the keyboard RUGAL (Game data) The criteria for systems with extended description overrides RUPLA (Game data) System numbers that have extended description overrides RUTOK (Game data) The second extended token table for recursive tokens 0-26 (DETOK3) TENS A constant used when printing large numbers in BPRNT TKN1 (Game data) The first extended token table for recursive tokens 0-255 (DETOK) TKN2 The extended two-letter token lookup table Macros CHAR (Game data) Macro definition for characters in the recursive token table CONT (Game data) Macro definition for control codes in the recursive token table ECHR (Game data) Macro definition for characters in the extended token table EJMP (Game data) Macro definition for jump tokens in the extended token table ERND (Game data) Macro definition for random tokens in the extended token table ETOK (Game data) Macro definition for recursive tokens in the extended token table ETWO (Game data) Macro definition for two-letter tokens in the extended token table RTOK (Game data) Macro definition for recursive tokens in the recursive token table TOKN (Game data) Macro definition for standard tokens in the extended token table TWOK (Game data) Macro definition for two-letter tokens in the token table Universe Ship spawning, local bubble, system/market data Subroutines 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 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 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 PDESC Print the system's extended description or a mission 1 directive 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 SPIN Randomly spawn cargo from a destroyed ship tal Print the current galaxy number TT111 Set the current system to the nearest system to a point 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 (red key f6) TT54 * Twist the selected system's seeds TT70 Display "MAINLY " and jump to TT72 TT81 Set the selected system's seeds to those of system 0 ypl Print the current system name Ze Initialise the INWK workspace to a hostile ship ZINF Reset the INWK workspace and orientation vectors Variables spasto Contains the address of the Coriolis space station's ship blueprint UNIV Table of pointers to the local universe's ship data blocks Utility routines Memory/screen clearing, delay routines Subroutines DEEOR Unscramble the main code DEEORS Decrypt a multi-page block of memory DELAY Wait for a specified time, in 1/50s of a second getzp Swap zero page (&0090 to &00EF) with the buffer at &3000 NEWBRK The standard BRKV handler for the game NMICLAIM Claim the NMI workspace (&00A0 to &00A7) back from the MOS so the game can use it once again NMIRELEASE Release the NMI workspace (&00A0 to &00A7) so the MOS can use it and store the top part of zero page in the the buffer at &3000 OSB (Loader) A convenience routine for calling OSBYTE with Y = 0 setzp Copy the top part of zero page (&0090 to &00FF) into the buffer at &3000 SWAPPZERO An unused routine that swaps bytes in zero page ZERO Reset the local bubble of universe and ship status ZES1 Zero-fill the page whose number is in X ZES2 Zero-fill a specific page Variables F% Denotes the end of the main game code, from Elite A to Elite H Workspaces Collections of important variables into blocks Workspaces K% * Ship data blocks and ship line heaps UP Configuration variables WP Ship slots, variables XX3 Temporary storage space for complex calculations ZP * Lots of important variables are stored in the zero page workspace as it is quicker and more space-efficient to access memory here ZP (Loader) * Important variables used by the loader Acorn Electron source code A cut-down version for the Beeb's little brother Version information About the Electron versionInformation on the cut-down version of Elite Different variants of the Electron versionCode variations found in Electron Elite Acorn Electron source code by file Map of the source code An overview of how the source code for Elite is structured Annotated original source files The source files in their original structure Game loader Loader source The loading screen, copy protection and setup for the main game Main game Workspaces and configuration The main variable workspaces used in Elite Text tokens Elite's tokenised game text Elite A source Part 1 of the main game code Elite B source Part 2 of the main game code Elite C source Part 3 of the main game code Elite D source Part 4 of the main game code Elite E source Part 5 of the main game code Elite F source Part 6 of the main game code Elite G source Part 7 of the main game code Ship blueprints Data for the 11 different ship designs Big Code File Big Code File source Concatenates the individual source code parts into one big game file Acorn Electron source code by category Charts Long-range and short-range galactic charts Subroutines 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 (FUNC-5) TT23 * Show the Short-range Chart (FUNC-6) Copy protection Hiding the Elite code from prying eyes Subroutines BEGIN% (Loader) Single-byte decryption and copying routine, run on the stack crunchit (Loader) Multi-byte decryption and copying routine David7 (Loader) Part of the multi-jump obfuscation code in PROT1 doPROT1 (Loader) * Routine to self-modify the loader code swine (Loader) Resets the machine if the copy protection detects a problem Variables Authors' names The authors' names and a copyright notice, buried in the code Authors' names (Loader) The authors' names, buried in the code checksum0 Checksum for the entire main game code David23 (Loader) Address pointer to the start of the 6502 stack David9 (Loader) Address used as part of the stack-based decryption loop MHCA (Loader) Used to set one of the vectors in the copy protection code Dashboard The dials, 3D scanner and compass Subroutines 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 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 msblob Display the dashboard's missile indicators as white squares 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 and reset the ball line heap Variables ECBT The character bitmap for the E.C.M. indicator bulb MDIALS The missile indicator bitmaps for the monochrome dashboard SPBT The bitmap definition for the space station indicator bulb Drawing circles Hyperspace tunnels, launch rings and planets Subroutines 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) 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 The core line-drawing routines Subroutines HLOIN * Draw a horizontal line from (X1, Y1) to (X2, Y1) 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 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 TT15 Draw a set of crosshairs Drawing pixels How to plot pixels in various colours Subroutines CPIX2 * Draw a single-height dash 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 Variables CTWOS Ready-made double-pixel character row bytes for the mode 4 dashboard TWOS Ready-made single-pixel character row bytes for mode 4 TWOS (Loader) Ready-made single-pixel character row bytes for mode 4 TWOS2 Ready-made double-pixel character row bytes for mode 4 Drawing planets Planets with meridians and craters Subroutines PL2 Remove the planet from the screen PL21 Return from a planet-drawing routine with a failure flag PLANET Draw the planet PLL1 (Part 1 of 3) (Loader) Draw Saturn on the loading screen (draw the planet) PLL1 (Part 2 of 3) (Loader) Draw Saturn on the loading screen (draw the stars) PLL1 (Part 3 of 3) (Loader) Draw Saturn on the loading screen (draw the rings) 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 Variables CNT (Loader) A counter for use in drawing Saturn's planetary body CNT2 (Loader) A counter for use in drawing Saturn's background stars CNT3 (Loader) A counter for use in drawing Saturn's rings Drawing ships The celebrated 3D ship plotting process Subroutines DOEXP * Draw an exploding ship 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 LL9 (Part 11 of 12) Draw ship: Add all visible edges to the ship line heap LL9 (Part 12 of 12) Draw ship: Draw all the visible edges from the ship line heap SHPPT Draw a distant ship as a point rather than a full wireframe Variables SHIP_ASTEROID Ship blueprint for an asteroid SHIP_CANISTER Ship blueprint for a cargo canister SHIP_COBRA_MK_3 Ship blueprint for a Cobra Mk III SHIP_CORIOLIS Ship blueprint for a Coriolis space station SHIP_ESCAPE_POD Ship blueprint for an escape pod SHIP_MAMBA Ship blueprint for a Mamba SHIP_MISSILE Ship blueprint for a missile SHIP_PYTHON Ship blueprint for a Python SHIP_SIDEWINDER Ship blueprint for a Sidewinder SHIP_VIPER Ship blueprint for a Viper XX21 Ship blueprints lookup table Macros EDGE Macro definition for adding edges to ship blueprints FACE Macro definition for adding faces to ship blueprints VERTEX Macro definition for adding vertices to ship blueprints Drawing the screen The mode 4 screen and configuring screen views Subroutines CLYNS Clear the bottom three text rows of the mode 4 screen LYN Clear most of a row of pixels NEXTR Move to the next character row in the Electron mode 4 screen TT66 Clear the screen and set the current view type TTX66 Clear the top part of the screen and draw a white border Variables B% (Loader) VDU commands for changing to a standard mode 4 screen Equipment Buying and selling weapons and ship upgrades Subroutines eq Subtract the price of equipment from the cash pot EQSHP * Show the Equip Ship screen (FUNC-4) prx Return the price of a piece of equipment qv Print a menu of the four space views, for buying lasers Variables PRXS Equipment prices Flight Docking, hyperspace, views, shields and more Subroutines DENGY Drain some energy from the energy banks ee3 Print the hyperspace countdown in the top-left of the screen ESCAPE Launch our escape pod Ghy Perform a galactic hyperspace jump hy6 Print a message to say there is no hyperspacing allowed inside the station hyp Start the hyperspace process 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 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 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 WARP * Perform an in-system jump wW Start a hyperspace countdown Keyboard Processing key presses and joysticks Subroutines DK4 Scan for pause, configuration and secondary flight keys 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 FLKB Flush the keyboard buffer KEY1 The main keyboard interrupt handler (KEYV points here) RDKEY Scan the keyboard for key presses TT102 * Process function key, save key, hyperspace and chart key presses and update the hyperspace counter TT17 Scan the keyboard for cursor key 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 Variables KYTB Lookup table for in-flight keyboard controls Loader The loading screen and system setup Subroutines Elite loader (Part 1 of 5) (Loader) Include binaries for recursive tokens and images Elite loader (Part 2 of 5) (Loader) Perform a number of OS calls, set up sound, push routines on stack Elite loader (Part 3 of 5) (Loader) Move recursive tokens and images Elite loader (Part 4 of 5) (Loader) Call part 5 of the loader now that is has been relocated Elite loader (Part 5 of 5) (Loader) Set up interrupt vectors, calculate checksums, run main game code Main loop The core loop that runs Elite Subroutines 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 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 peaceful Cobra Mk III) 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 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 (FUNC keys, docked keys) Market Market prices, selling, buying and inventory Subroutines 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 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 (FUNC-8) TT16a Print "g" (for grams) TT208 * Show the Sell Cargo screen (FUNC-3) TT210 Show a list of current cargo in our hold, optionally to sell TT213 * Show the Inventory screen (FUNC-0) TT219 * Show the Buy Cargo screen (FUNC-2) var Calculate QQ19+3 = economy * |economic_factor| Variables QQ23 Market prices table Macros ITEM Macro definition for the market prices table Maths (Arithmetic) Addition, subtraction, multiplication, division Subroutines ADD * Calculate (A X) = (A P) + (S R) DORND * Generate random numbers DORND (Loader) * Generate random numbers 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 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 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 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 An unused duplicate of the MULTU routine Maths (Geometry) Vectors, coordinates, dot products and matrices Subroutines 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 MAS4 Calculate a cap on the maximum distance to a ship NORM * Normalise the three-coordinate vector in XX15 PROJ Project the current ship or planet onto the screen 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 Variables ACT Arctan table SNE Sine/cosine table Moving Moving and rotating ships and planets in space Subroutines MV40 Rotate the planet's location in space by the amount of pitch and roll of our ship 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 Commander files and competition codes Subroutines CHECK Calculate the checksum for the last saved commander data block GTNME Fetch the name of a commander file to save or load 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% Variables CHK First checksum byte for the saved commander data file CHK2 Second checksum byte for the saved commander data file NA% The data block for the last saved commander Sound Explosions, laser fire, hyperspace and more Subroutines BEEP Make a short, high beep BELL Make a standard system beep ECMOF Switch off the E.C.M. EXNO Make the sound of a laser strike or ship explosion 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 Variables E% (Loader) Sound envelope definitions SFX Sound data Macros FNE (Loader) Macro definition for defining a sound envelope Stardust Stardust generation and movement Subroutines 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 The title screen... and the Game Over screen Subroutines 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 QU5 Reset the current commander data block to the last saved commander 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 Showing the commander's status and rank Subroutines 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 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 (FUNC-9) Tactics AI tactics for enemy ships and missiles Subroutines 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, 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 The game's recursive text tokenisation system Subroutines BPRNT * Print a 32-bit number, left-padded to a specific number of digits, with an optional decimal point crlf Tab to column 21 and print a colon dn2 Make a short, high beep and delay for 1 second ex Print a recursive token 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 TT11 Print a 16-bit number, left-padded to n digits, and optional point TT162 Print a space TT26 * Print a character at the text cursor by poking into screen memory 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 TT73 Print a colon TT74 Print a character TTX69 Print a paragraph break Variables QQ16 The two-letter token lookup table QQ18 The recursive token table for tokens 0-148 RLINE The OSWORD configuration block used to fetch a line of text from the keyboard TENS A constant used when printing large numbers in BPRNT Macros CHAR Macro definition for characters in the recursive token table CONT Macro definition for control codes in the recursive token table RTOK Macro definition for recursive tokens in the recursive token table TWOK Macro definition for two-letter tokens in the token table Universe Ship spawning, local bubble, system/market data Subroutines cpl Print the selected system name GINF Fetch the address of a ship's data block into INF GVL Calculate the availability of market items 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 line heap pointer after shuffling ship slots KS4 Remove the space station and replace with a placeholder 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 tal Print the current galaxy number TT111 Set the current system to the nearest system to a point 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 (FUNC-7) TT54 * Twist the selected system's seeds TT70 Display "MAINLY " and jump to TT72 TT81 Set the selected system's seeds to those of system 0 ypl Print the current system name Ze Initialise the INWK workspace to a hostile ship ZINF Reset the INWK workspace and orientation vectors Variables UNIV Table of pointers to the local universe's ship data blocks Utility routines Memory/screen clearing, delay routines Subroutines DELAY Wait for a specified time FX200 Set the behaviour of the ESCAPE and BREAK keys IRQ1 * The main interrupt handler (IRQ1V points here) OSB (Loader) A convenience routine for calling OSBYTE with Y = 0 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 Variables MESS1 (Loader) Contains an OS command string for loading the main game code oscliv (Loader) Contains the address of OSCLIV, for executing OS commands Workspaces Collections of important variables into blocks Workspaces K% * Ship data blocks and ship line heaps S% (Part 1 of 2) Vector addresses, compass shape and configuration settings S% (Part 2 of 2) Compass shape and configuration settings T% Current commander data and stardust data blocks UU% (Loader) Marker for a block that is moved as part of the obfuscation WP Ship slots, variables XX3 Temporary storage space for complex calculations ZP * Lots of important variables are stored in the zero page workspace as it is quicker and more space-efficient to access memory here ZP (Loader) * Important variables used by the loader NES source code The "impossible" version of Elite on the Nintendo Version information About the NES versionInformation on the "impossible" version of Elite Different variants of the NES versionCode variations found in NES Elite NES source code by file Map of the source code An overview of how the source code for Elite is structured Annotated original source files The source files in their original structure Common code Common source Variables and macros that are shared by all banks Main game iNES header source Source for the iNES header Bank 0 source (Part 1 of 5) The contents of ROM bank 0 (first part) Bank 0 source (Part 2 of 5) The contents of ROM bank 0 (second part) Bank 0 source (Part 3 of 5) The contents of ROM bank 0 (third part) Bank 0 source (Part 4 of 5) The contents of ROM bank 0 (fourth part) Bank 0 source (Part 5 of 5) The contents of ROM bank 0 (fifth part) Bank 1 source (Part 1 of 3) The contents of ROM bank 1 (first part) Bank 1 source (Part 2 of 3) The contents of ROM bank 1 (second part) Bank 1 source (Part 3 of 3) The contents of ROM bank 1 (third part) Bank 2 source (Part 1 of 4) The contents of ROM bank 2 (first part) Bank 2 source (Part 2 of 4) The contents of ROM bank 2 (second part) Bank 2 source (Part 3 of 4) The contents of ROM bank 2 (third part) Bank 2 source (Part 4 of 4) The contents of ROM bank 2 (fourth part) Bank 3 source (Part 1 of 2) The contents of ROM bank 3 (first part) Bank 3 source (Part 2 of 2) The contents of ROM bank 3 (second part) Bank 4 source The contents of ROM bank 4 Bank 5 source The contents of ROM bank 5 Bank 6 source (Part 1 of 3) The contents of ROM bank 6 (first part) Bank 6 source (Part 2 of 3) The contents of ROM bank 6 (second part) Bank 6 source (Part 3 of 3) The contents of ROM bank 6 (third part) Bank 7 source (Part 1 of 4) The contents of ROM bank 7 (first part) Bank 7 source (Part 2 of 4) The contents of ROM bank 7 (second part) Bank 7 source (Part 3 of 4) The contents of ROM bank 7 (third part) Bank 7 source (Part 4 of 4) The contents of ROM bank 7 (fourth part) NES source code by category Charts Long-range and short-range galactic charts Subroutines DrawChartSystem (Bank 0) Draw system blobs on short-range chart DrawCrosshairs (Bank 0) Draw a set of moveable crosshairs as a square reticle HideCrosshairs (Bank 0) Hide the moveable crosshairs (i.e. the square reticle) HME2 (Bank 0) Search the galaxy for a system TT103 (Bank 0) Draw a small set of crosshairs on a chart TT105 (Bank 0) Draw crosshairs on the Short-range Chart, with clipping TT114 (Bank 0) Display either the Long-range or Short-range Chart TT123 (Bank 0) Move galactic coordinates by a signed delta TT16 (Bank 0) Move the crosshairs on a chart TT22 (Bank 0) * Show the Long-range Chart TT23 (Bank 0) * Show the Short-range Chart Variables xShortRange (Bank 0) The text column for the Short-range Chart title for each language Combat demo Scroll text and training for first-time players Subroutines AutoPlayDemo (Bank 7) Automatically play the demo using the auto-play commands from the autoplayKeys tables CalculateGridLines (Bank 6) Reset the line coordinate tables and populate them with the characters for a specified scroll text DrawScrollFrame (Bank 6) Draw one frame of the scroll text DrawScrollFrames (Bank 6) Draw a scroll text over multiple frames DrawScrollInNMI (Bank 6) Configure the NMI handler to draw the scroll text screen DrawScrollText (Bank 6) Display a Star Wars scroll text FixRandomNumbers (Bank 7) Fix the random number seeds to a known value so the random numbers generated are always the same when we run the demo GetScrollDivisions (Bank 6) Set up the division calculations for the scroll text GRIDSET (Bank 6) Populate the line coordinate tables with the pixel lines for one 21-character line of scroll text GRS1 (Bank 6) Populate the line coordinate tables with the lines for a single scroll text character PlayDemo (Bank 0) Play the combat demo PlayDemo_b0 (Bank 7) Call the PlayDemo routine in ROM bank 0 ProjectScrollText (Bank 6) Project a scroll text coordinate onto the screen RunDemoFlightLoop (Bank 0) Run a fixed number of iterations of the main flight loop for the combat demo ScrollTextUpScreen (Bank 6) Go through the line y-coordinate table at Y1TB, moving each line coordinate up the screen by W2Y (i.e. by one full line of text) SetDemoAutoPlay (Bank 5) Set up the NMI handler to automatically play the demo using the controller key presses in the autoPlayKeys table SetDemoAutoPlay_b5 (Bank 7) Call the SetDemoAutoPlay routine in ROM bank 5 SetupDemoShip (Bank 0) Set up the ship workspace for a new ship in the combat demo SetupDemoUniverse (Bank 7) Initialise the local bubble of universe for the demo ShowScrollText (Bank 6) Show a scroll text and start the combat demo ShowScrollText_b6 (Bank 7) Call the ShowScrollText routine in ROM bank 6 Variables autoPlayKeys1_DE (Bank 7) Auto-play commands for the first part of the auto-play combat demo (combat practice) when German is the chosen language autoPlayKeys1_EN (Bank 7) Auto-play commands for the first part of the auto-play combat demo (combat practice) when English is the chosen language autoPlayKeys1_FR (Bank 7) Auto-play commands for the first part of the auto-play combat demo (combat practice) when French is the chosen language autoPlayKeys1Hi (Bank 5) High byte of the address of the auto-play key table for each language autoPlayKeys1Lo (Bank 5) Low byte of the address of the auto-play key table for each language autoPlayKeys2 (Bank 7) Auto-play commands for the second part of the auto-play demo (demonstrating the game itself) creditsText1 (Bank 6) Text for the first part of the credits scroll text creditsText1Hi (Bank 6) Lookup table for the high byte of the address of the creditsText1 text for each language creditsText1Lo (Bank 6) Lookup table for the low byte of the address of the creditsText1 text for each language creditsText2 (Bank 6) Text for the second part of the credits scroll text creditsText2Hi (Bank 6) Lookup table for the high byte of the address of the creditsText2 text for each language creditsText2Lo (Bank 6) Lookup table for the low byte of the address of the creditsText2 text for each language creditsText3 (Bank 6) Text for the third part of the credits scroll text creditsText3Hi (Bank 6) Lookup table for the high byte of the address of the creditsText3 text for each language creditsText3Lo (Bank 6) Lookup table for the low byte of the address of the creditsText3 text for each language LTDEF (Bank 6) Line definitions for characters in the Star Wars scroll text NOFX (Bank 6) The x-coordinates of the scroll text letter grid NOFY (Bank 6) The y-coordinates of the scroll text letter grid scrollText1_DE (Bank 6) Text for the first scroll text in German scrollText1_EN (Bank 6) Text for the first scroll text in English scrollText1_FR (Bank 6) Text for the first scroll text in French scrollText1Hi (Bank 6) Lookup table for the high byte of the address of the scrollText1 text for each language scrollText1Lo (Bank 6) Lookup table for the low byte of the address of the scrollText1 text for each language scrollText2_DE (Bank 6) Text for the second scroll text in German scrollText2_EN (Bank 6) Text for the second scroll text in English scrollText2_FR (Bank 6) Text for the second scroll text in French scrollText2Hi (Bank 6) Lookup table for the high byte of the address of the scrollText2 text for each language scrollText2Lo (Bank 6) Lookup table for the low byte of the address of the scrollText2 text for each language Controllers Routines for scanning both NES controllers Subroutines ChangeLetter (Bank 6) Choose a letter using the up and down buttons DecreaseJoystick (Bank 7) Decrease a joystick value by a specific amount, jumping straight to the indicator centre if we decrease from the right-hand side DOKEY (Bank 0) * Scan for the seven primary flight controls and apply the docking computer manoeuvring code IncreaseJoystick (Bank 7) Increase a joystick value by a specific amount, jumping straight to the indicator centre if we increase from the left-hand side InputName (Bank 6) Get a name from the controller for searching the galaxy or changing commander name InputName_b6 (Bank 7) Call the InputName routine in ROM bank 6 PAUSE2 (Bank 2) Wait until a key is pressed, ignoring any existing key press ReadControllers (Bank 7) * Read the buttons on the controllers and update the control variables