ORG level_start

lvl_offset EQU 8


IF output_files
	write "bin/level7.lvl"
ENDIF

;****************************************
; *	LEVEL 7 DATA 
;****************************************
START	DEFB 0
SYNCHRO	DEFW 0000
;
START1	DEFB 0 ;test_pos ;0
START2	DEFB 45
START3	DEFB 255
;
SYNCHRO1	DEFW SYNC1 ;test_sync ;SYNC1
SYNCHRO2	DEFW SYNC2
SYNCHRO3	DEFW SYNC3
;
TSPRADD		DEFW 0
TADD		DEFW 0
SEQTABLE	DEFW SQTABLE
SPEVENT1	DEFW SPEV1
SPEVENT2	DEFW SPEV2

.lvl_pal
	db 0,26,11,6,3,20,10,2,1,25,16,18,9,15,12,0
	db 0
	db 0,20,2,3,0,10,1,1,0,12,3,9,0,3,1,0
	db 0
	db 0,11,1,3,0,1,0,1,0,3,0,9,0,3,0,0
	db 0
	db 0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
	db 0

.lvl_floating_color
	db 14
.lvl_music
	db 6 
.lvl_skip
	dw 0	;music to skip on music restart
.lvl_init
	dw	0	;called after loading
.lvl_reinit
	dw	0	;called each time player dies
	
;****************************************
;*	LEVEL 7 - ATTACK WAVES
;****************************************
;	1ST BYTE = TILENO
;	2ND BYTE
;		BITS 0-2 = TILESCROLL
;		BITS 3-4 = TILEPOS
;		BITS 5-7 = 
;	3RD BYTE = SEQUENCE NUMBER
;	4TH BYTE = INITIAL X POSITION
;	5TH BYTE = INITIAL Y POSITION
;	(TILESCROLL = FRAME OR BITPOS)
;****************************************
.SYNC1

	;FORCE_SLOT 1,8-lvl_offset,7,56,-1,-1	;dummy one for later

	db 8-lvl_offset,7,54,39+12,16
	
	
	
	DEFB 9-lvl_offset,1,99,4,8
	DEFB 9-lvl_offset,1,1,32,9
 	DEFB 9-lvl_offset,7,1,32,7
 	DEFB 9-lvl_offset,14,1,32,8
	DEFB 9-lvl_offset,15,2,32,10 ;9
	
;	db 0,0,0,0,0
	
	DEFB 10-lvl_offset,0,1,31,6
	DEFB 10-lvl_offset,30,1,31,8
 	DEFB 11-lvl_offset,30,1,31,9
 	DEFB 12-lvl_offset,15,1,31,10
	DEFB 13-lvl_offset,0,15,31,15
	DEFB 13-lvl_offset,15,1,31,7
 	DEFB 13-lvl_offset,30,1,31,6
 	DEFB 14-lvl_offset,15,1,31,10
	DEFB 14-lvl_offset,24,14,31,2
	DEFB 14-lvl_offset,27,14,31,6
	DEFB 15-lvl_offset,14,9,30,9
 	DEFB 16-lvl_offset,0,3,31,9
	DEFB 16-lvl_offset,24,22,29,7
	DEFB 16-lvl_offset,29,21,31,15
 	DEFB 17-lvl_offset,0,10,16,253
 	DEFB 17-lvl_offset,4,10,16,253
 	DEFB 17-lvl_offset,8,10,16,253
 	DEFB 17-lvl_offset,12,10,16,253
	DEFB 17-lvl_offset,16,10,16,253
	DEFB 17-lvl_offset,20,10,16,253
	DEFB 17-lvl_offset,24,10,16,253
	DEFB 17-lvl_offset,28,10,16,253
	DEFB 18-lvl_offset,0,4,31,11
 	DEFB 18-lvl_offset,0,10,16,253
 	DEFB 18-lvl_offset,4,10,16,253
 	DEFB 18-lvl_offset,8,14,31,2
 	DEFB 18-lvl_offset,9,24,32,12
	DEFB 18-lvl_offset,16,15,31,15
 	DEFB 18-lvl_offset,16,14,3,31
	DEFB 18-lvl_offset,28,25,33,12
 	DEFB 19-lvl_offset,16,26,31,9
	DEFB 19-lvl_offset,24,22,29,7



	
	DEFB 20-lvl_offset,0,14,31,10
	DEFB 20-lvl_offset,0,14,6,255
	DEFB 20-lvl_offset,1,27,31,12
	DEFB 21-lvl_offset,24,14,0,255
 	DEFB 21-lvl_offset,24,23,31,10 ;9
	DEFB 22-lvl_offset,24,5,254,7

	
	;explo
	db 23-lvl_offset,7,55,31,0

	LVL_SetSpec2	24-lvl_offset,14,0
	DEFB 24-lvl_offset,15,28,247-4,8
	
 	DEFB 25-lvl_offset,0,50,33,15
	
	DEFB 27-lvl_offset,0,26,31,9
 	DEFB 28-lvl_offset,0,26,31,9
	


	;explo up
	db 28-lvl_offset,7,55,32+11,0
	;explo down
	db 29-lvl_offset,7,54,32+7,16
	
	
 	DEFB 29-lvl_offset,24,29,33,9
	DEFB 29-lvl_offset,24,30,32,15
	

	
 	DEFB 30-lvl_offset,24,31,34,9
	DEFB 30-lvl_offset,24,32,33,15
 	DEFB 30-lvl_offset,24,33,34,3
	DEFB 31-lvl_offset,4,34,45,3
 	DEFB 32-lvl_offset,0,34,41,3
 	DEFB 32-lvl_offset,8,14,31,8
 	DEFB 32-lvl_offset,16,6,30,9
 	DEFB 33-lvl_offset,24,35,39,9
	DEFB 34-lvl_offset,24,35,39,10
 	DEFB 36-lvl_offset,16,37,32,9
	

	;explo up
	db 37-lvl_offset,7,55,32+7,0

	
	DEFB 39-lvl_offset,0,14,255,2
	DEFB 39-lvl_offset,1,51,30,15
	
	
	
	
	DEFB 40-lvl_offset,12,38,255,9
 	DEFB 40-lvl_offset,16,14,255,7
 	DEFB 40-lvl_offset,24,14,31,2	
	
	DEFB 41-lvl_offset,0,14,31,7
 	DEFB 42-lvl_offset,0,14,31,12
	DEFB 42-lvl_offset,8,14,255,15
	

	
	
 	DEFB 43-lvl_offset,0,39,48,15
	DEFB 43-lvl_offset,16,40,253,9
 	DEFB 43-lvl_offset,16,39,46,15
 	DEFB 44-lvl_offset,0,39,44,15
	DEFB 44-lvl_offset,16,39,42,15
 	DEFB 45-lvl_offset,0,39,40,15

	;FORCE_SLOT 1,
	db 45-lvl_offset,7,54,32+3,16
	
	DEFB 45-lvl_offset,8,14,255,4
	
	CHECK_POINT 45-lvl_offset,15
	
