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.S	NOTCR
	CMP.B	#$41,d0
	BEQ.S	NOTCR
h_0:	CMP.B	#$45,d0
	BNE	Loadcon

notcr:	MOVE.L	D2,TRDEST
		MOVEM.L	A0-A6/D0-D7,-(A7)
		JSR	TRLOAD
		MOVEM.L	(A7)+,A0-A6/D0-D7
	JMP	NOSAM

SONGNAME:	DC.B	'DF0:SONG',$00
EVEN

;팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎

TRDEST:	DC.L	$50000
TRFILE:	DC.B	$00,$00

TRLOAD:	CLR.L	D0
	MOVE.B	TRFILE,D0
	SUB.B	#$1,D0
	ASL.W	#$2,D0
	ADD.L	#TRLIST,D0
	MOVE.L	D0,A0
	MOVE.L	(A0),D1		;DISKSTART
	MOVE.L	4(A0),D2
	SUB.L	(A0),D2		;LENGTH

	LEA	TRACKSHIT,A1
	MOVE.W	#$2,28(A1)
	MOVE.L	TRDEST,40(A1)	;DEST
	MOVE.L	D1,44(A1)	;DISKPOS
	MOVE.L	D2,36(A1)	;LENGTH
	MOVE.L	$04.W,A6
	JSR	-456(A6)
		MOVE.W	#$9,28(A1)
		MOVE.L	#$0,36(A1)
		MOVE.L	$04.W,A6
		JSR	-456(A6)
	RTS

TRLIST:
DC.L $2C00;'4hornsandtstr',$00
DC.L $5400;'4synthlead2',$00
DC.L $7400;'BARNPROG',$00
DC.L $AA00;'BAS3',$00
DC.L $AE00;'BAS4',$00
DC.L $B400;'Bass15',$00
DC.L $C600;'BASSUTLOK',$00
DC.L $D000;'Dr-zap',$00
DC.L $D400;'Drum1',$00
DC.L $E400;'Dumpfbass',$00
DC.L $F600;'durloop1',$00
DC.L $11A00;'Friday',$00
DC.L $13200;'FunBass',$00
DC.L $14800;'GARDIN',$00
DC.L $17000;'GlueAnalogic',$00
DC.L $1A600;'GlueAnalogicum',$00
DC.L $1B800;'GlueBumpdrum',$00
DC.L $1CE00;'GlueBumpsnare',$00
DC.L $1E000;'GlueDual',$00
DC.L $24600;'GlueFuzzsynth',$00
DC.L $27C00;'GlueMaleChoir',$00
DC.L $2AC00;'GlueMoogBas',$00
DC.L $2DA00;'GluePianoM',$00
DC.L $30400;'GluePizzagogo',$00
DC.L $31800;'GlueResosynth',$00
DC.L $33C00;'GlueSpectral',$00
DC.L $37C00;'GlueSpexullk',$00
DC.L $3CE00;'GlueSteamhorns',$00
DC.L $41600;'GlueSymphony1',$00
DC.L $44800;'GlueSymphony2',$00
DC.L $47C00;'GlueSymphony3',$00
DC.L $4A600;'GlueSynPerc',$00
DC.L $4BE00;'GlueVibes',$00
DC.L $4D800;'GlueVideobas',$00
DC.L $4EE00;'GlueVoices',$00
DC.L $52A00;'GoodOld-days',$00
DC.L $55200;'Gotamlow',$00
DC.L $57A00;'GURKMIX',$00
DC.L $59000;'HI-HATCL',$00
DC.L $59C00;'HURRA',$00
DC.L $61A00;'JAUHETTER',$00
DC.L $65200;'Klarinett',$00
DC.L $67800;'KLICK',$00
DC.L $67C00;'KLICK5',$00
DC.L $68400;'Ktecno',$00
DC.L $6C200;'LORDBASSDRUM',$00
DC.L $6D600;'LORDTJOFF',$00
DC.L $6DC00;'Malethhorns',$00
DC.L $6FA00;'mollloop1',$00
DC.L $71E00;'OperaChorus',$00
DC.L $76000;'OpportSwisch',$00
DC.L $78800;'PinVoice',$00
DC.L $7A400;'smatter',$00
DC.L $7A800;'Snare14',$00
DC.L $7B800;'Snare19',$00
DC.L $7D200;'Snare25',$00
DC.L $7E000;'Snare6',$00
DC.L $7EA00;'SNORBLAJA2',$00
DC.L $7FC00;'snore5',$00
DC.L $80C00;'SNURRE4',$00
DC.L $81800;'SNURRE5',$00
DC.L $82A00;'str7',$00
DC.L $85200;'Symfo1',$00
DC.L $89200;'Symfo4711',$00
DC.L $8C200;'Symfo4714',$00
DC.L $90E00;'Tensionstring',$00
DC.L $93200;'Tommy',$00
DC.L $94A00;'TUTILUREN',$00
DC.L $97000;'Wawymotion',$00
DC.L $99800;THE END!!!

