Skip to navigation

Elite on the BBC Micro

Sound: EXNO2

[BBC Master version]

Name: EXNO2 [Show more] Type: Subroutine Category: Sound 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 11 of 16) calls EXNO2 * Main flight loop (Part 5 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 TALLYF \ We now add the fractional kill count to our tally, CLC \ starting by with the fractional bytes: ADC TALLYFRAC-1,X \ STA TALLYF \ TALLYF = TALLYF + fractional kill count \ \ where the fractional kill count is taken from the \ TALLYFRAC table, according to the ship's type (we \ look up the X-1-th value from TALLYFRAC because ship \ types start at 1 rather than 0) LDA TALLY \ And then we add the low byte of TALLY(1 0): ADC TALLYINT-1,X \ STA TALLY \ TALLY = TALLY + carry + integer kill count \ \ where the integer kill count is taken from the \ TALLYINT table in the same way BCC EXNO3 \ 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 \ Fall through into EXNO3 to make the sound of a \ ship exploding