.SYNC2



	

	DEFB 45-lvl_offset,16,99,4,4
 	DEFB 45-lvl_offset,16,39,38,15
	
 	DEFB 46-lvl_offset,0,39,36,15
	
	DEFB 46-lvl_offset,16,39,34,15
	
 	DEFB 47-lvl_offset,0,39,32,15
	DEFB 47-lvl_offset,0,14,31,3
	
	db 47-lvl_offset,7,54,32+3,16
	
 	DEFB 47-lvl_offset,16,39,30,15
 	DEFB 48-lvl_offset,0,14,31,15
	DEFB 50-lvl_offset,8,41,31,9
 	DEFB 51-lvl_offset,0,7,31,15
 	DEFB 51-lvl_offset,16,11,20,253
	DEFB 51-lvl_offset,20,11,20,253
	DEFB 51-lvl_offset,24,11,19,253
	DEFB 51-lvl_offset,24,20,19,253
	DEFB 51-lvl_offset,28,11,19,253
	DEFB 51-lvl_offset,28,20,19,253
	DEFB 52-lvl_offset,0,11,18,253
 	DEFB 52-lvl_offset,0,20,18,253
 	DEFB 52-lvl_offset,4,11,18,253
 	DEFB 52-lvl_offset,4,20,18,253
 	DEFB 52-lvl_offset,8,11,17,253
 	DEFB 52-lvl_offset,8,20,17,253
 	DEFB 52-lvl_offset,12,11,17,253
	DEFB 52-lvl_offset,12,20,17,253

	DEFB 52-lvl_offset,16,11,16,253
	DEFB 52-lvl_offset,16,20,16,253
	DEFB 52-lvl_offset,20,11,16,253
	DEFB 52-lvl_offset,20,20,16,253
	DEFB 52-lvl_offset,24,20,15,253
	DEFB 52-lvl_offset,28,20,15,253
	DEFB 53-lvl_offset,0,20,14,253
 	DEFB 53-lvl_offset,4,20,14,253
 	DEFB 53-lvl_offset,8,20,13,253
 	DEFB 53-lvl_offset,12,20,13,253
	DEFB 53-lvl_offset,16,14,31,3
	DEFB 53-lvl_offset,16,14,31,15
 	DEFB 53-lvl_offset,16,14,31,11
 	DEFB 53-lvl_offset,16,20,12,253
	DEFB 53-lvl_offset,20,20,12,253
	DEFB 53-lvl_offset,24,20,11,253
	DEFB 53-lvl_offset,28,20,11,253
	DEFB 54-lvl_offset,0,20,10,253
 	DEFB 54-lvl_offset,4,20,10,253
 	DEFB 54-lvl_offset,8,20,9,253
	DEFB 54-lvl_offset,12,20,9,253
 	DEFB 54-lvl_offset,16,20,8,253
 	DEFB 54-lvl_offset,20,20,8,253
 	DEFB 54-lvl_offset,24,20,7,253
 	DEFB 54-lvl_offset,28,20,7,253
 	DEFB 55-lvl_offset,0,20,6,253
	DEFB 55-lvl_offset,4,20,6,253
	DEFB 55-lvl_offset,8,20,5,253
	DEFB 55-lvl_offset,12,20,5,253
 	DEFB 55-lvl_offset,16,20,4,253
 	DEFB 55-lvl_offset,20,20,4,253
 	DEFB 55-lvl_offset,24,20,3,253
 	DEFB 55-lvl_offset,28,20,3,253
	

	
 	DEFB 56-lvl_offset,0,20,2,253
	DEFB 56-lvl_offset,4,20,2,253
	
	;explo down
	db 56-lvl_offset,7,54,32+3,16
	
	DEFB 56-lvl_offset,8,20,1,253
	DEFB 57-lvl_offset,18,1,31,9
 	DEFB 57-lvl_offset,28,1,31,7
 	DEFB 58-lvl_offset,16,1,31,6
 	DEFB 58-lvl_offset,26,1,31,5
 	DEFB 59-lvl_offset,4,1,31,10
	
	;explo up
	db 59-lvl_offset,7,55,32+3,0
	
 	DEFB 59-lvl_offset,14,15,36,15
 	DEFB 59-lvl_offset,24,1,31,4
 	DEFB 59-lvl_offset,28,15,33,15
 	DEFB 60-lvl_offset,2,1,31,9
	DEFB 60-lvl_offset,8,15,38,15
	DEFB 60-lvl_offset,16,15,30,15
 	DEFB 60-lvl_offset,22,1,31,5
 	DEFB 61-lvl_offset,0,1,31,4
	DEFB 61-lvl_offset,1,99,3,25
 	DEFB 61-lvl_offset,1,8,31,3
	DEFB 61-lvl_offset,20,1,31,7
 	DEFB 61-lvl_offset,30,1,31,6
 	DEFB 62-lvl_offset,18,1,31,6
 	DEFB 62-lvl_offset,28,1,31,5
 	DEFB 63-lvl_offset,16,1,31,9
 	DEFB 63-lvl_offset,26,1,31,5
 	DEFB 64-lvl_offset,14,1,31,7
 	DEFB 64-lvl_offset,24,1,31,3
 	DEFB 65-lvl_offset,12,1,31,4
 	DEFB 65-lvl_offset,22,1,31,6
 	DEFB 66-lvl_offset,0,1,31,8
	DEFB 66-lvl_offset,20,1,31,6
 	DEFB 66-lvl_offset,30,1,31,8
 	DEFB 67-lvl_offset,0,49,253,15
 	DEFB 67-lvl_offset,18,1,31,6
 	DEFB 67-lvl_offset,28,1,31,10
	DEFB 68-lvl_offset,16,1,31,9
 	DEFB 68-lvl_offset,26,1,31,7
 	DEFB 69-lvl_offset,14,1,31,7
 	DEFB 69-lvl_offset,24,1,31,3
 	DEFB 70-lvl_offset,2,1,31,5
	DEFB 70-lvl_offset,22,1,31,9
	
	LVL_Music	71-lvl_offset,0,8
	
	test_pos		EQU 71-lvl_offset
	test_sync		EQU $
	
	LVL_SetSpec2	72-lvl_offset,0,0	;setup boss
 	DEFB 72-lvl_offset,0,12,21,255 ;green alien
 ;stop scroll
 	DEFB 72-lvl_offset,17,99,1,0
	
