.EXNO 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 #8 ; If z_hi >= 8, jump to quiet with X = 11 BCS quiet INX ; Increment X to 12 CMP #4 ; If z_hi >= 4, jump to quiet with X = 12 BCS quiet INX ; Increment X to 13 CMP #3 ; If z_hi >= 3, jump to quiet with X = 13 BCS quiet INX ; Increment X to 14 CMP #2 ; If z_hi >= 2, jump to quiet with X = 14 BCS quiet INX ; Increment X to 15 .quiet TXA ; Set A = X << 4 ASL A ; ASL A ; So the value of X is in the high nibble of A ASL A ASL A ORA #3 ; Set the low nibble of A to 3, so we can pass it to ; NOISE2 as the release length LDY #sfxhit ; Call the NOISE2 routine with Y = sfxhit, a frequency LDX #208 ; of 208 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: EXNO [Show more] Type: Subroutine Category: Sound Summary: Make the sound of a laser strike or ship explosionContext: See this subroutine in context in the source code References: This subroutine is called as follows: * Main flight loop (Part 11 of 16) calls EXNO
Make the two-part explosion sound of us making a laser strike, or of another ship exploding. The volume of the first explosion is affected by the distance of the ship being hit, with more distant ships being quieter.
[X]
Subroutine NOISE2 (category: Sound)
Make a sound effect with a specific volume and release length
[X]
Label quiet is local to this routine
[X]
Configuration variable sfxhit = 2
Sound 2 = Other ship exploding