;************************************************

FILESTART:	DC.L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S

DAMAGE:		MOVE.L	#$2FFF,D0
DAMLOOP:	MOVE.W	D0,$DFF180		;RASTER FLICKER
		SUBI.L	#1,D0			;WHEN ERROR
		BNE.S	DAMLOOP
		RTS

GETNEXTLWD:	MOVE.L	-(A0),D0
		EOR.L	D0,D5
		MOVE.W	#$10,CCR
		ROXR.L	#1,D0
		RTS

RDD1BITS:	SUBQ.W	#1,D1
		CLR.W	D2

GETBITS:	LSR.L	#1,D0
		BNE.S	NOTEMPTY
		MOVE.L	-(A0),D0
		EOR.L	D0,D5
		MOVE.W	#$10,CCR
		ROXR.L	#1,D0

NOTEMPTY:	ROXL.L	#1,D2
		DBF	D1,GETBITS
		RTS


;************************************************

DOS:	DC.B	'dos.library',$00

L_INIT:	MOVE.L	$04.W,A6
	MOVE.L	#DOS,A1
	CLR.L	D0
	JSR	-408(A6)
	MOVE.L	D0,L_DOP
	RTS
DEST:		DC.L	$60000
FILENAME:	DC.L	$78000

LOADER:	MOVE.L	FILENAME,D1
	JSR	L_PREP
	MOVE.L	FILENAME,D1
	MOVE.L	DEST,D2
	JSR	L_LOAD
RTS:	RTS

L_LOAD:	MOVE.L	L_DOP,A6
	MOVEM.L	D1-D3,-(A7)
	MOVE.L	#$3ED,D2
	JSR	-30(A6)
	MOVEM.L	(A7)+,D1-D3
	MOVE.L	D0,L_A
	TST.L	D0
	BEQ.S	RTS
	MOVEM.L	D1-D3,-(A7)
	MOVE.L	L_A,D1
	JSR	-42(A6)
	MOVEM.L	(A7)+,D1-D3
	MOVE.L	L_A,D1
	JSR	-36(A6)
	RTS

L_PREP:	MOVE.L	D1,-(A7)
	MOVE.L	L_DOP,A6
	MOVE.L	#$FFFFFFFE,D2
	JSR	-84(A6)
	MOVE.L	D0,L_B
	MOVE.L	L_B,D1
	MOVE.L	#L_CRAP,D2
	JSR	-102(A6)
	MOVE.L	L_B,D1
	JSR	-90(A6)
	MOVE.L	#L_CRAP,A2
	MOVE.L	124(A2),D3
	TST.W	D3
	BNE	L_0
	SWAP	D3
L_0:	MOVE.L	(A7)+,D1
	RTS

L_DOP:	DC.L	$0
L_B:	DC.L	$0
L_A:	DC.L	$0
L_CRAP:	BLK.B	$F0,$0

;*MUSIC******************************************

SONG:	DC.L	$40000

INIT:	MOVE.L	SONG,a0
	add.l	#$01d8,a0	;A0=SONGDATA
	move.l	#$0080,d0
	moveq	#$00,d1
mt_init1:			;GET HIGHEST PATTERN
	move.l	d1,d2
	subq.w	#1,d0
mt_init2:
	move.b	(a0)+,d1
	cmp.b	d2,d1
	bgt.s	mt_init1
	dbf	d0,mt_init2
	addq.b	#1,d2		;D2=HIGHEST USED PATT

mt_init3:
	MOVE.L	SONG,a0
	lea	mt_sample1(pc),a1
	asl.l	#$08,d2			;MULU PATTNR*$400
	asl.l	#$02,d2
	add.l	#$0258,d2		;ADD 600
	add.l	a0,d2			;ADD STARTOFSONG
	moveq	#$0e,d0		;D2=SONGEND

	ADD.L	#CRUNCHMARG,D2	;CRUNCHMARGINAL

