Skip to navigation

Elite on the BBC Micro

Version analysis of TT18

This code appears in the following versions (click to see it in the source code):

Code variations between these versions are shown below.

Name: TT18 Type: Subroutine Category: Flight Summary: Try to initiate a jump into hyperspace
Try to go through hyperspace. Called from TT102 in the main loop when the hyperspace countdown has finished.
.TT18

Code variation 1 of 9Related to the 6502SP version

If infinite jump range is enabled in the Executive version, no fuel is used for jumping.

See below for more variations related to this code.

Tap on a version to expand it, and tap it again to show to all variations.

Cassette, Flight, Master, Electron

6502SP

LDA QQ14 \ Subtract the distance to the selected system (in QQ8) SEC \ from the amount of fuel in our tank (in QQ14) into A SBC QQ8
IF _SNG45 OR _SOURCE_DISC LDA QQ14 \ Subtract the distance to the selected system (in QQ8) SEC \ from the amount of fuel in our tank (in QQ14) into A SBC QQ8 ELIF _EXECUTIVE LDA QQ14 \ Subtract the distance to the selected system (in QQ8) BIT JUMP \ If infinite jump range is configured, then jump down BMI IJUMP \ to IJUMP so we don't subtract any fuel for this jump SEC \ from the amount of fuel in our tank (in QQ14) into A SBC QQ8 ENDIF

Code variation 2 of 9Other (e.g. bug fix, optimisation)

This might be a bug fix? The 6502SP version makes sure we don't end up with a negative fuel amount should we try a hyperspace jump that we don't have enough fuel for, though quite how we would get to this point is not clear.

This variation is blank in the Cassette, Disc (flight) and Electron versions.

6502SP, Master

BCS P%+4 \ If the subtraction didn't overflow, skip the next \ instruction LDA #0 \ The subtraction overflowed, so set A = 0 so we don't \ end up with a negative amount of fuel
 STA QQ14               \ Store the updated fuel amount in QQ14

Code variation 3 of 9Related to the 6502SP version

See variation 1 above for details.

This variation is blank in the Cassette, Disc (flight), Master and Electron versions.

6502SP

IF _EXECUTIVE .IJUMP ENDIF
 LDA QQ11               \ If the current view is not a space view, jump to ee5
 BNE ee5                \ to skip the following

 JSR TT66               \ Clear the top part of the screen, draw a white border,
                        \ and set the current view type in QQ11 to 0 (space
                        \ view)

 JSR LL164              \ Call LL164 to show the hyperspace tunnel and make the
                        \ hyperspace sound

.ee5

Code variation 4 of 9Specific to an individual platform

This variation is blank in the Electron version.

Tap on a version to expand it, and tap it again to show to all variations.

Cassette, Flight, 6502SP

Master

JSR CTRL \ Scan the keyboard to see if CTRL is currently pressed, \ returning a negative value in A if it is
IF _SNG47 JSR CTRL \ Scan the keyboard to see if CTRL is currently pressed, \ returning a negative value in A if it is ELIF _COMPACT JSR CTRLmc \ Scan the keyboard to see if CTRL is currently pressed, \ returning a negative value in A if it is ENDIF

Code variation 5 of 9Related to the Electron version

The Electron version doesn't support witchspace, so the code for triggering a manual mis-jump is missing.

Tap on a version to expand it, and tap it again to show to all variations.

Cassette

Flight, 6502SP, Master

Electron

AND PATG \ If the game is configured to show the author's names \ on the start-up screen, then PATG will contain &FF, \ otherwise it will be 0 BMI ptg \ By now, A will be negative if we are holding down CTRL \ and author names are configured, which is what we have \ to do in order to trigger a manual mis-jump, so jump \ to ptg to do a mis-jump (ptg not only mis-jumps, but \ updates the competition flags, so Acornsoft could tell \ from the competition code whether this feature had \ been used) JSR DORND \ Set A and X to random numbers CMP #253 \ If A >= 253 (1% chance) then jump to MJP to trigger a BCS MJP \ mis-jump into witchspace \JSR TT111 \ This instruction is commented out in the original \ source. It finds the closest system to coordinates \ (QQ9, QQ10), but we don't need to do this as the \ crosshairs will already be on a system by this point JSR hyp1+3 \ Jump straight to the system at (QQ9, QQ10) without \ first calculating which system is closest
AND PATG \ If the game is configured to show the author's names \ on the start-up screen, then PATG will contain &FF, \ otherwise it will be 0 BMI ptg \ By now, A will be negative if we are holding down CTRL \ and author names are configured, which is what we have \ to do in order to trigger a manual mis-jump, so jump \ to ptg to do a mis-jump (ptg not only mis-jumps, but \ updates the competition flags, so Acornsoft could tell \ from the competition code whether this feature had \ been used) JSR DORND \ Set A and X to random numbers CMP #253 \ If A >= 253 (1% chance) then jump to MJP to trigger a BCS MJP \ mis-jump into witchspace JSR hyp1+3 \ Jump straight to the system at (QQ9, QQ10) without \ first calculating which system is closest
JSR hyp1 \ Jump straight to the system at (QQ9, QQ10)

Code variation 6 of 9Specific to an individual platform

In the cassette version, hyp1 doesn't fall through into GVL, so we need to call it.

This variation is blank in the Disc (flight), 6502 Second Processor and Master versions.

Cassette, Electron

JSR GVL \ Calculate the availability for each market item in the \ new system
 JSR RES2               \ Reset a number of flight variables and workspaces

Code variation 7 of 9Related to the Master version

The Master version calls an extra bit of code when arriving in a new system that is responsible for breeding any Trumbles in the hold, though as there are no Trumbles in the BBC versions of the game, this never actually breeds anything.

Tap on a version to expand it, and tap it again to show to all variations.

Cassette, Flight, 6502SP

Master

Electron

JSR SOLAR \ Halve our legal status, update the missile indicators, \ and set up data blocks and slots for the planet and \ sun
JSR SOLARX \ Halve our legal status, update the missile indicators, \ and set up data blocks and slots for the planet and \ sun
JSR SOLAR \ Halve our legal status, update the missile indicators, \ and set up the data block and slot for the planet

Code variation 8 of 9Specific to an individual platform

This variation is blank in the Cassette, 6502 Second Processor, Master and Electron versions.

Flight

JSR LSHIPS \ Call LSHIPS to load a new ship blueprints file

Code variation 9 of 9A variation in the labels only

Tap on a version to expand it, and tap it again to show to all variations.

Cassette, Electron

Flight

6502SP, Master

LDA QQ11 \ If the current view in QQ11 is not a space view (0) or AND #%00111111 \ one of the charts (64 or 128), return from the BNE hyR \ subroutine (as hyR contains an RTS)
LDA QQ11 \ If the current view in QQ11 is not a space view (0) or AND #%00111111 \ one of the charts (64 or 128), return from the BNE TT113 \ subroutine (as TT113 contains an RTS)
LDA QQ11 \ If the current view in QQ11 is not a space view (0) or AND #%00111111 \ one of the charts (64 or 128), return from the BNE RTS111 \ subroutine (as RTS111 contains an RTS)
 JSR TTX66              \ Otherwise clear the screen and draw a white border

 LDA QQ11               \ If the current view is one of the charts, jump to
 BNE TT114              \ TT114 (from which we jump to the correct routine to
                        \ display the chart)

 INC QQ11               \ This is a space view, so increment QQ11 to 1

                        \ Fall through into TT110 to show the front space view

RSS Feed