Skip to navigation

Elite on the BBC Micro and NES

Status: EXNO2

[BBC Master version]

Name: EXNO2 [Show more] Type: Subroutine Category: Status Summary: Process us making a kill Deep dive: Combat rank
Context: See this subroutine in context in the source code Variations: See code variations for this subroutine in the different versions References: This subroutine is called as follows: * Main flight loop (Part 5 of 16) calls EXNO2 * Main flight loop (Part 11 of 16) calls EXNO2 * TACTICS (Part 1 of 7) calls EXNO2

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.
Arguments: X The type of the ship that was killed
.EXNO2 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 .davidscockup \ Fall through into EXNO3 to make the sound of a \ ship exploding