Skip to navigation


Status: EXNO2

[NES version, Bank 0]

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.
.EXNO2 JSR IncreaseTally ; Add double the fractional kill count to the fractional ; and low bytes of our tally, setting the C flag if the ; addition overflowed 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 #0 ; We now set X to a number between 0 and 4 depending on ; the z-axis distance to the exploding ship, with 0 ; for distant ships and 4 for close ships CMP #16 ; If z_hi >= 16, jump to quiet2 with X = 0 BCS quiet2 INX ; Increment X to 1 CMP #8 ; If z_hi >= 8, jump to quiet2 with X = 1 BCS quiet2 INX ; Increment X to 2 CMP #6 ; If z_hi >= 6, jump to quiet2 with X = 2 BCS quiet2 INX ; Increment X to 3 CMP #3 ; If z_hi >= 3, jump to quiet2 with X = 3 BCS quiet2 INX ; Increment X to 4 .quiet2 LDY explosionSounds,X ; Set Y to the X-th sound effect from the table of ; explosion sound effect numbers JMP NOISE ; Call the NOISE routine to make the sound in Y, which ; will be the sound of a ship exploding at the specified ; distance, returning from the subroutine using a tail ; call