;garbage openers
 	DEFB 73-lvl_offset,8,99,6,sfx_trashcan
 	DEFB 73-lvl_offset,8,52,20,2	
	
 	DEFB 73-lvl_offset,18,99,6,sfx_trashcan
	DEFB 73-lvl_offset,18,52,14,2
	
	DEFB 73-lvl_offset,28,99,6,sfx_trashcan
	DEFB 73-lvl_offset,28,52,8,2
	
 	DEFB 74-lvl_offset,6,99,6,sfx_trashcan
 	DEFB 74-lvl_offset,6,52,2,2
	
	DEFB 74-lvl_offset,8,42,3,248
	DEFB 74-lvl_offset,8,43,9,252
	DEFB 74-lvl_offset,8,44,15,249
 	DEFB 74-lvl_offset,8,43,21,255
	
 	DEFB 76-lvl_offset,0,48,13,17
	DEFB 76-lvl_offset,0,99,6,sfx_bugboss7
	
	DEFB 76-lvl_offset,0,99,3,26
 	DEFB 76-lvl_offset,0,46,36,7 ;8	

	DEFB 76-lvl_offset,0,47,33,9
	DEFB 76-lvl_offset,16,99,6,sfx_boss7shot
	
 	DEFB 77-lvl_offset,10,48,3,17
	DEFB 77-lvl_offset,10,99,6,sfx_bugboss7
	
	DEFB 78-lvl_offset,0,99,3,26	
 	DEFB 78-lvl_offset,0,46,36,7 ;8
	
 	DEFB 78-lvl_offset,0,47,33,9
	DEFB 78-lvl_offset,16,99,6,sfx_boss7shot

	DEFB 78-lvl_offset,20,48,18,17
	DEFB 78-lvl_offset,20,99,6,sfx_bugboss7
	
 	DEFB 79-lvl_offset,30,48,8,17
	DEFB 79-lvl_offset,30,99,6,sfx_bugboss7
	
	DEFB 80-lvl_offset,0,99,3,26
 	DEFB 80-lvl_offset,0,46,36,7 ;8
	
 	DEFB 80-lvl_offset,0,47,33,9
	DEFB 80-lvl_offset,16,99,6,sfx_boss7shot
	
 	DEFB 81-lvl_offset,8,48,23,17
	DEFB 81-lvl_offset,8,99,6,sfx_bugboss7
	
	DEFB 82-lvl_offset,0,99,3,26
 	DEFB 82-lvl_offset,0,46,36,7 ;8
	
 	DEFB 82-lvl_offset,0,47,33,9
	DEFB 82-lvl_offset,16,99,6,sfx_boss7shot
	
 	DEFB 82-lvl_offset,18,48,11,17
	DEFB 82-lvl_offset,18,99,6,sfx_bugboss7
	
 	DEFB 83-lvl_offset,28,48,8,17
	DEFB 83-lvl_offset,28,99,6,sfx_bugboss7
	
	DEFB 84-lvl_offset,0,99,3,26
 	DEFB 84-lvl_offset,0,46,36,7 ;8
	
 	DEFB 84-lvl_offset,0,47,33,9
	DEFB 84-lvl_offset,16,99,6,sfx_boss7shot
	
 	DEFB 85-lvl_offset,6,48,18,17
	DEFB 85-lvl_offset,6,99,6,sfx_bugboss7
	
	DEFB 86-lvl_offset,0,99,3,26
 	DEFB 86-lvl_offset,0,46,36,7 ;8
	
 	DEFB 86-lvl_offset,0,47,33,9
	DEFB 86-lvl_offset,16,99,6,sfx_boss7shot
	
 	DEFB 86-lvl_offset,16,48,13,17
	DEFB 86-lvl_offset,16,99,6,sfx_bugboss7
	
 	DEFB 87-lvl_offset,26,48,3,17
	DEFB 87-lvl_offset,26,99,6,sfx_bugboss7
	
	DEFB 88-lvl_offset,0,99,3,26
 	DEFB 88-lvl_offset,0,46,36,7 ;8
	
 	DEFB 88-lvl_offset,0,47,33,9
	DEFB 88-lvl_offset,16,99,6,sfx_boss7shot
	
 	DEFB 89-lvl_offset,4,48,18,17
	DEFB 89-lvl_offset,4,99,6,sfx_bugboss7
	
	
	DEFB 90-lvl_offset,0,99,3,26
 	DEFB 90-lvl_offset,0,46,36,7 ;8
	
 	DEFB 90-lvl_offset,0,47,33,9
	
	
 	DEFB 90-lvl_offset,14,48,8,17
	DEFB 90-lvl_offset,14,99,6,sfx_bugboss7
	
	DEFB 90-lvl_offset,16,99,6,sfx_boss7shot
	
	DEFB 91-lvl_offset,24,48,23,17
	DEFB 91-lvl_offset,24,99,6,sfx_bugboss7
	
 	DEFB 92-lvl_offset,0,99,3,26
 	DEFB 92-lvl_offset,0,46,36,7 ;8
	
 	DEFB 92-lvl_offset,0,47,33,9
	DEFB 92-lvl_offset,16,99,6,sfx_boss7shot
	
 	DEFB 93-lvl_offset,2,48,11,17
	DEFB 93-lvl_offset,2,99,6,sfx_bugboss7
	
	;DEFB 94-lvl_offset,8,99,6,10
 	;DEFB 94-lvl_offset,8,99,6,10
 	DEFB 94-lvl_offset,8,99,6,sfx_trashcan
 	DEFB 94-lvl_offset,8,53,2,2
	DEFB 94-lvl_offset,8,53,8,2
	DEFB 94-lvl_offset,8,53,14,2
 	DEFB 94-lvl_offset,8,53,20,2
	
 	DEFB 96-lvl_offset,0,99,5,0
;
SYNC3	DEFB 255,255,255,255,255	
;****************************************
 ;	1ST BYTE
 ;		BITS 0-3 = SPECIAL EVENT 1
;		BITS 0-4 = SPECIAL EVENT 2
;	2ND BYTE = HIT POINTS
;	3RD BYTE
 ;		BITS 0-3 = POINT VALUE
;		BITS 4-7 = EXPLOSION TYPE
 ;	BYTES ARE NOW PAIRED TO MAKE UP
;	ADDRESS OF SPRITE PATTERNS
 ;	WORD 0 = END OF SEQUENCE 
;****************************************
 ;RED TWISTERS
SQ1	DEFB 0,1+64,2+16
 	DEFW SP1,SP1,SP1,SP1,0
;PODDER 1
SQ2	DEFB 2+#E0,1,2+#20
	DEFW SP11E,SP11E,SP11G,SP11C
	DEFW SP11BB,SP11A,SP11B,SP11C,0
 ;PODDER 2
SQ3	DEFB 2+#F0,1,2+#20
	DEFW SP11E,SP11E,SP11E,SP11E,SP11G,SP11CC,SP11B
 	DEFW SP11BB,SP11D,SP11D,SP11DDD,SP11G,SP11E,SP11E,0
 ;PODDER 3
SQ4	DEFB 2+#B0,1,2+#20
	DEFW SP11AA,SP11G,SP11E,SP11E
 	DEFW SP11E,SP11E,SP11E,SP11E,SP11E,0
