.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 LDA INWK+7 ; Fetch z_hi, the distance of the ship being hit in ; terms of the z-axis (in and out of the screen) LDX #11 ; We now set X to a number between 11 and 15 depending ; on the z-axis distance to the exploding ship, with 11 ; for distant ships and 15 for close ships CMP #16 ; If z_hi >= 16, jump to quiet2 with X = 11 BCS quiet2 INX ; Increment X to 12 CMP #8 ; If z_hi >= 8, jump to quiet2 with X = 12 BCS quiet2 INX ; Increment X to 13 CMP #6 ; If z_hi >= 6, jump to quiet2 with X = 13 BCS quiet2 INX ; Increment X to 14 CMP #3 ; If z_hi >= 3, jump to quiet2 with X = 14 BCS quiet2 INX ; Increment X to 15 .quiet2 TXA ; Set A = X << 4 ASL A ; ASL A ; So the value of X is in the high nibble of A, so we ASL A ; can pass it to NOISE2 as the sustain volume ASL A ORA #3 ; Set the low nibble of A to 3, so we can pass it to ; NOISE2 as the release length LDY #sfxexpl ; Call the NOISE2 routine with Y = sfxexpl, a frequency LDX #81 ; of 81 in X, and A set according to the explosion JMP NOISE2 ; distance: ; ; * Low nibble of A = release length of 3 ; ; * High nibble of A = sustain volume in the range 11 ; to 15, so closer explosions have a higher sustain ; volume and are therefore louder ; ; The call to NOISE2 returns from the subroutine using a ; tail callName: EXNO2 [Show more] Type: Subroutine Category: Status Summary: Process us making a kill Deep dive: Combat rankContext: 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
[X]
Configuration variable KWH% = $D084
The address of the kill tally integer table, as set in elite-data.asm
[X]
Configuration variable KWL% = $D063
The address of the kill tally fraction table, as set in elite-data.asm
[X]
Subroutine MESS (category: Flight)
Display an in-flight message
[X]
Subroutine NOISE2 (category: Sound)
Make a sound effect with a specific volume and release length
[X]
Label davidscockup is local to this routine
[X]
Label quiet2 is local to this routine
[X]
Configuration variable sfxexpl = 3
Sound 3 = We died / Collision