Skip to navigation

Code changes in the Demonstration Disc

The differences between the cassette version and the demonstration disc

The Elite Demonstration Disc is a fork of the BBC Micro cassette version of Elite, with a number of routines removed to make room for the self-flying features, and other routines copied over from the BBC Micro disc version to implement the combat autopilot. See the deep dive on the Elite Demonstration Disc for details.

The Elite Demomstration Disc

This article contains a complete list of all the code modifications made to the BBC Micro cassette version in order to produce the Demonstration Disc. In the following, the modified routines are shown in the order in which they are run while the demo is progressing, so you might find it useful to refer to the deep dive on program flow of the main game loop, as that covers the entire program flow in the standard cassette version, while the following only covers the modifications.

Links will take you through to the modified code in the Demonstration Disc source code, where all the modifications are shown, along with any code that has been removed. This lets you see exactly what the authors changed to convert the cassette version into the demo.

Note that the code on this site has been extracted from the Demonstration Disc, but it doesn't include the disc protection, which only works on the 8271 disc interface. The version on this site will work on all disc interfaces, including the 1770, as the copy protection is not included.

Variable modifications
----------------------

The following variables have been updated or added for the demonstration:

NameModification details
QQ18Update the text tokens as follows:

  • Replace token 123 ("COMMANDER'S NAME") with "DEMONSTRATION", to be shown during flight
  • Replace token 142 ("DANGEROUS") with "-"
  • Replace token 143 ("DEADLY") with "-"
  • Replace token 147 ("PRESS FIRE OR SPACE,COMMANDER.") with "BBC TAPE VERSION DEMONSTRATION" for the second title screen
  • Move two carriage returns from the end of token 128 ("LOAD NEW COMMANDER (Y/N)?") into the start of token 147 ("(C) ACORNSOFT 1984")
WPAdd five new variables for use by the combat autopilot:

  • targetShip contains the slot number of the target ship, if any
  • attackingShip contains the slot number of the ship that is firing its lasers at us
  • hyperspaceDone indicates whether we have done the hyperspace jump to Riedquat
  • launchedMissile gets set to the slot number of the most recently spawned ship, so that if an enemy has launched a missile at us, we can set our target to this slot number so we start hunting for the missile
  • enableLasers determines whether our lasers are enabled, so they can be disabled for a while when we get a missile lock
NA%Update the commander for the demo:

  • Set the commander name to "DISPLAY"
  • Set the cash level to 500 credits
  • Set the fuel level to 2.0 light years
  • Add a rear pulse laser
CHK2Add the correct second checksum for the updated commander
CHKAdd the correct checksum for the updated commander

Code modifications when docked
------------------------------

These are the code modifications that are run when the demo first loads and the ship is still in the station:

NameModification details
Elite loader
(Part 4 of 6)
Remove the long wait for a key press on the Acornsoft loading screen
BR1 (Part 1 of 2)Remove the "Y/N" key press detection code for the first title screen
TITLEShow each of the title screens for 255 loop iterations and disable the joystick detection code
RESETSet hyperspaceDone to zero to indicate that we have not yet performed the hyperspace to Riedquat
QU5Remove the commander file checksum code
BAYAdd code to do the following:

  • Show the Status Mode screen for five seconds (the latter is implemented by the new DelayFiveSeconds routine throughout the following)
  • Show the Market Price screen for five seconds
  • Show the Data on System screen for five seconds
  • Call EQSHP to trigger the equipment-buying part of the demo, which then calls TT219 to do the cargo-buying demo, the Long-range Chart demo and the launch from the station, with the latter triggering the hyperspace demo in TT110
  • Switch to the front space view to wait for the hyperspace countdown
DELAYAdd a call to the new ProcessDemoKeys routine to check for the supported key presses in the demo
TT102Add a five second delay to the Status Mode screen, disable the code for the "@" key so it doesn't save commander files
TT167Add a five-second delay after showing the Market Price screen
TT25Add a five-second delay after showing the Data on System screen
EQSHPAdd code to demonstrate buying of equipment:

  • Restrict the available equipment to the smallest range
  • If we do not have four missiles already then buy a missile
  • If we do not have a full fuel tank, buy some fuel
  • If we already have four missiles and a full fuel tank, buy a random item of equipment (though in practice this is limited to fuel or missiles)
  • Wait for five seconds and show the Buy Cargo screen in TT219, to trigger the cargo-buying part of the demo
gnumReturn a random number in the correct range instead of waiting for the player to enter one
TT219Add code to do the following after displaying the Inventory screen following the cargo-buying part of the demo:

  • Display the Long-range Chart
  • Choose a random destination
  • Show the Data on System screen
  • Repeat the above a random number of times
  • Show the Status Mode screen for five seconds
  • Launch from the station to trigger the hyperspace code in TT110
TT210Add a five-second delay after showing the cargo list

Code modifications following launch
-----------------------------------

These are the code modifications that are run when the ship has launched but has not yet performed the hyperspace jump to Riedquat:

NameModification details
TT110Add code so as soon as we launch, we show the Short-range Chart, which will then trigger the hyperspace process in TT17 to set up a hyperspace to Riedquat
TT17Remove joystick support from the chart screens and add code to automatically move the crosshairs from Lave to Riedquat before initiating a hyperspace and switching to the front space view
U%Add code to clear KL when clearing the key logger
LOOK1Remove support for views other than the front view
TTX66Remove support for views other than the front view
TT18Remove support for making a manual mis-jump by holding down CTRL

Code modifications for combat
-----------------------------

These are the code modifications that are run once we have reached Riedquat and are on combat alert:

