//-----------------------------------------------------------------------------
// 02. DUO TUNNEL
//-----------------------------------------------------------------------------

	;init_fx
	DB	T_FX_INI

	; start music after first effect init
	DB	2		;COMM_ASM
	CALL	MUSIC_ON
	;---
	DI
	LD	BC,3536-104	; call im2 subroutine with play music while counter <= this value
WAITMUSLP	
	CALL	IM2EXEC
	LD	HL,(MUSPOS)
	AND	A
	SBC	HL,BC
	JP	NZ,WAITMUSLP
	;---
	LD	IY,$+5
	RET
	
	DB	T_FX_NOP
	DW	3536-1		; pause while fx-local frame counter <= this value
	
	
	;run_fx
	DB	T_FX_RUN
	DW	4342		; fx run while fx-local frame counter <= this value
	
	DB	2		;COMM_ASM

	
FADE1	EI
	HALT
	LD	A,#17
	CALL	PAGER
FADE2	LD	A,7	
	OUT	(#FE),A
	LD	C,A
	ADD	A,A
	ADD	A,A
	ADD	A,A
	OR	C
	LD	HL,#5800
	LD	DE,#5801
	LD	BC,767
	LD	(HL),A
	LDIR
	EI
	HALT
	LD	A,(FADE2+1)
	SUB	1
	LD	(FADE2+1),A
	JP	NC,FADE1

	LD	IY,$+5
	RET
	
	DB	T_FX_NOP
	DW	#FFFF