;PODDER 4
SQ5	DEFB 2+#B0,1,2+#20
	DEFW SP11II,SP11HH,SP11I,SP11JJ,SP11K,SP11K
 	DEFW SP11GG,SP11E,SP11E,SP11E,SP11E,0
 ;PODDER 5
SQ6	DEFB 2+#D0,1,2+#20
	DEFW SP11E,SP11E,SP11E,SP11E,SP11G,SP11B
	DEFW SP11AA,SP11BB,SP11CC,SP11BB,0
;PODDER 6
SQ7	DEFB 2+#E0,1,2+#20
	DEFW SP11E,SP11E,SP11E,SP11E,SP11G
	DEFW SP11E,SP11E,SP11E,SP11E,0
;PODDER 7
SQ8	DEFB 2+#70,1,2+#20
	DEFW SP11BB,SP11A,SP11B,SP11C
 	DEFW SP11BB,SP11A,SP11B,SP11C,0 
;WALKER 1
SQ9	DEFB 1+#10,1+64,2+#20
	DEFW SP8,SP8MEG,SP8C,SP8A,SP8B,SP8MEG
 	DEFW SP8B,SP8E,SP80,SP80,SP80,SP80,SP80,SP80,0
;YELLOW BUTTERFLIES 1
SQ10	DEFB 0,1+64,2+#20
	DEFW SP2,SP2,SP2A,SP2B,SP2B,0
 ;YELLOW BUTTERFLIES 2
SQ11	DEFB 0,1+64,2+#20
	DEFW SP2,SP2A,SP2B,SP2A,SP2,SP2AA,SP2B,SP2B,0
	
;BLUE GOBOT
L7_MASTER1		EQU $+1
L7_MASTER1_val	EQU 28*2
SQ12	DEFB 10,28,64+5 ;10,28,5+4*16
 	DEFW SP12,SP12,SP12,SP12,SP12,SP12A,65535
 ;BLUE GOBOT PROJECTILE
SQ13	DEFB 11,63,0 ;11,63,12+16*1
	DEFW SP13,SP13,0

;NODDING SNALIEN
 SQ14	DEFB 12+16,1+64,3+#20
	DEFW SP14B,SP14,SP14C,SP14A,65535
 ;MISSILE WALKER
L7_MASTER2		EQU $+1
L7_MASTER2_val	EQU 48
SQ15	DEFB 14+16,16,5+#20
		DEFW SP26A,SP26E,SP26C,SP26D
		DEFW SP26D,SP26C,SP26E,SP26A,SP26E,SP26C,SP26D
		DEFW SP26D,SP26C,SP26A,SP26EE,SP26CC,SP26DD,SP26DD
		DEFW SP26A,SP26A,0
;MISSILE 1 L
 SQ16	DEFB 0,1,#30
	DEFW SP27A,SP27A,SP27C,SP27B,SP27B,0
;MISSILE 2 L
 SQ17	DEFB 0,1,#30
	DEFW SP27A,SP27A,SP27CC,SP27B,SP27B,0
 ;MISSILE 1 R
 SQ18	DEFB 0,1,#30
	DEFW SP27A,SP27A,SP27D,SP27B,SP27B,0
;MISSILE 2 R
 SQ19	DEFB 0,1,#30
	DEFW SP27A,SP27A,SP27DD,SP27B,SP27B,0
 ;YELLOW BUTTERFLIES 3
SQ20	DEFB 0,1+64,2+#20
	DEFW SP2Z,SP2,SP2,SP2A,SP2Z,SP2C,SP2D,SP2DD,SP2E
	DEFW SP2F,SP2FF,SP2G,SP2D,SP2D,SP2D,0
 ;WALKER 2
SQ21	DEFB 1+#10,1+64,2+#20
 	DEFW SP8MEG,SP8MEG,SP8MEG,SP8MEG,0
;
;WALKER 3/4
SQ22	DEFB 1+#10,1+64,2+#20
 	DEFW SP8A,SP8AA,SP8B,SP8MEG,SP8MEG,SP8MEG,SP8MEG,0
;WALKER 5
SQ23	DEFB 1+#10,1+64,2+#20
 	DEFW SP8,SP8B,SP8H,SP8AB,SP8B,SP8MEG,SP8MEG,SP8MEG,0
;STRANGE FLIER 1
 SQ24	DEFB 1+#10,1,2+#20
	DEFW SP3A,SP3,SP3B,SP3,SP3,SP3,0
;STRANGE FLIER 2
SQ25	DEFB 1+#10,1,2+#20
	DEFW SP3,SP3,SP3C,SP3A,SP3,SP3,0
;STRANGE FLIER 3
SQ26	DEFB 1+#10,1,2+#20
	DEFW SP3,SP3,SP3,SP3,0
;STRANGE FLIER 4
SQ27	DEFB 1+#10,1,2+#20
	DEFW SP3A,SP3,SP3,SP3B,SP3,SP3A,0
 ;BIG UFO
SQ28	
	DEFB 7+#30,62,0
 	DEFW SP4A,SP4A,SP4A,SP4A,SP4A,SP4A,SP4A
 	DEFW SP4A,SP4A,SP4A,SP4A,SP4A,SP4A,SP4A
 	DEFW SP4,SP4,SP4,SP4,SP4,SP4,SP4
	DEFW SP4,SP4,SP4,SP4,SP4,SP4,SP4
	DEFW SP4,SP4,SP4,SP4,SP4,SP4,SP4
	DEFW SP4,SP4,SP4,SP4,SP4,SP4,SP4,0
;WALKER 7
SQ29	DEFB 1+#10,1+64,2+#20
 	DEFW SP8MEG,SP8C,SP8A,SP8B,SP8MEG,SP8M2,SP8C,SP8A,0
 ;WALKER 8
SQ30	DEFB 1+#10,1+64,2+#20
 	DEFW SP8MEG,SP8MEG,SP8M2,SP8C,SP8A,0
;WALKER 9
SQ31	DEFB 1+#10,1+64,2+#20
 	DEFW SP8,SP8M2,SP8MEG,SP8C,SP8A,SP8B
	DEFW SP8MEG,SP8M2,SP8C,SP8A,0
 ;WALKER 10
SQ32	DEFB 1+16,1+64,2+#20
 	DEFW SP8,SP8M2,SP8MEG,SP8MEG,SP8M2,SP8C,SP8A,0
;WALKER 11
SQ33	DEFB 1+#10,1+64,2+#20
 	DEFW SP8MEG,SP8M2,SP8C,SP8A,SP8B
	DEFW SP8,SP8C,SP8A,SP8B,SP8MEG,SP8M2,SP8C,SP8A,0
;WALKER 12/13
SQ34	DEFB 1+#10,1+64,2+#20
 	DEFW SP8MEG,SP8MEG,SP8MEG,SP8M2,SP8C,SP8A,SP8B
	DEFW SP8,SP8C,SP8A,SP8B,SP8MEG,SP8MEG,0
 ;SCISSOR FLYER
