Skip to navigation

Elite on the BBC Micro

Version analysis of Main flight loop (Part 5 of 16)

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

Code variations between these versions are shown below.

Name: Main flight loop (Part 5 of 16) Type: Subroutine Category: Main loop Summary: For each nearby ship: If an energy bomb has been set off, potentially kill this ship Deep dive: Program flow of the main game loop
The main flight loop covers most of the flight-specific aspects of Elite. This section covers the following: * Continue looping through all the ships in the local bubble, and for each one: * If an energy bomb has been set off and this ship can be killed, kill it and increase the kill tally
LDA BOMB \ If we set off our energy bomb (see MA24 above), then BPL MA21 \ BOMB is now negative, so this skips to MA21 if our \ energy bomb is not going off CPY #2*SST \ If the ship in Y is the space station, jump to BA21 BEQ MA21 \ as energy bombs are useless against space stations

Code variation 1 of 4Related to the Master version

In the Master version, energy bombs have no effect against Thargoids.

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

Master

CPY #2*THG \ If the ship in Y is a Thargoid, jump to BA21 as energy BEQ MA21 \ bombs have no effect against Thargoids

Code variation 2 of 4Related to an advanced feature

In the advanced versions, energy bombs have no effect against the Constrictor in mission 1.

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

6502SP, Master

CPY #2*CON \ If the ship in Y is the Constrictor, jump to BA21 BCS MA21 \ as energy bombs are useless against the Constrictor \ (the Constrictor is the target of mission 1, and it \ would be too easy if it could just be blown out of \ the sky with a single key press)
 LDA INWK+31            \ If the ship we are checking has bit 5 set in its ship
 AND #%00100000         \ byte #31, then it is already exploding, so jump to
 BNE MA21               \ BA21 as ships can't explode more than once

Code variation 3 of 4Minor and very low-impact

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

Cassette, Electron

Flight, 6502SP, Master

LDA INWK+31 \ The energy bomb is killing this ship, so set bit 7 of ORA #%10000000 \ the ship byte #31 to indicate that it has now been STA INWK+31 \ killed
ASL INWK+31 \ The energy bomb is killing this ship, so set bit 7 of SEC \ the ship byte #31 to indicate that it has now been ROR INWK+31 \ killed

Code variation 4 of 4Related to the Master version

The Master version awards different numbers of kill points to all the different types of ship that the energy bomb kills.

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

Master

LDX TYPE \ Set X to the type of the ship that was killed so the \ following call to EXNO2 can award us the correct \ number of fractional kill points
 JSR EXNO2              \ Call EXNO2 to process the fact that we have killed a
                        \ ship (so increase the kill tally, make an explosion
                        \ sound and possibly display "RIGHT ON COMMANDER!")

RSS Feed