NameModification details
SOLARSet the value of hyperspaceDone to non-zero indicate that we have hyperspaced to Riedquat
DOKEYAdd code to do the following after displaying the Inventory screen following the cargo-buying part of the demo:

  • Contains code copied from the disc version to apply the docking computer code to ship flying
  • Contains new code to ensure that missile-launching takes precedence over flying
  • Calls the new AttackTarget routine to implement combat tactics
DK4Replace the original game's pause key processing code with a call to the new ProcessDemoKeys routine
cntrForce keyboard damping to be used
REDU2Force keyboard auto-recentre to be used
Main flight loop
(Part 3 of 16)
Disable our lasers via enableLasers when missile lock is achieved, and remove the code for processing the energy bomb, escape pod, in-system jump, E.C.M. and docking computer
LASLIMinor label change (has no effect)
TACTICS
(Part 2 of 7)
Initialise the RAT, RAT2 and CNT2 variables used by the docking computer code
TACTICS
(Part 5 of 7)
If a ship fires a missile at us, immediately switch our target to be that missile by setting targetShip to launchedMissile
TACTICS
(Part 6 of 7)
If a ship starts firing lasers at us, store its slot in attackingShip, and if we don't have a target, set targetShip to the attacking ship and call the new PressMissileKey routine to arm a missile
TACTICS
(Part 7 of 7)
Add in code from the enhanced versions to enable the docking computer code to steer the ship
NWSHPStore the new ship's slot in launchedMissile so that if this is an enemy launching a missile at us in the tactics routine, we can switch targets to start hunting down the missile
KILLSHPIf we just removed our target ship, clear the targetShip variable
Main flight loop
(Part 7 of 16)
Remove the code for scooping of cargo using the fuel scoops
Main flight loop
(Part 8 of 16)
Remove the code for scooping of cargo using the fuel scoops
Main flight loop
(Part 9 of 16)
If we docked successfully, restart from the title screen and configure the author's names to be displayed
Main flight loop
(Part 11 of 16)
Various combat-related changes:

  • Disable support for targeting missile lock in the left, right and rear views
  • If a missile lock has been achieved, fire the missile by calling the new PressMissileKey routine (with a 61% chance of firing on each iteration of the main loop)
  • If we have destroyed our target ship, clear the targetShip variable
Main flight loop
(Part 13 of 16)
Various combat-related changes:

  • Remove the energy bomb explosion code
  • On main loop iteration 200 only: print "DEMONSTRATION" as an in-flight message, enable our lasers to be fired via enableLasers (so this reverses any disabling done during missile lock), and 39% of the time on this iteration, change our target ship to the last ship to fire its lasers at us; then jump to part 16 to skip the space station and altitude checks
FAROF2Minor label change (has no effect)
Main flight loop
(Part 15 of 16)
Minor changes only to fix branches that would otherwise be too long with the added code
Main flight loop
(Part 16 of 16)
Minor change to jump straight to the stardust routines for the front view without testing for the other three views

New routines
------------

The following brand new routines have been added to support the above process:

NameDetails
AttackTargetTurn towards the specified enemy target and fire lasers when we are pointing in the right direction
DelayFiveSecondsWait for 5.1 seconds
PressMissileKey"Press" a key by populating the key logger directly (used for pressing the "T" and "M" missile keys only)
ProcessDemoKeysProcess the key presses that are supported in the demo (COPY to pause, DELETE to unpause, ESCAPE to quit, "Q" to disable sound, "S" to enable sound)

Code from the disc version
--------------------------

The following routines contain code that has been copied directly from the disc version to implement the autopilot:

NameDetails
DOKEYThe code added to DOKEY from the disc version implements the automatic flight controls for the demo, so that the ship turns towards either the planet in DOCKIT or the target in AttackTarget, depending on whether there is a target in targetShip
RefineApproachRefine our approach using pitch and roll to aim for the target; the code is copied from the DOCKIT routine in the disc version, and has been extracted into a separate routine so it can be called by both the DOCKIT and AttackTarget routines
DOCKITApply docking manoeuvres to the ship in INWK (this routine contains some minor refactoring that doesn't affect the functionality but which supports manoeuvring towards enemy ships as well as the planet/station)
GOPLMake the ship head towards the planet
VCSU1Vector calculations for the vector towards the station or planet
VCSUBVector calculations for the vector towards the station or planet
TAS4Calculate the dot product of XX15 and one of the station or planet's orientation vectors
TAS6Negate the vector in XX15 so it points in the opposite direction
DCS1Calculate the vector from the ideal docking position to the ship

Removed code
------------

The following routines have been removed, either fully or partially; in either case, they aren't used in the demo. They are listed in the order in which they appear in the source.

NameDetails of removed code
Main flight loop (Part 5 of 16)If an energy bomb has been set off, potentially kill this ship
FLIPReflect the stardust particles in the screen diagonal and redraw the stardust field
STARSThe main routine for processing the stardust
STARS6Process the stardust for the rear view
ESCAPELaunch our escape pod
STARS2Process the stardust for the left or right view
WARPPerform an in-system jump
PLUTFlip the coordinate axes for the four different views
MJPProcess a mis-jump into witchspace
CHECKCalculate the checksum for the last saved commander data block
TRNMECopy the last saved commander's name from INWK to NA%
TR1Copy the last saved commander's name from NA% to INWK
GTNMEFetch the name of a commander file to save or load
RLINEThe OSWORD configuration block used to fetch a line of text from the keyboard
SVESave the commander file
QUS1Save or load the commander file
LODLoad a commander file
DKS3Toggle a configuration setting and emit a beep
TT217Scan the keyboard until a key is pressed
RDKEYScan the keyboard for key presses