*         2150    251083
*
*
** EXPLODE.S **
** ASTEROIDS FOR THE ATARI 3600 **
** THIS FILE CONTAINS THE EXPLOSION HANDLING ROUTINE. **

EXPLODE:
	LDY     #32
EXPLLOOP:
	LDA     STATUS,Y
	BPL     NEXTEXPL
	CMP     #$FF
	BEQ     NEXTEXPL

	TYA			;GET NEW ANIMATION INDEX
	ASL
	ADC     FRMCNT
	LSR
	AND     #$3		;3 ANDED WITH FRMCNT TO DECIDE
	BNE     NEXTEXPL	;WHEN NEXT ANIMATION

	LDA     STATUS,Y
	AND     #$0F
	TAX
	LDA     ACYC,Y
	CMP     EHBOUND,X
	BNE     NEXTECYC

	CPX     #3
	BCS     DONULL

	LDX     PLAYER
	DEC     ROCKTOT,X	;ONE LESS ROCK FOR CURRENT PLAYER

DONULL:
	LDA     #$FF
	STA     STATUS,Y
	BMI     NEXTEXPL

NEXTECYC:
	CLC
	ADC     ESIZE,X
	STA     ACYC,Y

NEXTEXPL:
	DEY
	BPL     EXPLLOOP
	RTS

ESIZE:
	.DC.B	1,2,3,2,1,2,0