mt_init4:
	move.l	d2,(a1)+
	moveq	#$00,d1
	move.w	42(a0),d1	;SAMPLELENGTH SAM1 (WORDS)
	asl.l	#1,d1		;MULU #2
	add.l	d1,d2		;ADD LENGTH TO D2
	ADD.L	#CRUNCHMARG,D2
	add.l	#$1e,a0		;NEXT SAMPLE
	dbf	d0,mt_init4

	lea	mt_sample1(pc),a0	;M-T FIRST LWD IN SAMPLE
	moveq	#$00,d0
mt_clear:
	move.l	(a0,d0),a1
	clr.l	(a1)
	addq.l	#4,d0
	cmp.l	#$3c,d0
	bne.s	mt_clear

	clr.w	$dff0a8
	clr.w	$dff0b8
	clr.w	$dff0c8
	clr.w	$dff0d8
	clr.l	mt_partnrplay
	clr.l	mt_partnote
	clr.l	mt_partpoint

	MOVE.L	SONG,A0
	move.b	$1d6(A0),mt_maxpart+1		;SONGLENGTH
	MOVE.B	#$6,MT_COOL+5			;SPEED = $6
	rts

PLAY:
	addq.l	#1,mt_counter
mt_cool:cmp.l	#6,mt_counter
	bne.s	mt_notsix
	clr.l	mt_counter
	bra	mt_rout2

mt_notsix:
	lea	mt_aud1temp(pc),a6
	tst.b	3(a6)
	beq.s	mt_arp1
	lea	$dff0a0,a5		
	bsr.s	mt_arprout
mt_arp1:lea	mt_aud2temp(pc),a6
	tst.b	3(a6)
	beq.s	mt_arp2
	lea	$dff0b0,a5
	bsr.s	mt_arprout
mt_arp2:lea	mt_aud3temp(pc),a6
	tst.b	3(a6)
	beq.s	mt_arp3
	lea	$dff0c0,a5
	bsr.s	mt_arprout
mt_arp3:lea	mt_aud4temp(pc),a6
	tst.b	3(a6)
	beq.s	mt_arp4
	lea	$dff0d0,a5
	bra.s	mt_arprout
mt_arp4:rts

mt_arprout:
	move.b	2(a6),d0
	and.b	#$0f,d0
	tst.b	d0
	beq.s	mt_arpegrt
	cmp.b	#1,d0
	beq.s	mt_portup
	cmp.b	#2,d0
	beq.s	mt_portdwn
	rts

mt_portup:
	moveq	#$00,d0
	move.b	3(a6),d0
	sub.w	d0,22(a6)
	cmp.w	#$71,22(a6)
	bpl.s	mt_ok1
	move.w	#$71,22(a6)
mt_ok1:	move.w	22(a6),6(a5)
	rts

mt_portdwn:
	moveq	#$00,d0
	move.b	3(a6),d0
	add.w	d0,22(a6)
	cmp.w	#$358,22(a6)
	bmi.s	mt_ok2
	move.w	#$358,22(a6)
mt_ok2:	move.w	22(a6),6(a5)
	rts

mt_arpegrt:
	cmp.l	#1,mt_counter
	beq.s	mt_loop2
	cmp.l	#2,mt_counter
	beq.s	mt_loop3
	cmp.l	#3,mt_counter
	beq.s	mt_loop4
	cmp.l	#4,mt_counter
	beq.s	mt_loop2
	cmp.l	#5,mt_counter
	beq.s	mt_loop3
	rts

mt_loop2:
	moveq	#$00,d0
	move.b	3(a6),d0
	lsr.b	#4,d0
	bra.s	mt_cont
mt_loop3:
	moveq	#$00,d0
	move.b	3(a6),d0
	and.b	#$0f,d0
	bra.s	mt_cont
mt_loop4:
	move.w	16(a6),d2
	bra.s	mt_endpart
mt_cont:
	asl.w	#1,d0
	moveq	#$00,d1
	move.w	16(a6),d1
	lea	mt_arpeggio(pc),a0
mt_loop5:
	move.w	(a0,d0),d2
	cmp.w	(a0),d1
	beq.s	mt_endpart
	addq.l	#2,a0
	bra.s	mt_loop5
