Skip to navigation


Status: EXNO2

[Apple II 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 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 to davidscockup to skip the ; following three instructions, as we have not earned ; a "RIGHT ON COMMANDER!" message 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 LDY #55 ; Call the SOEXPL routine with Y = 55 to make the sound BNE SOEXPL ; of a ship exploding, returning from the subroutine ; using a tail call