SQ35	DEFB 3+#10,1,4+#20
	DEFW SP5,SP5,SP5,SP5,SP5,0
;SCISSOR LASERS
SQ36	DEFB 0,63,#20
 	DEFW SP6,SP6,SP6,SP6,SP6,0
;WALKER 14
SQ37	DEFB 1+#10,1+64,2+#20
 	DEFW SP8MEG,SP8H,SP8A,SP8B,SP8MEG,SP8MEG,SP8MEG,0
 ;WALKER 15
SQ38	DEFB 1+#10,1+64,2+#20
 	DEFW SP80,SP8F,SP8E,SP80,SP80
 	DEFW SP8FF,SP8D,SP8E,SP80,SP8F,SP8D,SP8D,0
;WALKERS 16-25
SQ39	DEFB 1+#10,1+64,2+#20
 	DEFW SP8MEG,SP8MEG,SP8MEG,SP8C,SP8A,0
 ;WALKER 26
SQ40	DEFB 1+#10,1+64,2+#20
 	DEFW SP80,SP802,SP8F,SP8D,SP8DDD,SP8B,SP8MEG,0
;WALKER 27
SQ41	DEFB 1+#10,1+64,2+#20
 	DEFW SP8MEG,SP8C,SP8A,SP8B,SP8MEG,SP8MEG,SP8MEG,0
 ;GARBAGE 1
SQ42	DEFB 4+#60,1,1+#20
	DEFW SP15,SP15,SP15,SP15,0
;GARBAGE 2
SQ43	DEFB 4+#60,1,1+#20
	DEFW SP16,SP16,SP16,SP16,0
;GARBAGE 3
SQ44	DEFB 4+#60,1,1+#20
	DEFW SP17,SP17,SP17,SP17,0
;GARBAGE 4
 SQ45	DEFB 4+#60,1,1+#20
	DEFW SP17,SP17,SP17,SP17,0
;BIG END ALIEN
 SQ46	DEFB 5+#30,62,#20
	DEFW SP10Z,SP10,SP10,SP10C,SP10B,SP10B,0
 ;BIG END ALIEN GARBAGE
 SQ47	DEFB 0,1,#20
	DEFW SP9,SP9B,SP9C,SP9A,0
 ;PERISCOPE PEEPERS
 SQ48	DEFB 6,1+64,4+#20
	DEFW SP19,SP19B,SP19B,SP19B,SP19B,SP19A,0
 ;WALKER 33
 SQ49	DEFB 1+#10,1+64,2+#20
 	DEFW SP80,SP80,SP80,SP8E
	DEFW SP8B,SP8B,SP8MEG,SP8,0
 ;WALKER 6
SQ50	DEFB 1+#10,1+64,2+#20
 	DEFW SP8MEG,SP8FFFB,SP8B,SP8MEG,SP8M2,SP8C,SP8AB
	DEFW SP8MEG,0
 ;MISSILE WALKER 2
L7_MASTER3		EQU $+1
L7_MASTER3_val	EQU 48

SQ51	DEFB 14+16,3,5+#20
 	DEFW SP26A,SP26C,SP26D
	DEFW SP26C,SP26E,SP26E,SP26AA
 	DEFW SP26E,SP26C,SP26D
	DEFW SP26C,SP26AAA
	DEFW SP26CC,SP26DD,SP26DD
 	DEFW SP26AA,SP26CC,SP26DD
 	DEFW SP26DD,SP26DD,SP26A,SP26AA,0
 ;GARBAGE OPENER
SQ52	DEFB 9+#50,63,12+#20
	DEFW SP20A,SP20A,SP20B,SP20B,0
;GARBAGE CLOSER
SQ53	DEFB 9+#50,63,12+#20
	DEFW SP20A,SP20A,SP20,0
	
;EXPLOSIVE PATTERNS
;DOWN
SQ54	db 15,63,#20
		repeat 14
		dw SP54
		rend
		dw SP54_explo
		dw 0		
		
;UP
SQ55	db 15,63,#20
		repeat 14
		dw SP55
		rend
		dw SP55_explo
		dw 0		


SP55			
		db 74,2,74,2,71,16+2,71,2
		db 72,2,72,2,73,2,73,2
		
		db 74,2,74,2,71,16+2,71,2
		db 72,2,72,2,73,2,73,128+2
		
SP55_explo
		db 84,64+2,84,2
		db 81,16+2,81,2
		db 82,2,82,128+2
		
SP54	
		
		db 74,0,74,0,71,16,71,0
		db 72,0,72,0,73,0,73,0
		
		db 74,0,74,0,71,16,71,0
		db 72,0,72,0,73,0,73,128
		
SP54_explo
		db 84,64,84,0
		db 81,16,81,0
		db 82,0,82,128
		
.SQ56	;dummy stuff
		db 0,62,0
		dw	sp_dummy
		dw	#FFFF
.sp_dummy
		db 1,128
		


;****************************************
 SQTABLE	DEFW SQ1,SQ2,SQ3,SQ4,SQ5,SQ6,SQ7,SQ8,SQ9,SQ10
	DEFW SQ11,SQ12,SQ13,SQ14,SQ15,SQ16,SQ17,SQ18,SQ19,SQ20
	DEFW SQ21,SQ22,SQ23,SQ24,SQ25,SQ26,SQ27,SQ28,SQ29,SQ30
	DEFW SQ31,SQ32,SQ33,SQ34,SQ35,SQ36,SQ37,SQ38,SQ39,SQ40
	DEFW SQ41,SQ42,SQ43,SQ44,SQ45,SQ46,SQ47,SQ48,SQ49,SQ50
	DEFW SQ51,SQ52,SQ53,SQ54,SQ55,SQ56
;****************************************
 ;	1ST BYTE = SPRITE NUMBER
 ;
;	2ND BYTE =
 ;		BITS 0-1 = ORIENTATION
;		BIT 2 = UP
;		BIT 3 = DOWN
;		BIT 4 = LEFT
;		BIT 5 = RIGHT
 ;		BIT 6 = EVENT
;		BIT 7 = END OF PATTERN
;****************************************	
;RED TWISTERS
SP1	DEFB 8,16,9,24,10,16,9,20,8,20,9,16,10,24,9,16+128
 ;YELLOW BUTTERFLIES 1
SP2	DEFB 11,8,11,8
 SP2Z	DEFB 11,8,11,8+128
SP2A	DEFB 12,24,12,24
SP2AA	DEFB 12,24,12,24+128
 SP2B	DEFB 13,16,13,16,13,16,13,16
SP2BB	DEFB 13,16,13,16,13,16,13,16+128
 SP2C	DEFB 12,41,12,41+128
SP2D	DEFB 13,33,13,33
SP2DD	DEFB 13,33,13,33
 SP2DDD	DEFB 13,33,13,33+128