mt_endpart:
	move.w	d2,6(a5)
	rts

mt_rout2:
	MOVE.L	SONG,a0
	move.l	a0,a3
	add.l	#$0c,a3
	move.l	a0,a2
	add.l	#$1d8,a2
	add.l	#$258,a0
	move.l	mt_partnrplay,d0
	moveq	#$00,d1
	move.b	(a2,d0),d1
	asl.l	#$08,d1
	asl.l	#$02,d1
	add.l	mt_partnote,d1
	move.l	d1,mt_partpoint
	clr.w	mt_dmacon

	lea	$dff0a0,a5
	lea	mt_aud1temp(pc),a6
	bsr	mt_playit
	lea	$dff0b0,a5
	lea	mt_aud2temp(pc),a6
	bsr	mt_playit
	lea	$dff0c0,a5
	lea	mt_aud3temp(pc),a6
	bsr	mt_playit
	lea	$dff0d0,a5
	lea	mt_aud4temp(pc),a6
	bsr	mt_playit
	move.w	#$01f4,d0
mt_rls:	dbf	d0,mt_rls

	move.w	#$8000,d0
	or.w	mt_dmacon,d0
	move.w	d0,$dff096

	lea	mt_aud4temp(pc),a6
	cmp.w	#1,14(a6)
	bne.s	mt_voice3
	move.l	10(a6),$dff0d0
	move.w	#1,$dff0d4
mt_voice3:
	lea	mt_aud3temp(pc),a6
	cmp.w	#1,14(a6)
	bne.s	mt_voice2
	move.l	10(a6),$dff0c0
	move.w	#1,$dff0c4
mt_voice2:
	lea	mt_aud2temp(pc),a6
	cmp.w	#1,14(a6)
	bne.s	mt_voice1
	move.l	10(a6),$dff0b0
	move.w	#1,$dff0b4
mt_voice1:
	lea	mt_aud1temp(pc),a6
	cmp.w	#1,14(a6)
	bne.s	mt_voice0
	move.l	10(a6),$dff0a0
	move.w	#1,$dff0a4
mt_voice0:
	move.l	mt_partnote,d0
	add.l	#$10,d0
	move.l	d0,mt_partnote
	cmp.l	#$400,d0
	bne.s	mt_stop
mt_higher:
	clr.l	mt_partnote
	addq.l	#1,mt_partnrplay
	moveq	#$00,d0
	move.w	mt_maxpart,d0
	move.l	mt_partnrplay,d1
	cmp.l	d0,d1
	bne.s	mt_stop
	clr.l	mt_partnrplay

mt_stop:tst.w	mt_status
	beq.s	mt_stop2
	clr.w	mt_status
	bra.s	mt_higher
mt_stop2:
	rts

mt_playit:
	move.l	(a0,d1),(a6)
	addq.l	#4,d1
	moveq	#$00,d2
	move.b	2(a6),d2
	and.b	#$f0,d2
	lsr.b	#4,d2
	tst.b	d2
	beq.s	mt_nosamplechange

	moveq	#$00,d3
	lea	mt_samples(pc),a1
	move.l	d2,d4
	asl.l	#2,d2
	mulu	#$1e,d4
	move.l	(a1,d2),4(a6)
	move.w	(a3,d4),8(a6)
	move.w	2(a3,d4),18(a6)
	move.w	4(a3,d4),d3
	tst.w	d3
	beq.s	mt_displace
	move.l	4(a6),d2
	add.l	d3,d2
	move.l	d2,4(a6)
	move.l	d2,10(a6)
	move.w	6(a3,d4),8(a6)
	move.w	6(a3,d4),14(a6)
	move.w	18(a6),8(a5)
	bra.s	mt_nosamplechange

mt_displace:
	move.l	4(a6),d2
	add.l	d3,d2
	move.l	d2,10(a6)
	move.w	6(a3,d4),14(a6)
	move.w	18(a6),8(a5)
mt_nosamplechange:
	tst.w	(a6)
	beq.s	mt_retrout
	move.w	(a6),16(a6)
	move.w	20(a6),$dff096
	move.l	4(a6),(a5)
	move.w	8(a6),4(a5)
	move.w	(a6),6(a5)
	move.w	20(a6),d0
	or.w	d0,mt_dmacon

mt_retrout:
	tst.w	(a6)
	beq.s	mt_nonewper
	move.w	(a6),22(a6)

