Skip to navigation

Elite on the BBC Micro

Workspaces: WP

[BBC Micro cassette version]

Name: WP [Show more] Type: Workspace Address: &0D40 to &0F33 Category: Workspaces Summary: Ship slots, variables
Context: See this workspace in context in the source code Variations: See code variations for this workspace in the different versions References: This workspace is used as follows: * RES2 uses WP
ORG &0D40 .WP SKIP 0 \ The start of the WP workspace .FRIN SKIP NOSH + 1 \ Slots for the ships in the local bubble of universe \ \ There are #NOSH + 1 slots, but the ship-spawning \ routine at NWSHP only populates #NOSH of them, so \ there are 13 slots but only 12 are used for ships \ (the last slot is effectively used as a null \ terminator when shuffling the slots down in the \ KILLSHP routine) \ \ See the deep dive on "The local bubble of universe" \ for details of how Elite stores the local universe in \ FRIN, UNIV and K% .CABTMP SKIP 0 \ Cabin temperature \ \ The ambient cabin temperature in deep space is 30, \ which is displayed as one notch on the dashboard bar \ \ We get higher temperatures closer to the sun \ \ CABTMP shares a location with MANY, but that's OK as \ MANY+0 would contain the number of ships of type 0, \ and as there is no ship type 0 (they start at 1), the \ byte at MANY+0 is not used for storing a ship type \ and can be used for the cabin temperature instead .MANY SKIP SST \ The number of ships of each type in the local bubble \ of universe \ \ The number of ships of type X in the local bubble is \ stored at MANY+X, so the number of Sidewinders is at \ MANY+1, the number of Mambas is at MANY+2, and so on \ \ See the deep dive on "Ship blueprints" for a list of \ ship types .SSPR SKIP NTY + 1 - SST \ "Space station present" flag \ \ * Non-zero if we are inside the space station's safe \ zone \ \ * 0 if we aren't (in which case we can show the sun) \ \ This flag is at MANY+SST, which is no coincidence, as \ MANY+SST is a count of how many space stations there \ are in our local bubble, which is the same as saying \ "space station present" .ECMP SKIP 1 \ Our E.C.M. status \ \ * 0 = E.C.M. is off \ \ * Non-zero = E.C.M. is on .MJ SKIP 1 \ Are we in witchspace (i.e. have we mis-jumped)? \ \ * 0 = no, we are in normal space \ \ * &FF = yes, we are in witchspace .LAS2 SKIP 1 \ Laser power for the current laser \ \ * Bits 0-6 contain the laser power of the current \ space view \ \ * Bit 7 denotes whether or not the laser pulses: \ \ * 0 = pulsing laser \ \ * 1 = beam laser (i.e. always on) .MSAR SKIP 1 \ The targeting state of our leftmost missile \ \ * 0 = missile is not looking for a target, or it \ already has a target lock (indicator is not \ yellow/white) \ \ * Non-zero = missile is currently looking for a \ target (indicator is yellow/white) .VIEW SKIP 1 \ The number of the current space view \ \ * 0 = front \ * 1 = rear \ * 2 = left \ * 3 = right .LASCT SKIP 1 \ The laser pulse count for the current laser \ \ This is a counter that defines the gap between the \ pulses of a pulse laser. It is set as follows: \ \ * 0 for a beam laser \ \ * 10 for a pulse laser \ \ It gets decremented every vertical sync (in the LINSCN \ routine, which is called 50 times a second) and is set \ to a non-zero value for pulse lasers only \ \ The laser only fires when the value of LASCT hits \ zero, so for pulse lasers with a value of 10, that \ means the laser fires once every 10 vertical syncs (or \ 5 times a second) \ \ In comparison, beam lasers fire continuously as the \ value of LASCT is always 0 .GNTMP SKIP 1 \ Laser temperature (or "gun temperature") \ \ If the laser temperature exceeds 242 then the laser \ overheats and cannot be fired again until it has \ cooled down .HFX SKIP 1 \ A flag that toggles the hyperspace colour effect \ \ * 0 = no colour effect \ \ * Non-zero = hyperspace colour effect enabled \ \ When HFX is set to 1, the mode 4 screen that makes \ up the top part of the display is temporarily switched \ to mode 5 (the same screen mode as the dashboard), \ which has the effect of blurring and colouring the \ hyperspace rings in the top part of the screen. The \ code to do this is in the LINSCN routine, which is \ called as part of the screen mode routine at IRQ1. \ It's in LINSCN that HFX is checked, and if it is \ non-zero, the top part of the screen is not switched \ to mode 4, thus leaving the top part of the screen in \ the more colourful mode 5 .EV SKIP 1 \ The "extra vessels" spawning counter \ \ This counter is set to 0 on arrival in a system and \ following an in-system jump, and is bumped up when we \ spawn bounty hunters or pirates (i.e. "extra vessels") \ \ It decreases by 1 each time we consider spawning more \ "extra vessels" in part 4 of the main game loop, so \ increasing the value of EV has the effect of delaying \ the spawning of more vessels \ \ In other words, this counter stops bounty hunters and \ pirates from continually appearing, and ensures that \ there's a delay between spawnings .DLY SKIP 1 \ In-flight message delay \ \ This counter is used to keep an in-flight message up \ for a specified time before it gets removed. The value \ in DLY is decremented each time we start another \ iteration of the main game loop at TT100 .de SKIP 1 \ Equipment destruction flag \ \ * Bit 1 denotes whether or not the in-flight message \ about to be shown by the MESS routine is about \ destroyed equipment: \ \ * 0 = the message is shown normally \ \ * 1 = the string " DESTROYED" gets added to the \ end of the message .LSX SKIP 0 \ LSX is an alias that points to the first byte of the \ sun line heap at LSO \ \ * &FF indicates the sun line heap is empty \ \ * Otherwise the LSO heap contains the line data for \ the sun .LSO SKIP 192 \ The ship line heap for the space station (see NWSPS) \ and the sun line heap (see SUN) \ \ The spaces can be shared as our local bubble of \ universe can support either the sun or a space \ station, but not both .LSX2 SKIP 78 \ The ball line heap for storing x-coordinates (see the \ deep dive on "The ball line heap" for details) .LSY2 SKIP 78 \ The ball line heap for storing y-coordinates (see the \ deep dive on "The ball line heap" for details) .SY SKIP NOST + 1 \ This is where we store the y_hi coordinates for all \ the stardust particles .SYL SKIP NOST + 1 \ This is where we store the y_lo coordinates for all \ the stardust particles .SZ SKIP NOST + 1 \ This is where we store the z_hi coordinates for all \ the stardust particles .SZL SKIP NOST + 1 \ This is where we store the z_lo coordinates for all \ the stardust particles .XSAV2 SKIP 1 \ Temporary storage, used for storing the value of the X \ register in the TT26 routine .YSAV2 SKIP 1 \ Temporary storage, used for storing the value of the Y \ register in the TT26 routine .MCH SKIP 1 \ The text token number of the in-flight message that is \ currently being shown, and which will be removed by \ the me2 routine when the counter in DLY reaches zero .FSH SKIP 1 \ Forward shield status \ \ * 0 = empty \ \ * &FF = full .ASH SKIP 1 \ Aft shield status \ \ * 0 = empty \ \ * &FF = full .ENERGY SKIP 1 \ Energy bank status \ \ * 0 = empty \ \ * &FF = full .LASX SKIP 1 \ The x-coordinate of the tip of the laser line .LASY SKIP 1 \ The y-coordinate of the tip of the laser line .COMX SKIP 1 \ The x-coordinate of the compass dot .COMY SKIP 1 \ The y-coordinate of the compass dot .QQ24 SKIP 1 \ Temporary storage, used to store the current market \ item's price in routine TT151 .QQ25 SKIP 1 \ Temporary storage, used to store the current market \ item's availability in routine TT151 .QQ28 SKIP 1 \ The current system's economy (0-7) \ \ * 0 = Rich Industrial \ * 1 = Average Industrial \ * 2 = Poor Industrial \ * 3 = Mainly Industrial \ * 4 = Mainly Agricultural \ * 5 = Rich Agricultural \ * 6 = Average Agricultural \ * 7 = Poor Agricultural \ \ See the deep dive on "Generating system data" for more \ information on economies .QQ29 SKIP 1 \ Temporary storage, used in a number of places .gov SKIP 1 \ The current system's government type (0-7) \ \ See the deep dive on "Generating system data" for \ details of the various government types .tek SKIP 1 \ The current system's tech level (0-14) \ \ See the deep dive on "Generating system data" for more \ information on tech levels .SLSP SKIP 2 \ The address of the bottom of the ship line heap \ \ The ship line heap is a descending block of memory \ that starts at WP and descends down to SLSP. It can be \ extended downwards by the NWSHP routine when adding \ new ships (and their associated ship line heaps), in \ which case SLSP is lowered to provide more heap space, \ assuming there is enough free memory to do so .XX24 SKIP 1 \ This byte appears to be unused .ALTIT SKIP 1 \ Our altitude above the surface of the planet or sun \ \ * 255 = we are a long way above the surface \ \ * 1-254 = our altitude as the square root of: \ \ x_hi^2 + y_hi^2 + z_hi^2 - 6^2 \ \ where our ship is at the origin, the centre of the \ planet/sun is at (x_hi, y_hi, z_hi), and the \ radius of the planet/sun is 6 \ \ * 0 = we have crashed into the surface .QQ2 SKIP 6 \ The three 16-bit seeds for the current system, i.e. \ the one we are currently in \ \ See the deep dives on "Galaxy and system seeds" and \ "Twisting the system seeds" for more details .QQ3 SKIP 1 \ The selected system's economy (0-7) \ \ * 0 = Rich Industrial \ * 1 = Average Industrial \ * 2 = Poor Industrial \ * 3 = Mainly Industrial \ * 4 = Mainly Agricultural \ * 5 = Rich Agricultural \ * 6 = Average Agricultural \ * 7 = Poor Agricultural \ \ See the deep dive on "Generating system data" for more \ information on economies .QQ4 SKIP 1 \ The selected system's government (0-7) \ \ See the deep dive on "Generating system data" for more \ details of the various government types .QQ5 SKIP 1 \ The selected system's tech level (0-14) \ \ See the deep dive on "Generating system data" for more \ information on tech levels .QQ6 SKIP 2 \ The selected system's population in billions * 10 \ (1-71), so the maximum population is 7.1 billion \ \ See the deep dive on "Generating system data" for more \ details on population levels .QQ7 SKIP 2 \ The selected system's productivity in M CR (96-62480) \ \ See the deep dive on "Generating system data" for more \ details about productivity levels .QQ8 SKIP 2 \ The distance from the current system to the selected \ system in light years * 10, stored as a 16-bit number \ \ The distance will be 0 if the selected sysyem is the \ current system \ \ The galaxy chart is 102.4 light years wide and 51.2 \ light years tall (see the intra-system distance \ calculations in routine TT111 for details), which \ equates to 1024 x 512 in terms of QQ8 .QQ9 SKIP 1 \ The galactic x-coordinate of the crosshairs in the \ galaxy chart (and, most of the time, the selected \ system's galactic x-coordinate) .QQ10 SKIP 1 \ The galactic y-coordinate of the crosshairs in the \ galaxy chart (and, most of the time, the selected \ system's galactic y-coordinate) .NOSTM SKIP 1 \ The number of stardust particles shown on screen, \ which is 18 (#NOST) for normal space, and 3 for \ witchspace PRINT "WP workspace from ", ~WP," to ", ~P%