SP2E	DEFB 12,39,12,39,12,39+128
SP2F	DEFB 11,6,11,6
SP2FF	DEFB 11,6,11,6+128
 SP2G	DEFB 12,39,12,39+128
;STRANGE FLIERS
SP3	DEFB 49,16,49,16,49,16,49,16
 SP3A	DEFB 49,16,49,16,49,16,49,16+128
SP3B	DEFB 49,4,49,4,49,4+128
 SP3C	DEFB 49,8,49,8,49,8+128
 ;BIG UFO
.SP4	DEFB 50,0,50,0,50,0,50,16+128
.SP4A	DEFB 50,0,50,0,50,0
 	DEFB 50,0,50,0,50,0,50,0
	DEFB 50,0,50,0,50,0,50,32
 	DEFB 50,0,50,0,50,0
.SP4AA
 	DEFB 50,0,50,0,50,0,50,0,50,0,50,0,50,0,50,32+128
 ;SCISSOR TWISTER
 SP5	DEFB 38,16,39,16,40,16,39,18
 	DEFB 38,16,39,16,40,16,39,18+128
;SCISSOR TWISTER LASER
 SP6	DEFB 2,16,2,16,2,16,2,16
 	DEFB 2,16,2,16,2,16,2,16+128
;
;STRAIGHT WALKER R / L
 SP8MEG	DEFB 14,16,15,16
	DEFB 14,16,16,16		;WALK L 8
 SP8	DEFB 14,16,15,16
 SP8M2	DEFB 14,16,16,16+128	;WALK L 4
 SP80	DEFB 14,33,15,33
SP802	DEFB 14,33,16,33+128	;WALK R

 SP8A	DEFB 17,8,17,8,17,8,17,8	;FALL 5 L
SP8AA	DEFB 17,8,17,8+128	;FALL 2 L

 SP8AB	DEFB 17,8,17,8,17,8,17,8	;FALL 5 L
		DEFB 17,8+128	;FALL 2 L

 SP8B	DEFB 16,0+128		;STAND STILL L
 SP8C	DEFB 17,20,17,16,17,24+128	;ARC L
 SP8D	DEFB 17,9,17,9
SP8DDD	DEFB 17,9		;FALL 4 R
SP8DD	DEFB 17,9+128		;FALL 1 R
 SP8E	DEFB 16,1+128		;STAND STILL R
 SP8F	DEFB 17,37,17,33,17,41+128	;ARC R
 SP8FF	DEFB 17,37,17,37,17,33,17,33,17,41,17,41+128	;ARC R
 
SP8FFF	DEFB 17,20,17,20,17,20,17,20,17,20,17,20,17,20
		DEFB 17,16,17,24+128													;ARC L
	
SP8FFFB		DEFB 17,20,17,20,17,20,17,20,17,20,17,20,17,16
			DEFB 17,16,17,24+128													;ARC L
	
 ;
SP8H	DEFB 17,20,17,20,17,16,17,16,17,24,17,24+128
;BIG END ALIEN GARBAGE
 SP9	DEFB 37,0,37,16,37,0,37,16,37,0,37,16
SP9B	DEFB 37,0,37,16,37,0,37,16,37,0,37,16+128
 SP9A	DEFB 37,16,37,24,37,24,37,24,37,8,37,8,37,8,37,8+128
SP9C	DEFB 37,16,37,16,37,16+128
;
;BIG END ALIEN ARM
SP10Z	db 42,16,42,16
SP10	DEFB 42,16,42,16,42,16+128
SP10B	DEFB 42,32,42,32,42,32+128
SP10C	DEFB 43,0,44,0,45,0,44,0,43,0+128
;
;PODDERS
 SP11A	DEFB 22,24,22,24							;FLY D/L 6
SP11AA	DEFB 22,24,22,24,22,24,22,24+128	;FLY D/L 4 
SP11B	DEFB 22,16,22,16							;FLY L 4
SP11BB	DEFB 22,16,22,16+128						;FLY L 2
SP11C	DEFB 22,20,22,20							;FLY U/L 6
SP11CC	DEFB 22,20,22,20,22,20,22,20+128	;FLY U/L 4
 SP11D	DEFB 22,8							;DROP 4
SP11DD	DEFB 22,8							;DROP 3
 SP11DDD	DEFB 22,8							;DROP 2
SP11DDDD	DEFB 22,8+128							;DROP 1
 SP11E	DEFB 20,16,18,16,20,16,19,16+128	;WALK L
 SP11F	DEFB 20,33,18,33,20,33,19,33+128	;WALK R
 SP11G	DEFB 21,0,21,0+128						;LAND IMPACT L
 SP11GG	DEFB 21,1,21,1+128						;LAND IMPACT R
SP11H	DEFB 22,37,22,37							;FLY U/R 6
SP11HH	DEFB 22,37,22,37,22,37,22,37+128	;FLY U/R 4
 SP11I	DEFB 22,33,22,33							;FLY R 4
SP11II	DEFB 22,33,22,33+128						;FLY R 2
SP11J	DEFB 22,41,22,41							;FLY D/R 6
SP11JJ	DEFB 22,41,22,41,22,41,22,41+128	;FLY D/R 4
 SP11K	DEFB 22,9,22,9,22,9,22,9+128
 ;
 
;BLUE GOBOT
SP12	DEFB 56,0,56,0,56,0
 SP12A	DEFB 56,0+128
;BLUE GOBOT PROJECTILE
SP13	DEFB 57,16,57,16+2,57,16,57,16+2
		DEFB 57,16,57,16+2,57,18+128
 
 
;NODDING SNALIEN
 SP14	DEFB 30,0,31,0,31,0+128
 SP14A	DEFB 32,0,31,0,31,0+128
SP14B	DEFB 30,0+128
SP14C	DEFB 32,0+128
;GARBAGE 1
 SP15	DEFB 35,8,35,8,35,8,35,8,35,8,35,8,35,8,35,8+128
;GARBAGE 2
 SP16	DEFB 36,8,36,8,36,8,36,8,36,8,36,8,36,8,36,8+128
;GARBAGE 3
 SP17	DEFB 37,8,37,8,37,8,37,8,37,8,37,8,37,8,37,8+128
;PERISCOPE PEEPERS
 SP19	DEFB 51,0,51,4,51,0,51,4,51,0,51,4,51,0,51,4,51,0,51,4+128
SP19A	DEFB 51,0,51,8,51,0,51,8,51,0,51,8,51,0,51,8,51,0,51,8+128
 SP19B	DEFB 51,0,51,0,51,0,51,0+128
 ;GARBAGE OPENERS
SP20	DEFB 52,0+128
SP20A	DEFB 53,0,53,0,53,0,53,0
		DEFB 53,0,53,0,53,0,53,0+128
SP20B	DEFB 54,0,54,0,54,0,54,0
		DEFB 54,0,54,0,54,0,54,0+128