mt_nonewper:
	move.b	2(a6),d0
	and.b	#$0f,d0
	cmp.b	#11,d0
	beq.s	mt_posjmp
	cmp.b	#12,d0
	beq.s	mt_setvol
	cmp.b	#13,d0
	beq.s	mt_break
	cmp.b	#14,d0
	beq.s	mt_setfil
	cmp.b	#15,d0
	beq.s	mt_setspeed
	rts

mt_posjmp:
	not.w	mt_status
	moveq	#$00,d0
	move.b	3(a6),d0
	subq.b	#$01,d0
	move.l	d0,mt_partnrplay
	rts

mt_setvol:
	move.b	3(a6),8(a5)
	rts

mt_break:
	not.w	mt_status
	rts

mt_setfil:
	moveq	#$00,d0
	move.b	3(a6),d0
	and.b	#$01,d0
	rol.b	#$01,d0
	and.b	#$fd,$bfe001
	or.b	d0,$bfe001
	rts

mt_setspeed:
	move.b	3(a6),d0
	and.b	#$0f,d0
	beq.s	mt_back
	clr.l	mt_counter
	move.b	d0,mt_cool+5
mt_back:rts

mt_aud1temp:
	blk.w	10,0
	dc.w	$0001
	blk.w	2,0
mt_aud2temp:
	blk.w	10,0
	dc.w	$0002
	blk.w	2,0
mt_aud3temp:
	blk.w	10,0
	dc.w	$0004
	blk.w	2,0
mt_aud4temp:
	blk.w	10,0
	dc.w	$0008
	blk.w	2,0
mt_partnote:	dc.l	0
mt_partnrplay:	dc.l	0
mt_counter:	dc.l	0
mt_partpoint:	dc.l	0
mt_samples:dc.l	0
mt_sample1:blk.l 15,0
mt_maxpart:dc.w	$0000
mt_dmacon:dc.w	$0000
mt_status:dc.w	$0000

mt_arpeggio:
dc.w $0358,$0328,$02fa,$02d0,$02a6,$0280,$025c
dc.w $023a,$021a,$01fc,$01e0,$01c5,$01ac,$0194,$017d
dc.w $0168,$0153,$0140,$012e,$011d,$010d,$00fe,$00f0
dc.w $00e2,$00d6,$00ca,$00be,$00b4,$00aa,$00a0,$0097
dc.w $008f,$0087,$007f,$0078,$0071,$0000,$0000,$0000

;팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎팎

;TRACKDISK-COMMANDS -> 28(A1)

;$1 RESET (AUTOMATICAL DONE)
;$2 LOAD 40-MEMDEST 36-LENGTH 44-DISKPOS  JSR -456(A6)  D0=ERRCODE
;$3 SAVE SAME ^						D0=ERRCODE
;$5 DISK IN DRIVE? D1;0=YES
;$9 LAMP 36-ON/OFF  1=ON  0=OFF
;$A MOVE HEAD (SE LOAD)
;$B  FORMAT
;$C  REMOVE (DISK CHANGE?)
;$D  NUMBER OF DISK CHANGES
;$E  DISK IN DRIVE?
;$F WRITE-PROTECT? D1;0=YES

TRACKINIT:
	MOVE.L	$04.W,A6
	SUBA.L	A1,A1
	JSR	-294(A6)	;FINDTASK
	MOVE.L	D0,TRACKTAL2
	LEA	TRACKTAL,A1
	MOVE.L	$04.W,A6
	JSR	-354(A6)	;ADDPORT

	CLR.L	D0
	CLR.L	D1
	LEA	TRACKDISK,A0
	LEA	TRACKSHIT,A1
	JSR	-444(A6)	;OPENDEVICE

	LEA	TRACKSHIT,A1
	MOVE.L	#TRACKTAL,14(A1)
	RTS

TRACKEND:
	LEA	TRACKTAL,A1
	MOVE.L	$04.W,A6
	JSR	-360(A6)
	LEA	TRACKSHIT,A1
	MOVE.L	$04.W,A6
	JSR	-450(A6)
	RTS

TRACKDISK:	DC.B  'trackdisk.device',$00,$00
TRACKSHIT:	BLK.B $50,0
TRACKTAL:	DC.L  0,0,0,0
TRACKTAL2:	DC.L  0,TRACKTAL2+$C,0,TRACKTAL2+$4

