; include file


equalizer


	if	x,#1=sid_playmusic_gate4
	lda	#8
	sta	eq_s1

	endif



;	if	x,#1=sid_playmusic_gate5
;	lda	#8
;	sta	eq_s2
;	endif

;	if	x,#1=sid_playmusic_gate5
;	lda	#8
;	sta	eq_s2
;	endif


	if	x,#1=sid_playmusic_gate1
	lda	#8
	sta	eq_s3
	endif
	if	x,#1=sid_playmusic_gate2
	lda	#8
	sta	eq_s4
	lda	#8
	sta	eq_s2
	endif
	if	x,#1=sid_playmusic_gate3
	lda	#8
	sta	eq_s5
	endif

	line(#0,#6,#8,#6,eq_s1,#0)	;8-12
	line(#0,#6,eq_s1,#6,#12,#7)	;8-12
	line(#0,#8,#8,#8,eq_s2,#0)	;8-12
	line(#0,#8,eq_s2,#8,#12,#3)	;8-12
	line(#0,#10,#8,#10,eq_s3,#0)	;8-12
	line(#0,#10,eq_s3,#10,#12,#5)	;8-12 gat 1
	line(#0,#12,#8,#12,eq_s4,#0)	;8-12
	line(#0,#12,eq_s4,#12,#12,#3)	;8-12
	line(#0,#14,#8,#14,eq_s5,#0)	;8-12
	line(#0,#14,eq_s5,#14,#12,#7)	;8-12



	inc	eq_c1
	if	b,eq_c1>#2
	clr	eq_c1
	if	b,eq_s1<#12
	inc	eq_s1
	endif
	if	b,eq_s2<#12
	inc	eq_s2
	endif
	if	b,eq_s3<#12
	inc	eq_s3
	endif
	if	b,eq_s4<#12
	inc	eq_s4
	endif
	if	b,eq_s5<#12
	inc	eq_s5
	endif
	endif




	rts

; include file

check_dir0



;menu down on directory
	if	b,myset=#91
	clr	myset
	print(#0,#0,menu_dir1,#textmt)
	if	w,menu_dir1<#449
	ldd	menu_dir1
	addd	#32
	std	menu_dir1
	inc	drop1
	endif
	endif


;menu up on directory
	if	b,myset=#95
	clr	myset
	print(#0,#0,menu_dir1,#textmt)
	if	w,menu_dir1>#225
	ldd	menu_dir1
	subd	#32
	std	menu_dir1
	dec	drop1
	endif
	endif

;goto menu 1
	if	b,myset=#13
	clr	myset
	print(#0,#0,menu_dir1,#textmt)
	lda	#1
	sta	menu_dir0
	ldd	#146
	std	menu_dir1
	endif


	rts



;******************************************************************************************************************
check_dir1


;menu down on directory
	if	b,myset=#91
	clr	myset
	print(#0,#0,menu_dir1,#textmt)
	if	w,menu_dir1<#466
	ldd	menu_dir1
	addd	#32
	std	menu_dir1
	endif
	endif


;menu up on directory
	if	b,myset=#95
	clr	myset
	print(#0,#0,menu_dir1,#textmt)
	if	w,menu_dir1>#146
	ldd	menu_dir1
	subd	#32
	std	menu_dir1
	endif
	endif

; enter 13 on directory down
	if	b,myset=#13	w,menu_dir1=#434
	clr	myset
	lda	directory_sector
	adda	#1
	sta	directory_sector
	if	b,directory_sector>#13
	lda	#13
	sta	directory_sector
	endif
	jsr	updatedir
	endif
; enter 13 on directory up
	if	b,myset=#13	w,menu_dir1=#402
	clr	myset
	lda	directory_sector
	suba	#1
	sta	directory_sector
	if	b,directory_sector<#3
	lda	#3
	sta	directory_sector
	endif
	jsr	updatedir
	endif


; enter 13 cancel
	if	b,myset=#13	w,menu_dir1=#466
	clr	myset
	lda	#0
	sta	menu_dir0
	print(#0,#0,menu_dir1,#textmt)
	lda	#1
	sta	drop1
	ldd	#225
	std	menu_dir1
	jsr	updatedir
	endif




; enter file 8 slot
	if	w,menu_dir1=#370	b,myset=#13
	clr	myset
; lets validate mdm file
	ldu	diskbuffer
	ldd	#224
	leau	d,u
	jsr	update_thelist
	endif


; enter file 7 slot
	if	w,menu_dir1=#338	b,myset=#13
	clr	myset
; lets validate mdm file
	ldu	diskbuffer
	ldd	#192
	leau	d,u
	jsr	update_thelist
	endif

; enter file 6 slot
	if	w,menu_dir1=#306	b,myset=#13
	clr	myset
; lets validate mdm file
	ldu	diskbuffer
	ldd	#160
	leau	d,u
	jsr	update_thelist
	endif

; enter file 5 slot
	if	w,menu_dir1=#274	b,myset=#13
	clr	myset
; lets validate mdm file
	ldu	diskbuffer
	ldd	#128
	leau	d,u
	jsr	update_thelist
	endif

; enter file 4 slot
	if	w,menu_dir1=#242	b,myset=#13
	clr	myset
; lets validate mdm file
	ldu	diskbuffer
	ldd	#96
	leau	d,u
	jsr	update_thelist
	endif

; enter file 3 slot
	if	w,menu_dir1=#210	b,myset=#13
	clr	myset
; lets validate mdm file
	ldu	diskbuffer
	ldd	#64
	leau	d,u
	jsr	update_thelist
	endif

; enter file 2 slot
	if	w,menu_dir1=#178	b,myset=#13
	clr	myset
; lets validate mdm file
	ldu	diskbuffer
	ldd	#32
	leau	d,u
	jsr	update_thelist
	endif

; enter file 1 slot
	if	w,menu_dir1=#146	b,myset=#13
	clr	myset
; lets validate mdm file
	ldu	diskbuffer
	jsr	update_thelist
	endif




	rts


;*****************************************************************
update_thelist
	lda	0,u
	lbeq	exitfilecheck
	cmpa	#46
	lbeq	exitfilecheck
	cmpa	#255
	lbeq	exitfilecheck

	lda	8,u
	cmpa	#77
	lbne	exitfilecheck	
	lda	9,u
	cmpa	#68
	lbne	exitfilecheck
	lda	10,u
	cmpa	#77
	lbne	exitfilecheck

;move cursor to menu 0
	lda	#0
	sta	menu_dir0
	print(#0,#0,menu_dir1,#textmt)
	clr	myset
;valid
	if	b,drop1=#1
	ldx	#playmusic1
	ldd	#225
	std	menu_dir1
	endif
	if	b,drop1=#2
	ldx	#playmusic2
	ldd	#257
	std	menu_dir1
	endif
	if	b,drop1=#3
	ldx	#playmusic3
	ldd	#289
	std	menu_dir1
	endif
	if	b,drop1=#4
	ldx	#playmusic4
	ldd	#321
	std	menu_dir1
	endif
	if	b,drop1=#5
	ldx	#playmusic5
	ldd	#353
	std	menu_dir1
	endif
	if	b,drop1=#6
	ldx	#playmusic6
	ldd	#385
	std	menu_dir1
	endif
	if	b,drop1=#7
	ldx	#playmusic7
	ldd	#417
	std	menu_dir1
	endif
	if	b,drop1=#8
	ldx	#playmusic8
	ldd	#449
	std	menu_dir1
	endif
	jsr	copy8
	jsr	update_playlist



exitfilecheck
	rts






update_playlist


	print(#0,#0,#226,#playmusic1)
	print(#0,#0,#258,#playmusic2)
	print(#0,#0,#290,#playmusic3)
	print(#0,#0,#322,#playmusic4)
	print(#0,#0,#354,#playmusic5)
	print(#0,#0,#386,#playmusic6)
	print(#0,#0,#418,#playmusic7)
	print(#0,#0,#450,#playmusic8)

	rts



blankout_playlist
	ldu	#fileblank
	ldx	#playmusic1
	jsr	copy8
	ldx	#playmusic2
	jsr	copy8
	ldx	#playmusic3
	jsr	copy8
	ldx	#playmusic4
	jsr	copy8
	ldx	#playmusic5
	jsr	copy8
	ldx	#playmusic6
	jsr	copy8
	ldx	#playmusic7
	jsr	copy8
	ldx	#playmusic8
	jsr	copy8


	rts

def	eq_c1	byte
def	eq_s1	byte
def	eq_s2	byte
def	eq_s3	byte
def	eq_s4	byte
def	eq_s5	byte