;
;MISSILE WALKERS
.SP26A		DEFB 25,16,26,16
.SP26AAA	DEFB 27,16,26,16					;WALK L 8
.SP26AA		DEFB 25,16,26,16,27,16,26,16+128	;WALK L 4
.SP26B		DEFB 25,33,26,33,27,33,26,33					;WALK R 8
.SP26BB		DEFB 25,33,26,33,27,33,26,33+128	;WALK R 4
.SP26C		DEFB 28,0,28,0+128						;TILT UP L
.SP26CC		DEFB 28,1,28,1+128						;TILT UP R
.SP26D		DEFB 29,0,29,0,29,0,29,0,29,0,29,0+128;WAIT UP L
.SP26DD		DEFB 29,1,29,1,29,1,29,1,29,1,29,1+128;WAIT UP R
.SP26E		DEFB 25,0,25,0,25,0,25,0+128					;WAIT DOWN L
.SP26EE		DEFB 25,1,25,1,25,1,25,1+128					;WAIT DOWN R
 ;MISSILES
SP27A	DEFB 5,4,5,4,5,4,5,4,5,4+128															;UP 6
SP27B	DEFB 5,10,5,10,5,10,5,10,5,10,5,10+128					;DOWN 7
SP27C	DEFB 6,20,7,16,7,16,6,26+128															;TURN L 1
SP27CC	DEFB 6,20,6,20,7,16,7,16,6,26,6,26+128					;TURN L 2
SP27D	DEFB 6,37,7,33,7,33,6,43+128															;TURN R 1
SP27DD	DEFB 6,37,6,37,7,33,7,33,6,43,6,43+128					;TURN R 2
;****************************************
.SPEV1	DEFW FX0,FX1,FX2,FX3,FX4,FX5,FX6,FX7
		DEFW FX8,FX9,FX10,FX11,FX12,FX13,FX14,FX15
 ;
.SPEV2	DEFW FXA0,FXA1,FXA2,FXA3,FXA4,FXA5,FXA6,FXA7
		DEFW FXA8,FXA9,FXA10,FXA11,FXA12,FXA13,FXA14,FXA15
;****************************************
;NO ACTION
.FX0	
	JP C,TV5
.FX0A	
	JP TV1
;
;HALF SPEED
.FX1	
	JP C,TV5
.FX1A	
	LD A,(FRAME)
	AND 1
 	JP NZ,TV1
 	JP TV2
;	
 ;PODDER EXPLOSION BYPASS
.FX2	JR NC,FX1A
 	JP TV5
;
;SCISSOR FLYER LASERS
.FX3	JP C,TV5
 	LD A,(FRAME)
	AND 15
	JR NZ,FX1A
	LD HL,FX3Z+2
	LD A,(IY+4)
 	LD (HL),A
 	DEC HL
	LD A,(IY+3)
 	DEC A
 	DEC A
 	LD (HL),A
 	DEC HL
	CALL FORCESYNC
	ld A,sfx_lasermonsters
	call SND_SfxPlay
	JR FX1A
.FX3Z	DEFB 36,0,9
 ;MAIN GARBAGE LOOP
.FX4	
	JP C,FX4A
	LD A,(IY+4)
 	CP 17
 	JP NZ,TV1
.FX4A	
	LD (IY+0),0
 	LD A,(TILENO)
 	CP 93-lvl_offset
 	JP NC,TV1
 	;CALL RND
	PUSH DE
 	EX DE,HL
	LD HL,FX4Z+2
	;LD A,(DE)
	ld A,R
 	AND 7
 	ADD 249
 	LD (HL),A
 	DEC HL
	LD A,(IY+3)
 	LD (HL),A
 	DEC HL
	;LD A,(DE)
	ld A,R
 	AND 3
 	ADD 42
	CP 45
 	JR NZ,FX4B
	;LD A,(DE)
	ld A,R
 	AND 128+64
	LD A,44
 	JR NZ,FX4B
	INC A
.FX4B	
	LD (HL),A
 	CALL FORCESYNC
	ld A,sfx_garbages
	call SND_SfxPlay
	POP DE
	JP TV5
.FX4Z	DEFB 0,0,0
	
;END ALIEN LOGIC
.FX5	
	JP NC,FX5A
 	LD A,(SCR_SPEC2)
	INC A
 	LD (SCR_SPEC2),A
	CP 4
	JP Z,FX5C
 	;LD HL,(CIRCHOLD2)
 	;LD (HL),0
 	LD (IY+0),62
	INC A
.FX5A	
	JP Z,FX5B
 	LD A,(FRAME)
	AND 1
 	JR NZ,FX5B
	ld A,sfx_touchboss
	call SND_SfxPlay
	
	
	LD A,20
	ld (FX5B_add),A
 	;LD (CADD+1),A
.FX5B	
	EX AF,AF'
 	PUSH AF:PUSH BC:PUSH DE
 	LD A,41
FX5B_add	EQU $+1
	add 0
 	INC C
 	INC C
	inc C
 	CALL TSPGADD
	CALL SPNS
 	POP DE:POP BC:POP AF
	EX AF,AF'
	xor A
	ld (FX5B_add),A
 	JP FX1A
.FX5C	
	XOR A
 	;LD (CADD+1),A
 	EX AF,AF'
 	PUSH BC
 	CALL TSPGADD
	CALL SPNS
 	LD A,41
 	POP BC
	INC C
 	INC C
 	CALL TSPGADD
	CALL SPNS
 	;CALL BIGBANG99
	call BIG_EXPLO_Start
	;LD DE,#0401 ;1*256+4
 	;CALL ATS
	JP TV4
;
;PERISCOPE ALIEN LOGIC
.FX6	
	JR C,FX6B
	LD L,0
	LD A,(SHIPX)
	INC A
 	CP C
	JR C,FX6A
 	INC L
.FX6A	
	LD A,(DE)
 	AND 254
 	OR L
	LD (DE),A
 	JP TV1
.FX6B	
	PUSH BC
 	LD (CIRCHOLD1),BC
 	CALL ADDEXPLO
 	POP BC
	INC B
 	INC B
 	INC B
 	LD (CIRCHOLD1),BC
 	CALL ADDEXPLO	
	JP TV4
	
;***************
;*** BIG UFO ***
;***************
.FX7	
	Jp NC,FX7B
	LD A,(SCR_SPEC2)
	INC A
 	LD (SCR_SPEC2),A
L7_MASTER4		EQU $+1
L7_MASTER4_val	EQU 6*2
	CP 6
	Jr Z,FX7A
 	;LD HL,(CIRCHOLD2)
 	;LD (HL),0
 	LD (IY+0),62
	Jp FX7C
