Skip to navigation

Elite on the BBC Micro and NES

Version analysis of EXNO2

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

Code variations between these versions are shown below.

Name: EXNO2 Type: Subroutine Category: Status Summary: Process us making a kill Deep dive: Combat rank
We have killed a ship, so increase the kill tally, displaying an iconic message of encouragement if the kill total is a multiple of 256, and then make a nearby explosion sound.

Code variation 1 of 3A variation in the comments only

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

Arguments: X The type of the ship that was killed
.EXNO2

Code variation 2 of 3Related to the Master version

The Master version incorporates a fractional kill tally when calculating the combat rank, so each ship type has a different number of kill points, while all the other versions count one point for each kill.

Tap on a block to expand it, and tap it again to revert.

INC TALLY \ Increment the low byte of the kill count in TALLY BNE EXNO-2 \ If there is no carry, jump to the LDX #7 below (at \ EXNO-2)
LDA TALLYL \ We now add the fractional kill count to our tally, CLC \ starting with the fractional bytes: ADC KWL%-1,X \ STA TALLYL \ TALLYL = TALLYL + fractional kill count \ \ where the fractional kill count is taken from the \ KWL% table, according to the ship's type (we look up \ the X-1-th value from KWL% because ship types start \ at 1 rather than 0) LDA TALLY \ And then we add the low byte of TALLY(1 0): ADC KWH%-1,X \ STA TALLY \ TALLY = TALLY + carry + integer kill count \ \ where the integer kill count is taken from the KWH% \ table in the same way BCC davidscockup \ If there is no carry, jump straight to EXNO3 to skip \ the following three instructions
 INC TALLY+1            \ Increment the high byte of the kill count in TALLY

 LDA #101               \ The kill total is a multiple of 256, so it's time
 JSR MESS               \ for a pat on the back, so print recursive token 101
                        \ ("RIGHT ON COMMANDER!") as an in-flight message

Code variation 3 of 3Specific to an individual platform

Tap on a block to expand it, and tap it again to revert.

LDX #7 \ Set X = 7 and fall through into EXNO to make the \ sound of a ship exploding
.davidscockup \ Fall through into EXNO3 to make the sound of a \ ship exploding