.FX7A	
	;LD A,C
	;ADD 8 ;6
 	;LD C,A
	;LD (CIRCHOLD1),BC
 	;CALL ADDEXPLO0
	;ld A,#40
	;CALL ADDEXPLO2_E2
	;LD BC,(CIRCHOLD1)
 	;DEC C
 	;DEC C
 	;DEC C
	;dec C
 	;LD (CIRCHOLD1),BC
 	;CALL ADDEXPLO0
	;ld A,#40
	;CALL ADDEXPLO2_E2
;	CALL ADDEXPLO2
repeat 8
	push DE
	push BC
	ld A,R
	and 7
	add C
	ld C,A
	ld A,R
	and 3
	add #FF
	add B
	ld B,A
	LD (CIRCHOLD1),BC
	CALL ADDEXPLO0
	
	ld A,R
	and 1
	add 2
	add A
	add A
	add A
	add A
	add #10
	CALL ADDEXPLO2_E2
	pop BC
	pop DE
rend
	;break

	;LD DE,#0404 ;4*256+4
 	;CALL ATS
	ld A,11-1
	call SCORE_Add
	JP TV4
;
.FX7B	
	JR Z,FX7C
 	LD A,(FRAME)
	AND 1
 	JR NZ,FX7C
	
	xor A
	call SND_SfxPlay
	
	LD A,70
	EX AF,AF'
 	JP FX1A
 	;LD (CADD+1),A
.FX7C	
	LD A,50
 	;PUSH AF;PUSH BC;PUSH DE
 	;INC B
 	;INC B
 	;CALL TSPGADD
	;CALL SPNS
 	;POP DE;POP BC;POP AF
	EX AF,AF'
 	JP FX1A
 ;
.FX8
;
;GARBAGE OPENER
.FX9	
	;LD HL,#0206 ;6+2*256
	;CALL CHOP
 	;CALL BUFFOFF
	;LD A,255
	;LD (SPRITE),A
 	;JP TV1
	ex AF,AF'
	push DE
	call TSPGADD
	push BC
	push DE
	push HL
	call REND_EraseZone
	pop HL
	pop DE
	pop BC
	call SPNS_BG
	pop DE
	jp TV5
;*******************
;*** BLUE GOBOT ***
;*******************

FX10	
	JP C,TV5
	
	jr z,FX10_nodamage
	
	xor A
	call SND_SfxPlay
	
.FX10_nodamage
	
	ld A,(FX10R)
	or A
	jr nz,FX10_DoRecoil

	ld A,C
	cp 22
	jr c,FX10_NoForward

	dec C

.FX10_NoForward

	LD A,(IY+8)
 	CP 6
	JR Z,FX10D
	AND 1
 	JP Z,TV1
	LD L,B
	INC L
 	INC L
 	LD A,(SHIPY)
	CP L
	JP Z,TV1
	JR C,FX10A
	INC B
 	JP TV1
FX10A	DEC B
	JP TV1
;
FX10D	LD HL,FX10E+2
	LD A,B
	INC A
 	LD (HL),A

	dec HL
	ld A,C
	ld (HL),A

 	LD HL,FX10E
 	CALL FORCESYNC
 ;LD HL,9*256+HALF+1
 ;CALL BEEP
	ld A,sfx_L1_GreenAlien
	call SND_SfxPlay 
 
	ld A,3
	ld (FX10R),A
.FX10_Recoil
	ld A,55
	ex AF,AF'
 	JP TV1
.FX10_DoRecoil
	ld A,(FX10R)
	dec A
	ld (FX10R),A

	ld A,C
	inc C
	cp 28
	jr c,FX10_Recoil

	ld C,28
	jr FX10_Recoil

FX10E	DEFB 13,24,0
FX10R	db 0

;***********************************
;*** BLUE GOBOT FLAME WEAPON ***
;***********************************
L7_MASTER0		EQU $
L7_MASTER0_val	EQU #0D
.FX11	
	nop
	DEC C
 	JP TV1
 ;
;***********************
;*** NODDING SNALIEN ***
;***********************
read "FX12_nodding_alien.asm"
;
.FX13
 ;
;***********************
;*** MISSILE WALKERS ***
;***********************
read "FX14_missile_walker.asm"


.FX15
	ld A,(DE)
	bit 6,A
	jr z,FX15_NoExplode
	
	ld A,sfx_explodeC
	call SND_SfxPlay
	
.FX15_NoExplode
	push BC
	push DE
	push HL
	
	ld A,(DE)
	bit 1,A
	jr nz,FX15_NoPosCorrection
	inc B
	inc B
.FX15_NoPosCorrection

	ex AF,AF'
	push AF
	
	call TSPGADD
	dec E
	call REND_EraseZone	
	
	pop AF
	ex AF,AF'
	
	pop HL
	pop DE
	pop BC
	jp TV1

;
;****************************************
 ;NO ACTION
.FXA0	
	JP TV3
;HALF SPEED
.FXA1	
	LD A,(FRAME)
	AND 1
 	JP NZ,TV3
 	JP TV4
;
FXA2
 ;
;END ALIEN COLOUR FLASH
FXA3	
	XOR A
 	;LD (CADD+1),A
 	JR FXA1
 ;
FXA4
 ;GARBAGE OPENERS
 FXA5	
	;CALL BUFFON
 	JP TV3
;
;SWITCH OFF COLOUR
 FXA6	
	XOR A
 	;LD (CADD+1),A
 	JP TV3
;
;PODDER TOP PILL
 FXA7	
	LD L,5
	JR FXA15A
 ;
;PODDER BOTTOM PILL
FXA8	LD L,5
	JR FXA15A
 ;
;PODDER BULLETS (1)
;FXA9	LD L,1
 ;	JR FXA15A
;
;PODDER MINI LASER (2)
 ;FXA10	LD L,2
;	JR FXA15A
;
;PODDER LASER (3)
FXA10
FXA11	LD L,1
 	JR FXA15A
 ;
;PODDER BLOB (3)
 FXA9
 FXA12	LD L,3
 	JR FXA15A
 ;
;PODDER CIRCLE (3)
 FXA13	LD L,2
 	JR FXA15A
 ;
;PODDER BONUS
FXA14	LD L,6
 	JR FXA15A
 ;
;PODDER MISSILE + MAIN SUBROUTINE
.FXA15	
	LD L,4
.FXA15A	
	CALL FXA99
	LD A,(JEW1)
 	AND A
 	JR NZ,FXA15B
;
	LD (JEW1X),BC
 	LD A,L
	LD (JEW1),A
 	LD A,(FRAME)
	DEC A
 	AND 7
 	LD (JEW1P),A
	JP TV3
;
FXA15B	
	LD (JEW2X),BC
 	LD A,L
	LD (JEW2),A
 	LD A,(FRAME)
	DEC A
 	AND 7
 	LD (JEW2P),A
	JP TV3
;****************************************
.FXA99	
	LD A,(IY+0)
	AND A
 	JR NZ,FXA99A
	RET
.FXA99A	
	POP HL
	JP FXA1
;****************************************

read "l7_master_data.asm"