
>EXTERN "PICR",PICR
>EXTERN "PLR",PLR
>EXTERN "MDR",MDR
>EXTERN "NYSAM",NYSAM
>EXTERN "ANALYZ",L611
>EXTERN "ASURE",L615
>EXTERN "L610",L610
>EXTERN "PATTDATA",PATTDATA
>EXTERN "CLRR",CLRR
>EXTERN "SER",SER
>EXTERN "PATTCHARS",PATTCHARS
>EXTERN "TOMRUT",TOMRUT
>EXTERN "PLST",PLST

CrunchShitLen=$4a40

	bra.L	L1

	dc.b ' Musicdisktracker by Mahoney 10 May 1991'
	EVEN

PLST:	BLK.B	3810,0
L720:	DC.L	3810
L721:	DC.L	PLST
L722:	DC.W	3810/$1E
PRINTFREE:	DC.W	1

L1:	CMP.B	#$20,(A0)+
	BEQ.S	L1
	SUBQ.L	#1,A0
	CMP.B	#'-',(A0)+
	BNE.S	LL1
	CMP.B	#'H',(A0)
	BEQ.S	.GOHARD
	CMP.B	#'h',(A0)
	BNE.S	LL1
.GOHARD:MOVE.B	#1,HARD

LL1:	clr.l	L725
	move.l	4.w,a6
	sub.l	a1,a1
	jsr	-$126(a6)
	move.l	d0,a4
	tst.l	$ac(a4)
	beq.s	.L2
	bra	.L3
.L2:	lea	$5c(a4),a0
	move.l	4.w,a6
	jsr	-$180(a6)
	lea	$5c(a4),a0
	jsr	-$174(a6)
	move.l	d0,L725
.L3:	bsr	L5
	move.l	d0,-(a7)
	tst.l	L725
	beq.s	.L4
	move.l	4.w,a6
	jsr	-$84(a6)
	move.l	L725,a1
	jsr	-$17a(a6)
.L4:	move.l	(a7)+,d0
	rts

M_SAVEBLOCK:
	DC.B	'NT2.0 ModuleINFO'
	;0123012301230123
LJUDPERIODS:
	BLK.W	$20,$18
	M_LS:	BLK.B	$20,4
	M_TS:	BLK.B	$20,48
M_SAVEBLOCKEND:
	DC.W	0

PATTPRINTONCE:
	moveq	#$3F,d6
	MOVEQ	#0,D7
	move.l	#2,L636
	move.l	#$1d61,A5
	LEA	MYPRT(PC),A3

.PPRO:	move.l	D7,d1
	divu	#$a,d1
	add.w	#$30,d1
	move.b	d1,(a3)
	swap	d1
	add.w	#$30,d1
	move.b	d1,1(a3)
	move.l	A3,L635
	MOVE.L	A5,L629
	Jsr	L562
	addq.l	#1,D7
	LEA	$118(A5),A5
	DBF	D6,.PPRO
	rts

MYPRT:	DC.W 0

DELPATT:MOVEQ	#0,D0
	BSR.S	D160
	MOVEQ	#4,D0
	BSR.S	D160
	MOVEQ	#8,D0
	BSR.S	D160
	MOVEQ	#$C,D0
	BSR.S	D160
	JMP	L543

DELVOICE:
	MOVEQ	#-1,D0
	cmp.w	#$12,L653
	bne.s	.D156
	moveq	#$c,d0
.D156:	cmp.w	#$c,L653
	bne.s	.D157
	moveq	#8,d0
.D157:	cmp.w	#6,L653
	bne.s	.D158
	moveq	#4,d0
.D158:	tst.w	L653
	bne.S	.D159
	moveq	#0,d0
.D159:	TST.L	D0
	BMI	P_RTS
	BSR.s	D160
	JMP	L543

D160:	CLR.W	L647
	move.l	d0,a0
	add.l	L697,a0
	add.l	#$43c,a0
	move.l	L637,d0
	lsl.l	#$8,d0
	lsl.l	#$2,d0
	add.l	d0,a0
	MOVEQ	#$3F,D7
	MOVE.W	L658,D6
	MOVE.W	D6,D5
	AND.W	#$10,D6
	AND.W	#$F,D5
	ASL.W	#4,D5
	MOVEQ	#0,D4

DLOP:	MOVE.B	2(A0),D0
	AND.B	#$F0,D0
	CMP.B	D0,D5
	BNE.S	.DCZ
	MOVE.B	(A0),D0
	AND.B	#$10,D0
	CMP.B	D6,D0
	BEQ.S	.DDOZ

.DCZ:	MOVE.B	2(A0),D0
	AND.B	#$F0,D0
	BNE.S	.DNEXTNZ
	MOVE.B	(A0),D0
	AND.B	#$10,D0
	BNE.S	.DNEXTNZ
	TST.L	D4
	BEQ.S	.DNEXT

.DDOZ:	CLR.W	(A0)
	CLR.W	2(A0)
	MOVEQ	#1,D4

.DNEXT:	ADD.L	#$10,A0
	DBF	D7,DLOP
	RTS

.DNEXTNZ:MOVEQ	#0,D4
	BRA.S	.DNEXT

;ÆÆÆÆÆ

L5:	move.l	a7,L704
	MOVE.B	$BFE001,D0
	AND.B	#$02,D0
	MOVE.B	D0,FILTEROLD
	bset	#$01,$bfe001
	jsr	Init_datas
	move.w	$dff01c,oldena
	move.l	$70.w,oldirq
	bsr	L10
	Jsr	L519
	bsr	L11
	BSR	GREY
	move.l	L514,$dff080
	BSR	PRINTQUANT

	tst.l	L685
	beq.s	.L6
	move.l	$04.w,a6
	move.l	#$1b58,d0
	move.l	L685,a1
	jsr	-$00d2(a6)
.L6:	Jsr	L506
	bsr	L134
	bsr	L37
	BSR	SEARCHRUT
L7:	TST.B	NOKEYB
	BNE.S	L7
;EVERTIMER:
	TST.B	TIMGO
	BEQ.S	TIMNOP
	CLR.B	TIMGO
	MOVE.L	#TIM5,L635
	MOVE.L	#[131*40]+22,L629
	MOVE.L	#$5,L636
	JSR	L562
TIMNOP:
	BSR	ESCAPERUT
	BSR	PRINTFREEMEM
	BSR	EVERPRINTSOUND
	CMP.W	#1,MOVEDISKLIST
	BNE.S	.L7_2
	BSR	L72
.L7_2:	CMP.W	#2,MOVEDISKLIST
	BNE.S	.L7_3
	BSR	L74
.L7_3:	MOVE.W	MOVEPLSTCON,D0
	BEQ.S	L7_4
	MOVE.W	#1,L660
	CMP.W	#1,D0
	BNE.S	.L7_31
	MOVE.W	#-1,L660
.L7_31:	BSR	MOVEPLST
	CLR.W	MOVEPLSTCON

L7_4:;	MOVE.W	L665,L655
;	MOVE.L	#[$67*40]+30,L629
;	JSR	L561
;	MOVE.W	L666,L655
;	MOVE.L	#[$67*40]+35,L629
;	JSR	L561

	CMP.B	#$53,L647
	BNE.S	.NOSUBB
	TST.W	L511
	BNE.S	.NOSUBB
	TST.W	L512
	BNE.S	.NOSUBB
	SUBQ.B	#1,WAVENO
	BPL.S	.NOK45
	CLR.B	WAVENO
.NOK45:	BSR	SHOWSOUND
	JSR	L504
.NOSUBB:
	CMP.B	#$54,L647
	BNE.S	.NOADDD
	TST.W	L511
	BNE.S	.NOADDD
	TST.W	L512
	BNE.S	.NOADDD
	ADDQ.B	#1,WAVENO
	CMP.B	#28,WAVENO
	BNE.S	.NOK46
	MOVE.B	#27,WAVENO
.NOK46:	BSR	SHOWSOUND
	JSR	L504
.NOADDD:
	CMP.B	#$52,L647
	BNE.S	.NOCALCC
	TST.W	L511
	BNE.S	.NOCALCC
	TST.W	L512
	BNE.S	.NOCALCC
	CLR.B	L647
	BSR	INTERPOLCALCULATOR
	BSR	SHOWSOUND
.NOCALCC:
	BSR	SPACEAMIGAALTSHIFTRUT
	BSR	CHANGEINST
	BSR	PATSORUT
	bsr	L205
	bsr	L174
	bsr	L154
	bsr	L147
	bsr	L141
	cmp.l	#'patp',L632
	bne.s	L8
	JSR	L548
	tST.w	L678
	beq.s	L8

	MOVE.L	L642,D0
	CMP.W	#1,D0
	BLE.S	PRITNOW
	MOVE.L	L695,D1
	ADDQ.W	#1,D1
	CMP.W	D0,D1
	BLT.S	L8
PRITNOW:move.l	L682,L637
	Jsr	L543
L8:	btST	#6,$bfe001
	bne	L7
	TST.W	NTREMOVED
	BNE.S	L9
	MOVE.W	L713,D0
	BEQ.S	DOIIT
	CMP.W	#1,D0
	BNE.S	L9
DOIIT:	bsr	L16
	BSR	L111
	MOVE.W	#1,NTREMOVED
L9:	bra	L247

ESCAPERUT:
	MOVE.B	L647,D0
	CMP.B	#$45,D0
	BNE.S	TESTOTHER
	CLR.W	L647
	MOVE.W	L713,D0
	CMP.W	#3,D0
	BEQ	EXITDISKOP
	CMP.W	#4,D0
	BEQ	EXITPLST
	CMP.W	#6,D0
	BEQ	EXITSAMPLER
	RTS

TESTOTHER:
	CMP.B	#$70,D0
	BNE.S	.TE_2
	CLR.W	L647
	CMP.W	#1,L713
	BEQ	L57
	TST.W	L713
	BEQ	L57
	CMP.W	#$3,L713
	BEQ	EXITDISKOP
	RTS
.TE_2:	CMP.B	#$46,D0
	BNE	P_RTS
	CMP.L	#'edit',L631
	BEQ	P_RTS
	CLR.W	L647
	tst.w	L511
	bne	DELVOICE
	tst.w	L512
	BNE	DELPATT
	MOVE.W	L713,D0
	BEQ.S	GOSAMOK
	CMP.W	#6,D0
	BEQ.S	GOSAMOK
	CMP.W	#1,D0
	BNE	P_RTS
GOSAMOK:
	CMP.W	#6,L713
	BNE	DISPLAYSAMPLER
	BRA	EXITSAMPLER

GREY:	MOVE.L	#L529_2,SPRCOLPOI
	MOVE.L	#L536_2,ANACOLPOI
	LEA	COL1,A0
	MOVE.W	#$444,2(A0)
	MOVE.W	#$777,6(A0)
	MOVE.W	#$AAA,10(A0)
	MOVE.W	#$CCC,14(A0)
	MOVE.W	#$700,18(A0)
	MOVE.W	#$400,22(A0)
	MOVE.W	#$A00,26(A0)
	MOVE.W	#$04D,COL8-COL1+2(A0)
	BRA	COLON

RED:	MOVE.L	#L529,SPRCOLPOI
	MOVE.L	#L536,ANACOLPOI
	LEA	COL1,A0
	MOVE.W	#$733,2(A0)
	MOVE.W	#$A66,6(A0)
	MOVE.W	#$C99,10(A0)
	MOVE.W	#$AFB,14(A0)
	MOVE.W	#$900,18(A0)
	MOVE.W	#$600,22(A0)
	MOVE.W	#$E00,26(A0)
	MOVE.W	#$990,COL8-COL1+2(A0)
	BRA.S	COLON

GREEN:	MOVE.L	#L529_2,SPRCOLPOI
	MOVE.L	#L536_2,ANACOLPOI
	LEA	COL1,A0
	MOVE.W	#$262,2(A0)
	MOVE.W	#$595,6(A0)
	MOVE.W	#$9C9,10(A0)
	MOVE.W	#$FAB,14(A0)
	MOVE.W	#$CFC,18(A0)
	MOVE.W	#$9C9,22(A0)
	MOVE.W	#$EFE,26(A0)
	MOVE.W	#$E55,COL8-COL1+2(A0)
COLON:	CLR.W	L647
	JSR	DOSPRCOLS
	JMP	L530

BLUE:	BTST	#2,$DFF016
	BNE.S	NOBL2
	TST.W	L511
	BNE	LILA
NOBL2:	MOVE.L	#L529,SPRCOLPOI
	MOVE.L	#L536,ANACOLPOI
	LEA	COL1,A0
	MOVE.W	#$337,2(A0)
	MOVE.W	#$66A,6(A0)
	MOVE.W	#$99C,10(A0)
	MOVE.W	#$CCC,14(A0)
	MOVE.W	#$229,18(A0)
	MOVE.W	#$116,22(A0)
	MOVE.W	#$33E,26(A0)
	MOVE.W	#$888,COL8-COL1+2(A0)
	BRA.S	COLON

ORANGE:	BTST	#2,$DFF016
	BNE.S	NOBL
	TST.W	L511
	BNE	SVART
NOBL:	MOVE.L	#L529,SPRCOLPOI
	MOVE.L	#L536,ANACOLPOI
	LEA	COL1,A0
	MOVE.W	#$853,2(A0)
	MOVE.W	#$B86,6(A0)
	MOVE.W	#$DB9,10(A0)
	MOVE.W	#$9EB,14(A0)
	MOVE.W	#$ECA,18(A0)
	MOVE.W	#$DB9,22(A0)
	MOVE.W	#$FDB,26(A0)
	MOVE.W	#$9A2,COL8-COL1+2(A0)
	BRA	COLON

LILA:	MOVE.L	#L529_2,SPRCOLPOI
	MOVE.L	#L536_2,ANACOLPOI
	LEA	COL1,A0
	MOVE.W	#$636,2(A0)
	MOVE.W	#$959,6(A0)
	MOVE.W	#$D9D,10(A0)
	MOVE.W	#$DD3,14(A0)
	MOVE.W	#$DBD,18(A0)
	MOVE.W	#$CAC,22(A0)
	MOVE.W	#$ECE,26(A0)
	MOVE.W	#$3AA,COL8-COL1+2(A0)
	BRA	COLON

SVART:	move.l	L628,D0
	add.l	#$15b8,D0
	MOVE.L	D0,SPRCOLPOI
	MOVE.L	D0,ANACOLPOI
	LEA	COL1,A0
	MOVE.W	#$222,2(A0)
	MOVE.W	#$444,6(A0)
	MOVE.W	#$666,10(A0)
	MOVE.W	#$555,14(A0)
	CLR.W	18(A0)
	CLR.W	22(A0)
	CLR.W	26(A0)
	MOVE.W	#$555,COL8-COL1+2(A0)
	BRA	COLON

LOADTHESAMPLEFLAG:	DC.B	0
CHIPMEMON:		DC.B	0
LOADSAMPLENAMEPOJ:	BLK.B	28

CHANGEMODULEDIR:
	MOVE.L	L518,A0
	CMP.W	#$AA,2(A0)
	BEQ.S	.CH1
	bsr	L308
.CH1:	bsr	L138
	clr.l	L631
	LEA	L82,a6
	BSR	PRINTMODDIR
	move.w	#$00C4,L649
	move.w	#$002A,L650
	bsr	L246
	move.l	a6,L651
	add.l	#32,L651
	bsr	L315
	clr.l	L651
	CLR.W	L708
	BSR	CLEARLOW
	TST.L	L82
	BEQ.S	.CHANGEOK
	LEA	L82(PC),A0
.CHLO:	TST.B	(A0)+
	BNE.S	.CHLO
	SUBQ.L	#$2,A0
	CMP.B	#':',(A0)
	BEQ.S	.CHANGEOK
	CMP.B	#'/',(A0)+
	BEQ.S	.CHANGEOK
	MOVE.B	#'/',(A0)
.CHANGEOK:BSR	PRINTMODDIR
	bra	L309

CHANGEINST:
	MOVE.B	L647,D0
	BEQ	P_RTS
	CMP.B	#$43,D0
	BNE.S	.C_0
	MOVE.W	L658,OLDINSTR
	MOVE.W	#$10,L658
	BRA	HANDLEPLAY

.C_0:	CMP.B	#$0F,D0
	BNE.S	.C_02
	CLR.W	L658
	JSR	L552
	BSR	SHOWSAMPLE
	CLR.W	L647
	RTS
.C_02:	LEA	KEYLIST,A0
	MOVEQ	#0,D1
	MOVEQ	#$F,D7
.C_LOP:	CMP.B	(A0,D1.W),D0
	BEQ.S	.C_CONT
	ADDQ.W	#1,D1
	DBF	D7,.C_LOP

	CMP.B	#$3C,D0
	BNE	P_RTS
	CLR.W	L647
	ADDQ.B	#1,DRUMMERON
	CMP.B	#$4,DRUMMERON
	BNE.S	.OKILE
	CLR.B	DRUMMERON
.OKILE:	MOVEQ	#0,D0
	MOVE.B	DRUMMERON,D0
	ASL.W	#$2,D0
	LEA	PLOTS,A0
	ADD.L	D0,A0
	MOVE.L	L628,A1
	MOVE.B	(A0)+,D0
	MOVE.B	D0,[132*40]+39(A1)
	MOVE.B	(A0)+,D0
	MOVE.B	D0,[133*40]+39(A1)
	MOVE.B	(A0)+,D0
	MOVE.B	D0,[134*40]+39(A1)
	RTS
.C_CONT:TST.W	ENTERPRESSED
	BEQ.S	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
	SWAP	D0
	AND.W	#$F,D0
	ASL.W	#1,D0
	LEA	L606,A0
	MOVE.B	(A0,D0.W),L655
	CLR.B	L656
	MOVE.L	#L655,L635
	MOVE.L	#1,L636
	JSR	L562
	MOVE.W	D6,L655
	JMP	L561

L10:	move.l	$6c.w,L705
	TST.B	HARD
	BNE.S	INITHARD
	move.l	$04.w,a6
	move.l	$78(a6),a0
	move.l	(a0),a0
	move.l	$e(a0),a0
	add.l	#$68,a0
	move.l	(a0),L703
	move.l	#L510,(a0)
	move.l	a0,L702
	rts
INITHARD:
	MOVE.L	$68.W,OLD68
	MOVE.L	#MYHARD,$68.W
	RTS

L11:	move.l	#$02648,d0
	move.l	#$10000,d1
	jsr	-$00c6(a6)
	move.l	d0,L79
	rts

L14:	move.l	oldirq,$70.w
	move.w	oldena,d0
	or.w	#$8000,d0
	move.w	d0,$dff09a

	clr.w	$dff0a8
	clr.w	$dff0b8
	clr.w	$dff0c8
	clr.w	$dff0d8
	move.w	#$f,$dff096
	move.l	L704,a7
	move.l	L627,$dff080
	clr.w	$dff088
	move.l	$04.w,a6
	move.l	L723,a1
	jsr	-$019e(a6)
	move.l	L724,a1
	move.l	L540,-$015a(a1)
	jsr	-$019e(a6)
	move.l	L628,a1
	move.l	#$6c70,d0
	jsr	-$00d2(a6)
	move.l	CrunchShitPoi,a1
	move.l	#CrunchShitLen,d0
	jsr	-$00d2(a6)
	move.l	L686,a1
	jsr	-$019e(a6)
	move.l	L697(PC),a1
	move.l	#$1143c,d0
	jsr	-$00d2(a6)
	move.l	L79,a1
	move.l	#$2648,d0
	jsr	-$00d2(a6)
	bsr	L301
	move.l	L705,$6c.w
	BSR	STP
	BSR.S	EXITKEYB
	AND.B	#$FD,$BFE001
	MOVE.B	FILTEROLD,D0
	OR.B	D0,$BFE001
	moveq	#0,d0
	rts

EXITKEYB:
	TST.B	HARD
	BNE.S	.EXITHARD
	move.l	L702,a0
	move.l	L703,(a0)
	RTS
.EXITHARD:
	MOVE.L	OLD68,$68.W
	RTS

*************************************
*************************************

FILTT:	bsr	L124
	BSR	GETMEMORY
	BNE	L139
	BSR	STP

	move.l	SampleBuffer,a0
	move.l	a0,a1
	add.l	SampleBufferLen,a1
	move.l	a1,d0
	sub.l	a0,d0
	beq	R_Noo

	subq.l	#$2,d0
	bmi.s	FILTED
	moveq	#$03,d7
	move.b	(a0)+,d1
	ext.w	d1
.E1112:	subq.l	#1,d0
	bmi.s	FILTINS
	move.b	$1(a0),d3
	ext.w	d3
	add.w	d1,d3
	move.b	(a0),d2
	ext.w	d2
	add.w	d2,d3
	ext.l	d3
	divs	d7,d3
	move.b	d3,(a0)+
	move.w	d2,d1
	bra.s	.E1112
FILTINS:
	bsr	getnekst
	cmp.w	#1,d0
	blt	L139
	move.b	#'C',(a0)+
FILTED:	BSR	L121
	BSR	EMPTYLWORDS
	JSR	L552
	BRA	SHOWSAMPLE


FILTTT:	BSR	GETMEMORY
	move.l	SampleBuffer,a0
	move.l	a0,a1
	add.l	SampleBufferLen,a1
	move.l	a1,d0
	sub.l	a0,d0

	subq.l	#$2,d0
	moveq	#$03,d7
	move.b	(a0)+,d1
	ext.w	d1
.E2112:	subq.l	#1,d0
	bmi.s	FILTINR
	move.b	$1(a0),d3
	ext.w	d3
	add.w	d1,d3
	move.b	(a0),d2
	ext.w	d2
	add.w	d2,d3
	ext.l	d3
	divs	d7,d3
	move.b	d3,(a0)+
	move.w	d2,d1
	bra.s	.E2112
FILTINR:JSR	L552
	BRA	SHOWSAMPLE


EVERPRINTSOUND:
	TST.B	PRINTSOUND
	BEQ	ALFRTS
	CLR.B	PRINTSOUND
	BRA	SHOWSAMPLE

PRINTSOUND:	DC.B	$0
NOKEYB:		DC.B	$0
PRTED:		DC.B	$0
	DC.B 0
SampleBuffer:	dc.l	0
SampleBufferLen:dc.l	0
PLAYBUFFER:	DC.W	0
AS_PT:		dc.l	0
AS_Len:		dc.l	0
POINTLIST:	BLK.W	184,0

GOSAMPLER:
	MOVE.W	L668,D0
	CMP.W	#$37,D0
	BGE	L257
DisplaySampler:
	bsr	L124
	CMP.L	#'edit',L632
	BNE.S	DS_1
	CLR.L	L632
	BSR	L134
DS_1:	CMP.L	#'edit',L631
	BNE.S	DS_11
	CLR.L	L631
	BSR	L134
DS_11:	MOVE.W	#1,PRINTFREE
	MOVE.W	#6,L713
	bsr	L121
	JSR	L534
	LEA	NYSAM,a0
	bsr	L117
	BSR	ShowSample
	BSR	L124
	BSR	M_WAIT
	BRA	M_WAIT

M_WAIT:	MOVE.W	#$FEDC,D0
M_LKO:	DBF	D0,M_LKO
	RTS

EXITSampler:
	bsr	L124
	MOVE.W	#1,PRINTFREE
	bsr	L121
	LEA	NYSAM,A0
	BSR	L117
	lea	L707,a0
	lea	L706,a1
	moveq	#$16,d7
YH8:	clr.w	(a0)+
	clr.w	(a1)+
	dbf	d7,YH8
	BSR	L121
	MOVE.W	#1,L713
	JSR	L530
	BSR	L37
	BSR	M_WAIT
	BRA	M_WAIT

WAITFORDRIVES:
	BSR	L308
	MOVE.L	$04.W,A6
	lea	$015e(a6),a0
	lea	TRACKDISK,a1
	jsr	-276(a6)
	move.l	d0,a6
	lea	$24(a6),a6
.DE84:	move.l	a6,a1
	moveq	#$03,d6
.DE85:	tst.l	(a1)+
	beq.s	.DE86
	move.l	-4(a1),a2
	btst	#7,$41(a2)
	beq.s	.DE87
.DE86:	dbf	d6,.DE85
	bra	L309

.DE87:	BSR	L135
	bra.s	.DE84


CLRPOINTLIST:
	LEA	POINTLIST(PC),A0
	MOVE.W	#183,D7
	MOVEQ	#0,D0
.CLRPL:	MOVE.W	D0,(A0)+
	DBF	D7,.CLRPL
	RTS




SOCTDOWN:
	BSR	L124
	BSR	SOURCEDEST
	tst.l	d0
	bne	L139
	MOVEQ	#0,D0
	MOVE.B	COPFROM(PC),D0
	MOVE.W	D0,L658
	BSR.L	GETMEMORY
	BNE	L139
	TST.L	SAMPLEBUFFERLEN
	BEQ	L139
	JSR	L504
	JSR	L504
	BSR	STP

	MOVE.W	#1,PRINTFREE
	MOVEQ	#0,D1
	move.B	COPFROM(PC),d1
	BEQ	L139
	CMP.B	COPTO(PC),D1
	BEQ	L139
	MOVE.B	COPTO(PC),D1
	BEQ	L139

	MOVEQ	#0,D2
	MOVE.B	COPTO(PC),D2
	MULU	#$1E,D2
	MOVE.L	L697(PC),A0
	LEA	-$A(A0,D2.W),A2
	move.w	#'El',(a2)+
	clr.b	(a2)+
	move.b	#'G',(a2)+
	move.b	copfrom(pc),(a2)+
	clr.b	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	move.b	copfrom(pc),octfrom
	move.b	copto(pc),octto

	moveq	#0,d4
	moveq	#0,d5
	move.b	octto(pc),d4
	MOVE.b	octfrom(pc),D5
	mulu	#$1e,d4
	MULU	#$1E,D5
	MOVE.L	L697(PC),A0
	cmp.w	#$3fff,12(a0,d5.w)
	ble.s	odow
	MOVE.W	#$7FFF,12(A0,D4.W)
	move.w	#$40,14(a0,d4.w)
	CLR.W	16(A0,D4.W)
	MOVE.W	#1,18(A0,D4.W)
	BRA.S	KAFFE

ODOW:	move.w	12(a0,d5.w),d1
	asl.w	#1,d1
	move.w	d1,12(A0,D4.W)
	move.w	14(a0,d5.w),14(a0,d4.w)	;volume
	move.w	16(a0,d5.w),d1
	asl.w	#1,d1
	move.w	d1,16(A0,D4.W)
	move.w	18(a0,d5.w),d1
	asl.w	#1,d1
	move.w	d1,18(a0,d4.w)
	cmp.w	#2,18(a0,d4.w)
	bne.s	kaffe
	move.w	#1,18(a0,d4.w)

KAFFE:



OCTDIE:	moveq	#0,d1
	move.b	octto(pc),d1
	Asl.w	#2,d1
	lea	L698,A4
	LEA	(A4,D1.W),A4
	move.l	(A4),D1
	beq.s	OcDNoOld
	clr.l	(a4)
	move.l	D1,A1
	move.l	$7C(A4),D0
	CLR.L	$7C(A4)
	move.l	$04.w,a6
	jsr	-210(A6)
OcDNoOld:

	MOVEQ	#0,D0
	MOVE.B	OCTFROM(PC),D0
	MOVE.W	D0,L658
	BSR	GETMEMORY

	MOVE.L	SAMPLEBUFFERLEN(PC),D7
	CMP.L	#16,D7
	BLE	L139
	ASL.L	#1,D7
	CMP.L	#$FFFE,D7
	BLE.S	IPOW
	MOVE.L	#$FFFE,D7

IPOW:	MOVE.L	D7,D0
	move.l	#$10002,d1
	move.l	$04.W,a6
	jsr	-198(a6)
	tst.l	d0
	BNE.S	OkDOKK
	MOVEQ	#0,D0
	MOVE.B	octTO(PC),D0
	mulu	#$1e,d0
	move.l	L697(PC),a0
	LEA	-$A(a0,D0.W),A0
	clr.l	(a0)
	clr.l	4(a0)
	clr.l	8(a0)
	clr.l	$c(a0)
	clr.l	$10(a0)
	clr.w	$14(a0)
	CLR.L	$16(A0)
	CLR.L	$1A(A0)
	BRA	CopRedCan

OkDOKK:	moveq	#0,d1
	move.b	octto(pc),d1
	Asl.w	#2,d1
	lea	L698,A4
	LEA	(A4,D1.W),A4
	move.l	d0,(a4)
	move.l	D7,$7C(a4)

	MOVE.L	SAMPLEBUFFER(PC),A0
	MOVE.L	D0,A1
	LSR.L	#1,D7
	SUBQ.L	#2,D7
OCTDOO:
	MOVE.B	(A0)+,D0
	MOVE.B	D0,(A1)+
	EXT.W	D0
	MOVE.B	(A0),D1
	EXT.W	D1
	ADD.W	D0,D1
	LSR.W	#1,D1
	MOVE.B	D1,(A1)+
	DBF	D7,OCTDOO

	MOVE.B	(A0),D0
	MOVE.B	D0,(A1)+
	EXT.W	D0
	LSR.W	#1,D0
	MOVE.B	D0,(A1)+

	moveq	#0,d1
	MOVE.b	octto(pc),D1
	ASL.W	#2,D1
	LEA	IFFSHIT,A1
	CLR.L	(A1,D1.W)

	BSR	STP
	JSR	L552
	BSR	SHOWSAMPLE
	BRA	L134



SFADEOUT:
	BSR	L124
	BSR	GETMEMORY
	BNE	L139
	JSR	L504
	cmp.l	#184,SampleBufferLen
	blt	L139
	BSR	L137
	JSR	L504
	JSR	L504
	BSR	L124
	JSR	L504
SFO_Wa:	btst	#10,$dff016
	beq	L139
	btst	#6,$bfe001
	bne.s	SFO_WA
	bsr	GetOffset
	bne	L139
	AND.L	#$FFFFFFFE,D1

	move.l	SampleBufferLen(PC),d7
	SUB.L	D1,D7
	CMP.L	#32,D7
	BLE	L139

	bsr	getnekst
	cmp.w	#3,d0
	blt	L139
	move.b	#'A',(a0)+
	move.w	d1,d0
	lsr.w	#8,d0
	move.b	d0,(a0)+
	move.b	d1,(a0)+
LoadFadeOut:
	move.l	d1,-(a7)
	BSR	GETMEMORY
	move.l	(a7)+,d1
	MOVE.L	SAMPLEBUFFER(PC),A0
	ADD.L	D1,A0
	move.l	SampleBufferLen(PC),d7
	SUB.L	D1,D7
	MOVE.L	#$FFFFF,D6
	DIVU	D7,D6
	EXT.L	D6
	ASL.L	#8,D6
	ASL.L	#3,D6
	MOVE.L	#$7FFF0000,D5
	BRA.S	SFO_LOP

SFO_LO:	MOVE.B	(A0),D0
	EXT.W	D0
	SWAP	D5
	MULS	D5,D0
	ASR.L	#8,D0
	ASR.L	#7,D0
	MOVE.B	D0,(A0)+
	SWAP	D5
SFO_LOP:SUB.L	D6,D5
	DBF	D7,SFO_LO

	BSR	STP
	BSR	EMPTYLWORDS
	JSR	L552
	BSR	SHOWSAMPLE
	BRA	L134

getnekst:	;d0/a0	get next kommandoplats i current sample
	moveq	#0,d0
	move.w	L658,d0
	mulu	#$1e,d0
	move.l	L697(PC),a0
	lea	-$a+3(a0,d0.w),a0
	cmp.w	#'El',-3(a0)
	bne.s	GoDummyCom
	MOVEM.L	D1/A1,-(A7)
	moveq	#$12,d0
gnekst:	subq.w	#1,d0
	moveq	#0,d1
	tst.b	(a0)
	beq.s	TheFirst
	move.b	(a0)+,d1
	sub.w	#$41,d1
	move.b	commands(pc,d1.w),d1
	ext.w	d1
	sub.w	d1,d0
	lea	(a0,d1.w),a0
	tst.b	(a0)
	bne.s	gnekst
TheFirst:		;a0=nasta kommandoplats d0=antal teckenpos kvar
	MOVEM.L	(A7)+,D1/A1
	rts

GoDummyCom:
	lea	DummyCommand(pc),a0
	moveq	#$8,d0
	rts

;	ANTAL DATABYTES-A B C D E F G H I J K L M N O
COMMANDS:	DC.B	2,2,0,0,2,1,1,4,1,3,3,5,4,3,3
	EVEN
dummycommand:	dc.b	0,0,0,0,0,0,0,0

SFADEIN:BSR	L124
	BSR	GETMEMORY
	BNE	L139
	JSR	L504
	cmp.l	#184,SampleBufferLen
	blt	L139
	BSR	L137
	JSR	L504
	JSR	L504
	BSR	L124
	JSR	L504
.SFI_Wa:btst	#10,$dff016
	beq	L139
	btst	#6,$bfe001
	bne.s	.SFI_WA
	bsr	GetOffset
	bne	L139
	AND.L	#$FFFFFFFE,D1
	cmp.l	#32,d1
	ble	L139

	bsr	getnekst
	cmp.w	#3,d0
	blt	L139
	move.b	#'B',(a0)+
	move.w	d1,d0
	lsr.w	#8,d0
	move.b	d0,(a0)+
	move.b	d1,(a0)+
LoadFadeIn:
	move.l	d1,-(a7)
	bsr	GetMemory
	move.l	(a7)+,d1

	MOVE.L	SAMPLEBUFFER(PC),A0
	MOVE.L	D1,D7
	MOVE.L	#$FFFFF,D6
	DIVU	D7,D6
	EXT.L	D6
	ASL.L	#8,D6
	ASL.L	#3,D6
	MOVEQ	#0,D5
	BRA.S	SFI_LOP

SFI_LO:	MOVE.B	(A0),D0
	EXT.W	D0
	SWAP	D5
	MULS	D5,D0
	ASR.L	#8,D0
	ASR.L	#7,D0
	MOVE.B	D0,(A0)+
	SWAP	D5
SFI_LOP:ADD.L	D6,D5
	DBF	D7,SFI_LO

	BSR	STP
	BSR	EMPTYLWORDS
	JSR	L552
	BSR	SHOWSAMPLE
	BRA	L134


SCHVOLUME:
	BSR	GETMEMORY
	BSR	L363
	BSR	WAITFORDRIVES
	BSR	L138
	BSR	L124
	cmp.l	#184,SampleBufferLen
	ble	OrigCALC
	MOVE.W	#183,D7
	LEA	POINTLIST(PC),A0
	MOVE.L	A0,A1
DRILLA:	CLR.W	(A0)+
	DBF	D7,DRILLA
	move.l	SampleBuffer(PC),a0
	move.l	SampleBufferLen(PC),d1
	MOVE.L	D1,D4
	ADD.L	A0,D4
	move.l	#184*$10000,d0
	divu	d1,d0
	AND.L	#$FFFF,D0
	MOVE.L	D0,A5
	moveq	#0,d1
	LEA	POINTLIST(PC),A1
	clr.w	d3
	move.W	#183,D7
PIXX:	MOVE.W	#$007F,D5
	MOVE.W	#$FF80,D6
PixelL:	move.b	(a0)+,d0
	EXT.W	D0
	CMP.L	A0,D4
	BEQ	SCHVCONT
	CMP.W	D5,D0
	BGE.S	NONEGNEW
	MOVE.W	D0,D5
NONEGNEW:
	CMP.W	D6,D0
	BLE.S	NOPOSMAX
	MOVE.W	D0,D6
NOPOSMAX:
	add.l	A5,d1
	move.l	d1,d2
	swap	d2
	cmp.w	d2,d3
	beq.s	PixelL
	move.w	d2,d3

	move.b	(a0),d0
	EXT.W	D0
	CMP.L	A0,D4
	BEQ	SCHVCONT
	CMP.W	D5,D0
	BGE.S	EGNEW
	MOVE.W	D0,D5
EGNEW:	CMP.W	D6,D0
	BLE.S	OSMAX
	MOVE.W	D0,D6
OSMAX:
	MOVE.B	D5,(A1)+
	MOVE.B	D6,(A1)+
	dbf	d7,PiXX
	BRA.S	SCHVCONT

ORIGCALC:
	MOVE.W	#183,D7
	LEA	POINTLIST(PC),A0
	MOVE.L	A0,A1
ORILO:	CLR.W	(A0)+
	DBF	D7,ORILO
	move.l	SampleBuffer(PC),a0
	move.l	SampleBufferLen(PC),d7
	BEQ	L139
	SUBQ.L	#1,D7
	BRA.S	BIER

SCHMUS:	DC.B	0
	DC.B	0
SCHSIZE:DC.W	0

BITEL:	move.b	(a0)+,D0
	MOVE.B	(A0),D1
	CMP.B	D0,D1
	BGE.S	BITED
	EXG	D0,D1
BITED:	MOVE.B	D0,(A1)+
	MOVE.B	D1,(A1)+
BIER:	DBF	D7,BITEL
	move.b	(a0),D0
	MOVEQ	#0,D1
	CMP.B	D0,D1
	BGE.S	BILTED
	EXG	D0,D1
BILTED:	MOVE.B	D0,(A1)+
	MOVE.B	D1,(A1)+
	jSR	L504
	jSR	L504

SCHVCONT:
	BSR	L137
	jSR	L504
	jSR	L504
	MOVE.B	$DFF00A,SCHMUS
	MOVE.W	#$1000,SCHSIZE
	move.w	$dff01c,-(sp)
	move.w	#$7fff,$dff09a
	BSR	printsch

SCHLOP:	MOVE.W	#$91,D0
	BSR	L132
	BTST	#6,$BFE001
	BEQ.S	SCHDO
	BTST	#2,$DFF016
	BEQ	SCHCANCEL
	MOVE.B	$DFF00A,D0
	CMP.B	SCHMUS,D0
	BEQ.S	SCHLOP

	MOVE.B	D0,D1
	SUB.B	SCHMUS(PC),D0
	MOVE.B	D1,SCHMUS
	EXT.W	D0
	ASL.W	#6,D0
	EXT.L	D0
	MOVEQ	#0,D1
	MOVE.W	SCHSIZE,D1
	ADD.L	D0,D1
	CMP.L	#$8000,D1
	BLT.S	SCHOLL
	MOVE.L	#$7FFF,D1
SCHOLL:	TST.L	D1
	BPL.S	SCHUHE
	MOVEQ	#0,D1
SCHUHE:	MOVE.W	D1,SCHSIZE
	BSR	printsch
	BRA.S	SCHLOP

SCHDO:	BSR	L123_2
	MOVE.W	(A7)+,D0
	BSET	#15,D0
	MOVE.W	D0,$DFF09A

	bsr	getnekst
	cmp.w	#3,d0
	blt	SCHVERTI
	move.b	#'E',(a0)+
	move.w	schsize(pc),d5
	move.w	d5,d0
	lsr.w	#8,d0
	move.b	d0,(a0)+
	move.b	d5,(a0)+
ChangeVo:
	BSR	GETMEMORY
	BNE	L139
	BSR	STP
	move.l	SampleBuffer(PC),a0
	MOVE.l	SampleBufferLen(PC),D7
	MOVE.W	#$FF80,A3
	MOVE.W	#$007F,A4
	BRA.S	SCHLOPPA
SCHLOPPI:
	move.b	(a0),d0
	EXT.W	D0
	MULS	D5,D0
	ASL.L	#4,D0
	SWAP	D0
	CMP.W	A3,D0	;$FF80
	BGE.S	OK_NQ
	MOVE.W	A3,D0
OK_NQ:	CMP.W	A4,D0	;$7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add.w	d1,d1
	MOVE.W	D0,D2
	move.w	(a5,d0.w),d0
	move.w	(a5,d1.w),d1
	SUB.B	D0,D1

	move.w	(a2,d2.w),d2

.HAI:	bset	d6,(a1,d2.w)
	ADD.W	D3,D2	;40
	DBF	D1,.HAI

	dbf	d6,PxelLoop
	addq.l	#1,a1
	dbf	d7,BteLoop
	RTS

ZCopText:	dc.b "Copypartpos 0000     "
	even
ZeroText:	dc.b "Zerolength: 0000     "
	even
ZeroPosses:	dc.w $ec,$f4,$fc,$104
ZeroLength:	dc.w	0

ZheroGetLength:
	bsr	L121
	move.l	#Zcoptext,L635
	move.l	#21,L636
	move.l	#[$54*40]+[$88/8],L629
	Jsr	l566
	bra.s	GetLength

ZeroGetLength:
	bsr	L121
	move.l	#Zerotext,L635
	move.l	#21,L636
	move.l	#[$54*40]+[$88/8],L629
	Jsr	l566

GetLength:
	bsr	L308
	bsr	L138
	move.l	L697(PC),a6
	move.w	#292,L649
	move.w	#$59,L650
	bsr	L246
	MOVE.W	#1,MYEDIT
	move.w	#-1,AkoPos
	bra	ZeroPrintLen

ZeroLo:	move.w	akoPos(pc),d0
	add.w	d0,d0
	lea	ZeroPosses(pc),a0
	move.w	(a0,d0.w),L649
	bsr	L246

ZeroLoo:btst	#2,$dff016
	beq	Zerocancel
	move.b	L647,d1
	beq.s	ZeroLoo
	CLR.W	L647

	cmp.b	#$44,d1
	beq	Zerodoit
	cmp.b	#$45,d1
	beq	ZeroCancel
	cmp.b	#$4f,d1
	bne.s	ZeronoVanst
	subq.w	#1,AkoPos
	and.w	#3,AkoPos
	bra	ZeroLo
ZeronoVanst:
	cmp.b	#$4e,d1
	bne.s	ZeronoHoger
	addq.w	#1,akopos
	and.w	#$3,akopos
	bra	ZeroLo
ZeronoHoger:

	moveq	#0,d7
	lea	PiNums,a0
ZeroGetNumb:
	cmp.b	(a0,d7),d1
	beq.s	ZeroFound
	addq.w	#1,d7
	cmp.w	#$10,d7
	bne.s	ZeroGetNumb
	bra	ZeroLo
ZeroFound:
	;d7=hexno	$0-$f
	move.w	AkoPos(pc),d0
	move.w	d0,d1
	lsr.w	#1,d1
	lea	ZeroLength(pc),a1
	lea	(a1,d1.w),a1	;a1=lengthbytepos
	and.w	#1,d0
	bne.s	Zlagnybbel
	asl.b	#4,d7
	and.b	#$0f,(a1)
	or.b	d7,(a1)
	bra.s	ZeroprintLen
Zlagnybbel:
	and.b	#$f0,(a1)
	or.b	d7,(a1)
ZeroprintLen:
	and.w	#$fffe,ZeroLength

	lea	L605,a0
	moveq	#0,d0
	moveq	#0,d1
	move.b	ZeroLength(pc),d0
	move.b	ZeroLength+1(pc),d1
	asl.w	#1,d0
	asl.w	#1,d1
	move.w	(a0,d0.w),Zerotext+12
	move.w	(a0,d1.w),Zerotext+14

	move.l	#4,L636
	move.l	#ZeroText+12,L635
	move.l	#$54*40+[$88/8]+12,L629
	Jsr	L566
	addq.w	#1,AkoPos
	and.w	#3,AkoPos
	bra	ZeroLo

ZeroCancel:
	bsr	akoreset
	moveq	#0,d0
	rts
ZeroDoIt:
	bsr	akoreset
	moveq	#0,d0
	move.w	ZeroLength,d0
	rts




SZero:	bsr	SOURCEDEST
	tst.l	d0
	bne	copcan
	MOVE.W	#1,PRINTFREE
	MOVEQ	#0,D1
	move.B	COPFROM(PC),d1
	BEQ	COPREDCAN
	CMP.B	COPTO(PC),D1
	BEQ	COPCAN
	move.b	copfrom(pc),cofrom
	move.b	copto(pc),coto

	bsr	ZeroGetLength
	move.w	d0,ZeroLength
	beq	CopRedCan

	MOVEQ	#0,D2
	MOVE.B	COPTO(PC),D2
	MULU	#$1E,D2
	MOVE.L	L697(PC),A0
	LEA	-$A(A0,D2.W),A2
	move.w	#'El',(a2)+
	clr.b	(a2)+
	move.b	#'N',(a2)+
	move.b	copfrom(pc),(a2)+
	move.b	ZeroLength(pc),(a2)+
	move.b	ZeroLength+1(pc),(a2)+
	clr.b	(a2)+
	clr.w	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	moveq	#0,d0
	moveq	#0,d1
	move.b	coto(pc),d0
	move.b	cofrom(pc),d1
	MULU	#$1E,D0
	mulu	#$1e,d1
	MOVE.L	L697(PC),A0
	MOVE.l	12(a0,d1.w),12(A0,D0.W)
	MOVE.l	16(A0,D1.W),16(A0,D0.W)
	move.w	ZeroLength,d1
	lsr.w	#1,d1
	add.w	d1,12(a0,d0.w)
	tst.w	16(a0,d0.w)
	beq.s	Noadei
	add.w	d1,16(a0,d0.w)
noadei:
SZeroNow:
	moveq	#0,d1
	MOVE.B	COTO(PC),D1
	BEQ	COPREDCAN
	Asl.w	#2,d1
	lea	L698,A4
	LEA	(A4,D1.W),A4
	move.l	(A4),D1
	beq.s	ZOPNoOld
	clr.l	(a4)
	move.l	D1,A1
	move.l	$7C(A4),D0
	CLR.L	$7C(A4)
	move.l	$04.w,a6
	jsr	-210(A6)
ZOPNoOld:
	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	COFROM(PC),D1
	MOVE.B	COTO(PC),D2
	MULU	#$1E,D1
	MULU	#$1E,D2
	MOVE.L	L697(PC),A0
	LEA	-$A(A0,D2.W),A2
	LEA	-$A(A0,D1.W),A0

	MOVEQ	#0,D0
	MOVE.W	$16(A2),D0
	ASL.W	#$1,D0
	MOVE.L	D0,D7
	move.l	#$10002,d1
	move.l	$04.w,a6
	jsr	-198(a6)
	tst.l	d0
	BNE.S	ZOPOKK
	MOVEQ	#0,D0
	MOVE.B	COTO(PC),D0
	mulu	#$1e,d0
	move.l	L697(PC),a0
	LEA	-$A(a0,D0.W),A0
	clr.l	(a0)
	clr.l	4(a0)
	CLR.L	$16(A0)
	CLR.L	$1A(A0)
	BRA	COPREDCAN

ZOPOKK:	move.l	d0,(a4)
	move.l	D7,$7C(a4)
	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	COFROM(PC),D1
	MOVE.B	COTO(PC),D2
	ASL.W	#2,D1
	ASL.W	#2,D2
	LEA	L698,A0
	MOVE.L	(A0,D1.W),A1
	MOVE.L	(A0,D2.W),A2
	move.w	ZeroLength(pc),d6
	subq.w	#1,d6
ZopMo:	clr.b	(a2)+
	subq.w	#1,d7
	dbf	d6,ZopMo
	bra.s	Zommo
Zotte:	MOVE.b	(A1)+,(A2)+
Zommo:	DBF	D7,Zotte
	BRA.L	COPCAN






SZCop:	bsr	SOURCEDEST
	tst.l	d0
	bne	copcan
	MOVE.W	#1,PRINTFREE
	MOVEQ	#0,D1
	move.B	COPFROM(PC),d1
	BEQ	COPREDCAN
	CMP.B	COPTO(PC),D1
	BEQ	COPCAN
	move.b	copfrom(pc),cofrom
	move.b	copto(pc),coto

	bsr	ZheroGetLength
	move.w	d0,ZeroLength
	beq	CopRedCan

	moveq	#0,d0
	move.b	Copfrom,d0
	move.w	d0,L658
	bsr	GetMemory
	moveq	#0,d0
	move.w	ZeroLength,d0
	cmp.l	SampleBufferLen,d0
	bgt	L139

	MOVEQ	#0,D2
	MOVE.B	COPTO(PC),D2
	MULU	#$1E,D2
	MOVE.L	L697(PC),A0
	LEA	-$A(A0,D2.W),A2
	move.w	#'El',(a2)+
	clr.b	(a2)+
	move.b	#'O',(a2)+
	move.b	copfrom(pc),(a2)+
	move.b	ZeroLength(pc),(a2)+
	move.b	ZeroLength+1(pc),(a2)+
	clr.b	(a2)+
	clr.w	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	moveq	#0,d0
	moveq	#0,d1
	move.b	coto(pc),d0
	move.b	cofrom(pc),d1
	MULU	#$1E,D0
	mulu	#$1e,d1
	MOVE.L	L697(PC),A0
	MOVE.l	12(a0,d1.w),12(A0,D0.W)
	MOVE.l	16(A0,D1.W),16(A0,D0.W)
	move.w	ZeroLength,d1
	lsr.w	#1,d1
	moveq	#0,d2
	move.w	12(a0,d0.w),d2
	add.w	d1,d2
	cmp.l	#$fffe,d2
	bgt	Zlox
	move.w	d2,12(a0,d0.w)
	tst.w	16(a0,d0.w)
	beq.s	Nobladei
	add.w	d1,16(a0,d0.w)
nobladei:
SZcopNow:
	moveq	#0,d1
	MOVE.B	COTO(PC),D1
	BEQ	COPREDCAN
	Asl.w	#2,d1
	lea	L698,A4
	LEA	(A4,D1.W),A4
	move.l	(A4),D1
	beq.s	ZlOPNoOld
	clr.l	(a4)
	move.l	D1,A1
	move.l	$7C(A4),D0
	CLR.L	$7C(A4)
	move.l	$04.w,a6
	jsr	-210(A6)
ZlOPNoOld:
	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	COFROM(PC),D1
	MOVE.B	COTO(PC),D2
	MULU	#$1E,D1
	MULU	#$1E,D2
	MOVE.L	L697(PC),A0
	LEA	-$A(A0,D2.W),A2
	LEA	-$A(A0,D1.W),A0

	MOVEQ	#0,D0
	MOVE.W	$16(A2),D0
	ASL.W	#$1,D0
	MOVE.L	D0,D7
	move.l	#$10002,d1
	move.l	$04.w,a6
	jsr	-198(a6)
	tst.l	d0
	BNE.S	ZlOPOKK
Zlox:	MOVEQ	#0,D0
	MOVE.B	COTO(PC),D0
	mulu	#$1e,d0
	move.l	L697(PC),a0
	LEA	-$A(a0,D0.W),A0
	clr.l	(a0)
	clr.l	4(a0)
	CLR.L	$16(A0)
	CLR.L	$1A(A0)
	BRA	COPREDCAN

ZlOPOKK:move.l	d0,(a4)
	move.l	D7,$7C(a4)
	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	COFROM(PC),D1
	MOVE.B	COTO(PC),D2
	ASL.W	#2,D1
	ASL.W	#2,D2
	LEA	L698,A0
	MOVE.L	(A0,D1.W),A1
	MOVE.L	(A0,D2.W),A2
	move.l	a1,a3
	move.w	ZeroLength(pc),d6
	subq.w	#1,d6
ZlopMo:	move.b	(a3)+,(a2)+
	subq.w	#1,d7
	dbf	d6,ZlopMo
	bra.s	Zlommo
Zlotte:	MOVE.b	(A1)+,(A2)+
Zlommo:	DBF	D7,Zlotte
	BRA	COPCAN








SOURCEDEST:
	BSR	L134
	BSR	TOMRUTPR
	MOVE.W	#1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	#1,PRINTFREE
	MOVEQ	#0,D0
	bra.s	copd

COPREDCANCEL:
	bsr	L139
COPCANCEL:
	moveq	#-1,d0
copd:
	move.l	d0,-(a7)
	JSR	L552
	BSR	SHOWSAMPLE
	BSR	STP
	clr.w	L649
	move.w	#$010e,L650
	BSR	L246
	CLR.W	MYEDIT
	BSR	TOMRUTPR
	BSR	L504
	Bsr	L309
	move.l	(A7)+,d0
	rts




SCOPY:	bsr	SOURCEDEST
	tst.l	d0
	bne	copcan
	MOVE.W	#1,PRINTFREE
	MOVEQ	#0,D1
	move.B	COPFROM(PC),d1
	BEQ	COPREDCAN
	CMP.B	COPTO(PC),D1
	BEQ	COPCAN

	move.b	copfrom(pc),cofrom
	move.b	copto(pc),coto

	MOVEQ	#0,D2
	MOVE.B	COPTO(PC),D2
	MULU	#$1E,D2
	MOVE.L	L697(PC),A0
	LEA	-$A(A0,D2.W),A2
	move.w	#'El',(a2)+
	clr.b	(a2)+
	move.b	#'I',(a2)+
	move.b	copfrom(pc),(a2)+
	clr.b	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	moveq	#0,d0
	moveq	#0,d1
	move.b	coto(pc),d0
	move.b	cofrom(pc),d1
	MULU	#$1E,D0
	mulu	#$1e,d1
	MOVE.L	L697(PC),A0
	MOVE.l	12(a0,d1.w),12(A0,D0.W)
	MOVE.l	16(A0,D1.W),16(A0,D0.W)


Copparoxid:
	moveq	#0,d1
	MOVE.B	COTO(PC),D1
	BEQ	COPREDCAN
	Asl.w	#2,d1
	lea	L698,A4
	LEA	(A4,D1.W),A4
	move.l	(A4),D1
	beq.s	COPNoOld
	clr.l	(a4)
	move.l	D1,A1
	move.l	$7C(A4),D0
	CLR.L	$7C(A4)
	move.l	$04.w,a6
	jsr	-210(A6)
COPNoOld:
	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	COFROM(PC),D1
	MOVE.B	COTO(PC),D2
	MULU	#$1E,D1
	MULU	#$1E,D2
	MOVE.L	L697(PC),A0
	LEA	-$A(A0,D2.W),A2
	LEA	-$A(A0,D1.W),A0

	MOVEQ	#0,D0
	MOVE.W	$16(A2),D0
	ASL.W	#$1,D0
	BEQ.S	COPNULL
	MOVE.L	D0,D7
	move.l	#$10002,d1
	move.l	$04.w,a6
	jsr	-198(a6)
	tst.l	d0
	BNE.S	COPOKK
	MOVEQ	#0,D0
	MOVE.B	COTO(PC),D0
	mulu	#$1e,d0
	move.l	L697(PC),a0
	LEA	-$A(a0,D0.W),A0
	clr.l	(a0)
	clr.l	4(a0)
	CLR.L	$16(A0)
	CLR.L	$1A(A0)
	BRA	COPREDCAN

COPOKK:	move.l	d0,(a4)
	move.l	D7,$7C(a4)
COPNULL:MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	COFROM(PC),D1
	MOVE.B	COTO(PC),D2
	ASL.W	#2,D1
	ASL.W	#2,D2
	LEA	L698,A0
	MOVE.L	(A0,D1.W),A1
	MOVE.L	(A0,D2.W),A2
	LSR.W	#1,D7
	BRA.S	COPMOVEIT
COLONISTUGA:	MOVE.W	(A1)+,(A2)+
COPMOVEIT:	DBF	D7,COLONISTUGA
	BRA.S	COPCAN

COPREDCAN:
	BSR	L139
COPCAN:
	JSR	L552
	BSR	SHOWSAMPLE
	BSR	L504
	BRA	L309
	RTS

COPPOS:	DC.W	0
COPPOSSES:
	DC.W	$D4,5,$DC,6,$104,11,$10C,12

cofrom:	dc.b	0
coto:	dc.b	0
COPFROM:DC.B	$01
COPTO:	DC.B	$02
COPTEXT:DC.B	'FROM 01 TO 02'
	EVEN

TOMRUTPR:
	lea	L759+[6*40]+[$A0/8],a0
	MOVE.L	L628,A2
	ADD.L	#[6*40]+[$A0/8],A2
	lea	TOMRUT,a1
	moveq	#10,d0
TO7:	moveq	#$E,d1
TO8:	move.b	$2800(a0),d2
	move.b	$B0(a1),$2800(a0)
	move.b	d2,$B0(a1)
	move.b	(a0),d2
	move.b	(a1),(a0)+
	move.b	d2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IXREDCANCEL
	move.B	(A0)+,d1
	BEQ	MIXREDCANCEL
	move.B	(A0),d2
	BEQ	MIXREDCANCEL
	cmp.b	d0,d2
	BEQ	MIXREDCANCEL
	cmp.b	d1,d2
	BEQ	MIXREDCANCEL

	MOVEQ	#0,D1
	MOVEQ	#0,D2
	moveq	#0,d3
	MOVE.B	MIXFROM(PC),D1
	MOVE.B	MIXFROM2(PC),D2
	MOVE.B	MIXTO(PC),D3
	MULU	#$1E,D1
	MULU	#$1E,D2
	MULU	#$1E,D3
	MOVE.L	L697(PC),A0
	LEA	-$A(A0,D3.W),A2
	LEA	-$A(A0,D2.W),A1
	LEA	-$A(A0,D1.W),A0

	move.w	#$40,$18(a2)	;vol
	move.l	$1a(a0),$1a(a2)	;loopvalues
	MOVE.B	$19(A0),MixFrom1Vol
	move.b	$19(a1),MixFrom2Vol
	move.b	MixFrom(pc),MixFr
	move.b	MixFrom2(pc),MixFr2
	move.b	MixTo(pc),MixToo

	move.w	#'El',(a2)+
	clr.b	(a2)+
	move.b	#'M',(a2)+
	move.b	Mixfrom(pc),(a2)+
	move.b	MixFrom1Vol(pc),(a2)+
	move.b	Mixfrom2(pc),(a2)+
	move.b	MixFrom2Vol(pc),(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	clr.w	(a2)+
	BSR	TOMRUTPR

JetteMixer:
	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	MIXFR(PC),D1
	MOVE.B	MIXFR2(PC),D2
	MULU	#$1E,D1
	MULU	#$1E,D2
	MOVE.L	L697(PC),A0
	LEA	-$A(A0,D2.W),A1
	LEA	-$A(A0,D1.W),A0

	TST.W	$16(A0)
	BNE.S	MIXXE
	TST.W	$16(A1)
	BEQ	MIXREDCANCEL

MIXXE:	MOVEQ	#0,D0
	MOVE.W	$16(A0),D0
	CMP.W	$16(A1),D0
	BGE.S	MIXSE
	MOVE.W	$16(A1),D0
MIXSE:
	ASL.W	#$1,D0
	BEQ.S	MIX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ANCEL:
	BSR	L139
MIXCANCEL:
	JSR	L552
	BSR	SHOWSAMPLE
	BSR	STP
	clr.w	L649
	move.w	#$010e,L650
	BSR	L246
	CLR.W	MYEDIT
	BSR	L504
	BRA	L309

MIXPOSSES:
	DC.W	$AC,0,$B4,1,$D4,5,$DC,6,$104,11,$10C,12

MIXFROM:DC.B	$01
MIXFROM2:DC.B	$02
MIXTO:	DC.B	$03
MIXTEXT:DC.B	'01 + 02 TO 03'
	EVEN
MIXALLOCP:	DC.L	0
MIXALLOCL:	DC.L	0

MixFr:	dc.b	0
MixFr2:	dc.b	0
MixToo:	dc.b	0
MixFrom1Vol:	dc.b	0
MixFrom2Vol:	dc.b	0
		dc.b	0

INITSOUND:
	MOVE.W	#1,PRINTFREE
	MOVE.L	L697(PC),A0
	LEA	$43C(A0),A0
	TST.W	L658
	BEQ	L139

	MOVE.L	L637,D0
	MULU	#$400,D0
	LEA	(A0,D0.L),A0
	MOVE.L	A0,A4

	move.l	#$80808080,(a0)+
	move.l	#$80808080,(a0)+
	move.l	#$80808080,(a0)+
	move.l	#$80808080,(a0)+
	move.l	#$7f7f7f7f,(a0)+
	move.l	#$7f7f7f7f,(a0)+
	move.l	#$7f7f7f7f,(a0)+
	move.l	#$7f7f7f7f,(a0)+

	MOVE.W	#$33F,D7
INKL:	CLR.B	(A0)+
	DBF	D7,INKL

	move.l	#$70605040,(a0)+
	move.l	#$30201000,(a0)+
	move.l	#$f0e0d0c0,(a0)+
	move.l	#$b0a09080,(a0)+
	move.l	#$8f9fafbf,(a0)+
	move.l	#$cfdfefff,(a0)+
	move.l	#$0f1f2f3f,(a0)+
	move.l	#$4f5f6f7f,(a0)+


	move.l	#$00010203,(a0)+	;wavedata
	move.l	#$04050607,(a0)+
	move.l	#$08090a0b,(a0)+
	move.l	#$0c0d0e0f,(a0)+
	move.l	#$10111213,(a0)+
	move.l	#$14151617,(a0)+
	move.l	#$18191a1b,(a0)+
	move.l	#$1b1b1b1b,(a0)+

	move.l	#$1b1b1b1b,(a0)+
	move.l	#$1b1b1b1b,(a0)+
	move.l	#$1b1b1b1b,(a0)+
	move.l	#$1b1b1b1b,(a0)+
	move.l	#$1b1b1b1b,(a0)+
	move.l	#$1b1b1b1b,(a0)+
	move.l	#$1b1b1b1b,(a0)+
	move.l	#$1b1b1b1b,(a0)+


	move.l	#$c0403f3e,(a0)+	;volume och on/off
	move.l	#$3d3c3a38,(a0)+
	move.l	#$36343230,(a0)+
	move.l	#$2e2c2a28,(a0)+
	move.l	#$26242220,(a0)+
	move.l	#$1e1c1a18,(a0)+
	move.l	#$16141290,(a0)+
	move.l	#$0e0e0e0d,(a0)+

	move.l	#$0d0c0c0c,(a0)+
	move.l	#$0b0b0a0a,(a0)+
	move.l	#$0a090908,(a0)+
	move.l	#$08080707,(a0)+
	move.l	#$06060605,(a0)+
	move.l	#$05040404,(a0)+
	move.l	#$03030202,(a0)+
	move.l	#$02010100,(a0)+

	MOVE.L	L697(PC),A0
	MOVE.W	L658,D0
	MULU	#$1E,D0
	LEA	-10(A0,D0.W),A0
	MOVE.L	#'Mupp',(A0)
	MOVE.B	L637+3,4(A0)
	MOVE.B	#63,5(A0)
	MOVE.B	#63,6(A0)
	CLR.B	7(A0)
	CLR.L	8(A0)
	CLR.L	$C(A0)
	CLR.L	$10(A0)
	CLR.W	$14(A0)
	MOVE.W	#$0,$16(A0)
	MOVE.W	#$ff40,$18(A0)	;stamd -1, volume $40
	MOVE.W	#$0,$1A(A0)
	MOVE.W	#$1,$1C(A0)

	MOVE.W	L658,D1
	Asl.w	#2,d1
	lea	L698,A4
	LEA	(A4,D1.W),A4
	move.l	(A4),D1
	beq.s	InsNoOld
	clr.l	(a4)
	move.l	D1,A1
	move.l	$7C(A4),D0
	CLR.L	$7C(A4)
	move.l	$04.w,a6
	jsr	-210(A6)
INSNOOLD:
	bsr	InterpolCalculator
	JSR	L543
	JSR	L552
	BRA	SHOWSOUND


SR2:	CMP.W	#$125,D0
	BGE	AKOMAKER
	cmp.w	#$119,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S

GETERR:	CLR.L	SAMPLEBUFFER
	CLR.L	SAMPLEBUFFERLEN
	MOVEQ	#-1,D0
	RTS

GETMEMORY:
	MOVE.W	L658,D0
	BEQ.S	GETERR
	ASL.W	#$2,D0
	LEA	L698,A0
	MOVE.L	(A0,D0.W),D0
	move.l	D0,SampleBuffer
	MOVE.W	L658,D0
	MULU	#$1E,D0
	MOVE.L	L697(PC),A4
	MOVEQ	#0,D1
	MOVE.W	12(A4,D0.W),D1
	ASL.L	#1,D1
	MOVE.L	D1,SAMPLEBUFFERLEN
	MOVEQ	#0,D0
	RTS



OCTAVE:	BSR	L124
	BSR	SOURCEDEST
	tst.l	d0
	bne	L139
	MOVEQ	#0,D0
	MOVE.B	COPFROM(PC),D0
	MOVE.W	D0,L658
	BSR.S	GETMEMORY
	BNE	L139
	CMP.L	#66,SAMPLEBUFFERLEN
	BLE	L139
	BSR	L504
	BSR	L504
	BSR	STP

	MOVE.W	#1,PRINTFREE
	MOVEQ	#0,D1
	move.B	COPFROM(PC),d1
	BEQ	L139
	CMP.B	COPTO(PC),D1
	BEQ	L139
	MOVE.B	COPTO(PC),D1
	BEQ	L139

	MOVEQ	#0,D2
	MOVE.B	COPTO(PC),D2
	MULU	#$1E,D2
	MOVE.L	L697(PC),A0
	LEA	-$A(A0,D2.W),A2
	move.w	#'El',(a2)+
	clr.b	(a2)+
	move.b	#'F',(a2)+
	move.b	copfrom(pc),(a2)+
	clr.b	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	move.b	copfrom(pc),octfrom
	move.b	copto(pc),octto
	moveq	#0,d0
	moveq	#0,d1
	move.b	octto(pc),d0
	move.b	octfrom(pc),d1
	MULU	#$1E,D0
	mulu	#$1e,d1
	MOVE.L	L697(PC),A0
	MOVE.W	12(a0,d1.w),D2
	LSR.W	#1,D2
	MOVE.W	D2,12(A0,D0.W)
	move.w	14(a0,d1.w),14(a0,d0.w)
	MOVE.W	16(A0,D1.W),D2
	LSR.W	#1,D2
	MOVE.W	D2,16(A0,D0.W)
	MOVE.W	18(A0,D1.W),D2
	LSR.W	#1,D2
	BNE.S	OCTOK
	MOVE.W	#1,D2
OCTOK:	MOVE.W	D2,18(A0,D0.W)

octie:	moveq	#0,d1
	move.b	octto(pc),d1
	Asl.w	#2,d1
	lea	L698,A4
	LEA	(A4,D1.W),A4
	move.l	(A4),D1
	beq.s	OctNoOld
	clr.l	(a4)
	move.l	D1,A1
	move.l	$7C(A4),D0
	CLR.L	$7C(A4)
	move.l	$04.w,a6
	jsr	-210(A6)
OctNoOld:
	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	octFROM(PC),D1
	MOVE.B	octTO(PC),D2
	MULU	#$1E,D1
	MULU	#$1E,D2
	MOVE.L	L697(PC),A0
	LEA	-$A(A0,D2.W),A1
	LEA	-$A(A0,D1.W),A0

	MOVEQ	#0,D0
	MOVE.W	$16(A0),D0
	BEQ	L139
	MOVE.L	D0,D7
	move.l	#$10002,d1
	move.l	$04.w,a6
	jsr	-198(a6)
	tst.l	d0
	BNE.S	OktOKK

	MOVEQ	#0,D0
	MOVE.B	octTO(PC),D0
	mulu	#$1e,d0
	move.l	L697(PC),a0
	LEA	-$A(a0,D0.W),A0
	clr.l	(a0)
	clr.l	4(a0)
	clr.l	8(a0)
	clr.l	$c(a0)
	clr.l	$10(a0)
	clr.w	$14(a0)
	CLR.L	$16(A0)
	CLR.L	$1A(A0)
	BRA	CopRedCan

OktOKK:	moveq	#0,d1
	move.b	octto(pc),d1
	Asl.w	#2,d1
	lea	L698,A4
	LEA	(A4,D1.W),A4
	move.l	d0,(a4)
	move.l	D7,$7C(a4)

	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	octFROM(PC),D1
	MOVE.B	octTO(PC),D2
	ASL.W	#2,D1
	ASL.W	#2,D2
	LEA	L698,A0
	MOVE.L	(A0,D1.W),A1
	MOVE.L	(A0,D2.W),A2

	move.l	a1,a0
	move.l	a2,a1
	AND.L	#$7FFE,D7
	SUBQ.L	#1,D7
MEDELOCT:
	MOVE.B	(A0)+,D0
	EXT.W	D0
	MOVE.B	(A0)+,D1
	EXT.W	D1
	ADD.W	D1,D0
	ASR.W	#1,D0
	MOVE.B	D0,(A1)+
	DBF	D7,MEDELOCT

	BSR	STP
	BSR	EMPTYLWORDS
	JSR	L552
	BSR	SHOWSAMPLE
	BRA	L134

octfrom:	dc.b	0
octto:		dc.b	0

Reverse:bsr	L124
	BSR	GETMEMORY
	BNE	L139
	BSR	STP

	tst.l	samplebufferlen
	beq.s	R_Noo

	bsr	getnekst
	cmp.w	#1,d0
	blt	L139
	move.b	#'D',(a0)+

Reva:	bsr	getmemory
	move.l	SampleBuffer(PC),a0
	move.l	a0,a1
	add.l	SampleBufferLen(PC),a1
	move.l	a1,d0
	sub.l	a0,d0
	lsr.l	#1,d0
R_Loop:	move.b	(a0),d1
	move.b	-(a1),d2
	move.b	d1,(a1)
	move.b	d2,(a0)+
	subq.l	#1,d0
	bne.s	R_Loop
	bsr	L121
	BSR	EMPTYLWORDS
	JSR	L552
	BSR	SHOWSAMPLE
R_Noo:	rts



CutLeft:bsr	SOURCEDEST
	tst.l	d0
	bne	copcan
	MOVE.W	#1,PRINTFREE
	MOVEQ	#0,D1
	move.B	COPFROM(PC),d1
	BEQ	COPREDCAN
	CMP.B	COPTO(PC),D1
	BEQ	COPCAN
	move.b	copfrom(pc),cofrom
	move.b	copto(pc),coto

	bsr	L137
	moveq	#0,d0
	move.b	cofrom(pc),d0
	move.w	d0,L658
	Jsr	L552
	bsr	Showsample
	BSR	GETMEMORY
	BNE	L139
	BSR	L504
	BSR	L504
	BSR	L504
	BSR	L504
CL_MainLoop:
	bsr	L124
CL_Wait:btst	#10,$dff016
	beq	L139
	btst	#6,$bfe001
	bne.s	CL_Wait
	cmp.l	#184,SampleBufferLen
	blt	L139
	bsr	GetOffset
	bne	L139
	AND.L	#$FFFFFFFE,D1

	MOVEQ	#0,D2
	MOVE.B	COPTO(PC),D2
	MULU	#$1E,D2
	MOVE.L	L697(PC),A0
	LEA	-$A(A0,D2.W),A2
	move.w	#'El',(a2)+
	clr.b	(a2)+
	move.b	#'J',(a2)+
	move.b	copfrom(pc),(a2)+
	move.w	d1,d0
	lsr.w	#8,d0
	move.b	d0,(a2)+
	move.b	d1,(a2)+
	clr.b	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	clr.w	(a2)+
	moveq	#0,d0
	moveq	#0,d2
	move.b	coto(pc),d0
	move.b	cofrom(pc),d2
	MULU	#$1E,D0
	mulu	#$1e,d2
	MOVE.L	L697(PC),A0
	MOVE.W	12(a0,d2.w),D3
	MOVE.W	D1,D6
	LSR.W	#1,D6
	SUB.W	D6,D3
	MOVE.W	D3,12(A0,D0.W)
	MOVE.w	14(A0,D2.W),14(A0,D0.W)
	MOVE.W	16(A0,D2.W),D3
	SUB.W	D6,D3
	BMI.S	CLEARLOPY
	MOVE.W	D3,16(A0,D0.W)
	MOVE.w	18(A0,D2.W),18(A0,D0.W)
	bra.s	Avslaget
CLEARLOPY:
	CLR.W	16(A0,D0.W)
	MOVE.W	#1,18(A0,D0.W)
Avslaget:

CuttaLeft:
	and.l	#$fffe,d1
	move.l	d1,CutLeftOffset
	moveq	#0,d1
	MOVE.B	COTO(PC),D1
	BEQ	COPREDCAN
	Asl.w	#2,d1
	lea	L698,A4
	LEA	(A4,D1.W),A4
	move.l	(A4),D1
	beq.s	COPLNoOld
	move.l	$7C(A4),D0
	move.l	D1,A1
	clr.l	(a4)
	clr.l	$7c(a4)
	move.l	$04.w,a6
	jsr	-210(A6)
COPLNoOld:
	MOVEQ	#0,D2
	MOVE.B	COTO(PC),D2
	MULU	#$1E,D2
	MOVE.L	L697(PC),A0
	LEA	-$A(A0,D2.W),A2

	MOVEQ	#0,D0
	MOVE.W	$16(A2),D0
	ASL.W	#$1,D0
	MOVE.L	D0,D7
	move.l	#$10002,d1
	move.l	$04.w,a6
	jsr	-198(a6)
	tst.l	d0
	BNE.S	CUTLOKK
	MOVEQ	#0,D0
	MOVE.B	COTO(PC),D0
	mulu	#$1e,d0
	move.l	L697(PC),a0
	LEA	-$A(a0,D0.W),A0
	clr.l	(a0)
	clr.l	4(a0)
	CLR.L	$16(A0)
	CLR.L	$1A(A0)
	BRA	COPREDCAN

CUTLOKK:move.l	d0,(a4)
	move.l	D7,$7C(a4)
	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	COFROM(PC),D1
	MOVE.B	COTO(PC),D2
	ASL.W	#2,D1
	ASL.W	#2,D2
	LEA	L698,A0
	MOVE.L	(A0,D1.W),A1
	MOVE.L	(A0,D2.W),A2
	add.l	CutLeftOffset(pc),a1
	LSR.W	#1,D7
	BRA.S	COPLMOVEIT
COLLONISTUGA:	MOVE.W	(A1)+,(A2)+
COPLMOVEIT:	DBF	D7,COLLONISTUGA
	JSR	L552
	BSR	SHOWSAMPLE
	BSR	L504
	BRA	L309

CutLeftOffset:	dc.l	0




CutRight:
	bsr	SOURCEDEST
	tst.l	d0
	bne	copcan
	MOVE.W	#1,PRINTFREE
	MOVEQ	#0,D1
	move.B	COPFROM(PC),d1
	BEQ	COPREDCAN
	CMP.B	COPTO(PC),D1
	BEQ	COPCAN
	move.b	copfrom(pc),cofrom
	move.b	copto(pc),coto

	bsr	L137
	moveq	#0,d0
	move.b	cofrom(pc),d0
	move.w	d0,L658
	Jsr	L552
	bsr	Showsample
	BSR	GETMEMORY
	BNE	L139
	BSR	L504
	BSR	L504
	BSR	L504
	BSR	L504
	bsr	L124
CR_Wait:btst	#10,$dff016
	beq	L139
	btst	#6,$bfe001
	bne.s	CR_Wait
	cmp.l	#184,SampleBufferLen
	blt	L139
	bsr	GetOffset
	bne	L139
	AND.L	#$FFFFFFFE,D1

	MOVEQ	#0,D2
	MOVE.B	COPTO(PC),D2
	MULU	#$1E,D2
	MOVE.L	L697(PC),A0
	LEA	-$A(A0,D2.W),A2
	move.w	#'El',(a2)+
	clr.b	(a2)+
	move.b	#'K',(a2)+
	move.b	copfrom(pc),(a2)+
	move.w	d1,d0
	lsr.w	#8,d0
	move.b	d0,(a2)+
	move.b	d1,(a2)+
	clr.b	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	clr.w	(a2)+
	moveq	#0,d0
	moveq	#0,d2
	move.b	coto(pc),d0
	move.b	cofrom(pc),d2
	MULU	#$1E,D0
	mulu	#$1e,d2
	MOVE.L	L697(PC),A0
	MOVE.W	D1,D6
	LSR.W	#1,D6
	MOVE.W	D6,12(A0,D0.W)
	MOVE.w	14(A0,D2.W),14(A0,D0.W)
	move.l	16(a0,d2.w),16(a0,d0.w)

	MOVE.W	16(A0,D2.W),D3
	ADD.W	18(A0,D2.W),D3
	cmp.W	D6,D3
	Blt.s	KeepLOPpY
	CLR.W	16(A0,D0.W)
	MOVE.W	#1,18(A0,D0.W)
KeepLOPpY:

CuttaRight:
	and.l	#$fffe,d1
	move.l	d1,CutLeftOffset
	moveq	#0,d1
	MOVE.B	COTO(PC),D1
	BEQ	COPREDCAN
	Asl.w	#2,d1
	lea	L698,A4
	LEA	(A4,D1.W),A4
	move.l	(A4),D1
	beq.s	COPRNoOld
	move.l	$7C(A4),D0
	move.l	D1,A1
	clr.l	(a4)
	clr.l	$7c(a4)
	move.l	$04.w,a6
	jsr	-210(A6)
COPRNoOld:
	MOVEQ	#0,D2
	MOVE.B	COTO(PC),D2
	MULU	#$1E,D2
	MOVE.L	L697(PC),A0
	LEA	-$A(A0,D2.W),A2

	MOVEQ	#0,D0
	MOVE.W	$16(A2),D0
	ASL.W	#$1,D0
	MOVE.L	D0,D7
	move.l	#$10002,d1
	move.l	$04.w,a6
	jsr	-198(a6)
	tst.l	d0
	BNE.S	CUTROKK
	MOVEQ	#0,D0
	MOVE.B	COTO(PC),D0
	mulu	#$1e,d0
	move.l	L697(PC),a0
	LEA	-$A(a0,D0.W),A0
	clr.l	(a0)
	clr.l	4(a0)
	CLR.L	$16(A0)
	CLR.L	$1A(A0)
	BRA	COPREDCAN

CUTROKK:move.l	d0,(a4)
	move.l	D7,$7C(a4)
	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	COFROM(PC),D1
	MOVE.B	COTO(PC),D2
	ASL.W	#2,D1
	ASL.W	#2,D2
	LEA	L698,A0
	MOVE.L	(A0,D1.W),A1
	MOVE.L	(A0,D2.W),A2
	LSR.W	#1,D7
	BRA.S	COPRMOVEIT
CoOLLONISTUGA:	MOVE.W	(A1)+,(A2)+
COPRMOVEIT:	DBF	D7,CoOLLONISTUGA
	JSR	L552
	BSR	SHOWSAMPLE
	BSR	L504
	BRA	L309




CutBoth:bsr	SOURCEDEST
	tst.l	d0
	bne	copcan
	MOVE.W	#1,PRINTFREE
	MOVEQ	#0,D1
	move.B	COPFROM(PC),d1
	BEQ	COPREDCAN
	CMP.B	COPTO(PC),D1
	BEQ	COPCAN
	move.b	copfrom(pc),cofrom
	move.b	copto(pc),coto

	bsr	L137
	moveq	#0,d0
	move.b	cofrom(pc),d0
	move.w	d0,L658
	Jsr	L552
	bsr	Showsample
	BSR	GETMEMORY
	BNE	L139
	cmp.l	#184,SampleBufferLen
	blt	L139
	BSR	L504
	BSR	L504
	BSR	L504
	BSR	L504
	bsr	L124
CB_Wait:btst	#10,$dff016
	beq	L139
	btst	#6,$bfe001
	bne.s	CB_Wait
	bsr	GetOffset
	bne	L139
	AND.L	#$FFFFFFFE,D1
	move.l	d1,CutLeftOffset
	add.l	d1,SampleBuffer
	sub.l	d1,SampleBufferLen
	bsr	ShowCBSample
	bsr	GetMemory
	move.l	CutLeftOffset,d1
	add.l	d1,SampleBuffer
	sub.l	d1,SampleBufferLen
	bsr	L124
	bsr	L134
	BSR	L504
	BSR	L504
	BSR	L504
	BSR	L504
	bsr	L124
	BSR	L504
	bsr	L137
CB_W2it:btst	#10,$dff016
	beq	L139
	btst	#6,$bfe001
	bne.s	CB_W2it
	bsr	GetOffset
	bne	L139
	AND.L	#$FFFFFFFE,D1
	move.l	d1,CutBrightOffset


	MOVEQ	#0,D2
	MOVE.B	COPTO(PC),D2
	MULU	#$1E,D2
	MOVE.L	L697(PC),A0
	LEA	-$A(A0,D2.W),A2
	move.w	#'El',(a2)+
	clr.b	(a2)+
	move.b	#'L',(a2)+
	move.b	copfrom(pc),(a2)+
	move.b	CutLeftOffset+2,(a2)+
	move.b	CutLeftOffset+3,(a2)+
	move.b	CutBrightOffset+2,(a2)+
	move.b	CutBrightOffset+3,(a2)+
	clr.b	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	moveq	#0,d0
	moveq	#0,d2
	move.b	coto(pc),d0
	move.b	cofrom(pc),d2
	MULU	#$1E,D0
	mulu	#$1e,d2
	MOVE.L	L697(PC),A0
	move.l	CutLeftOffset(pc),d1
	MOVE.W	D1,D6
	LSR.W	#1,D6
	move.l	CutBrightOffset,d3
	lsr.w	#1,d3
	MOVE.W	D3,12(A0,D0.W)
	MOVE.w	14(A0,D2.W),14(A0,D0.W)	;vol
	MOVE.W	16(A0,D2.W),D3
	SUB.W	D6,D3
	BMI.S	CLEARLOsY
	MOVE.W	D3,16(A0,D0.W)
	MOVE.w	18(A0,D2.W),18(A0,D0.W)
	bra.s	Avzlaget
CLEARLOsY:
	CLR.W	16(A0,D0.W)
	MOVE.W	#1,18(A0,D0.W)
Avzlaget:
	move.w	12(a0,d0.w),d6
	MOVE.W	16(A0,D0.W),D3
	ADD.W	18(A0,D0.W),D3
	cmp.W	D6,D3
	Blt.s	KeepLorry
	CLR.W	16(A0,D0.W)
	MOVE.W	#1,18(A0,D0.W)
KeepLorry:
	move.l	CutLeftOffset(pc),d1
	move.l	CutBrightOffset(pc),d2

CuttaBoth:
	and.l	#$fffe,d1
	and.l	#$fffe,d2
	move.l	d1,CutLeftOffset
	move.l	d2,CutBrightOffset
	moveq	#0,d1
	MOVE.B	COTO(PC),D1
	BEQ	COPREDCAN
	Asl.w	#2,d1
	lea	L698,A4
	LEA	(A4,D1.W),A4
	move.l	(A4),D1
	beq.s	COPBNoOld
	move.l	$7C(A4),D0
	move.l	D1,A1
	clr.l	(a4)
	clr.l	$7c(a4)
	move.l	$04.w,a6
	jsr	-210(A6)
COPBNoOld:
	MOVEQ	#0,D2
	MOVE.B	COTO(PC),D2
	MULU	#$1E,D2
	MOVE.L	L697(PC),A0
	LEA	-$A(A0,D2.W),A2

	MOVEQ	#0,D0
	MOVE.W	$16(A2),D0
	ASL.W	#$1,D0
	MOVE.L	D0,D7
	move.l	#$10002,d1
	move.l	$04.w,a6
	jsr	-198(a6)
	tst.l	d0
	BNE.S	CUTBOKK
	MOVEQ	#0,D0
	MOVE.B	COTO(PC),D0
	mulu	#$1e,d0
	move.l	L697(PC),a0
	LEA	-$A(a0,D0.W),A0
	clr.l	(a0)
	clr.l	4(a0)
	CLR.L	$16(A0)
	CLR.L	$1A(A0)
	BRA	COPREDCAN
CUTBOKK:move.l	d0,(a4)
	move.l	D7,$7C(a4)
	MOVEQ	#0,D1
	MOVEQ	#0,D2
	MOVE.B	COFROM(PC),D1
	MOVE.B	COTO(PC),D2
	ASL.W	#2,D1
	ASL.W	#2,D2
	LEA	L698,A0
	MOVE.L	(A0,D1.W),A1
	MOVE.L	(A0,D2.W),A2
	add.l	CutLeftOffset(pc),a1
	LSR.W	#1,D7
	BRA.S	CzPLMOVEIT
CzLLONISTUGA:	MOVE.W	(A1)+,(A2)+
CzPLMOVEIT:	DBF	D7,CzLLONISTUGA
	JSR	L552
	BSR	SHOWSAMPLE
	BSR	L504
	BRA	L309
CutBrightOffset:	dc.l	0


GetOffset:
	move.w	L665,d0
	move.w	L666,d1
	cmp.w	#128,d0
	BLE.s	GO_Error
	cmp.w	#63,d1
	blt.s	GO_Error
	cmp.w	#312,d0
	bge.s	GO_Error
	cmp.w	#95,d1
	bge.s	GO_Error
	sub.w	#128,d0
	move.l	SampleBufferLen(PC),d7
	move.l	d7,d1
	Asl.l	#4,d1
	divu	#184,d1
	mulu	d0,d1
	lsr.l	#4,d1
	AND.L	#$FFFFFFFE,D1
	cmp.l	d7,d1
	bge.s	GO_Error
	bclr	#0,d1
	moveq	#0,d0
	rts
GO_Error:
	moveq	#-1,d0
	rts

ShowSample:
	CMP.W	#6,L713
	BNE	alfRTS
	BSR	GETMEMORY
ShowCBSample:
	BSR	L121
	cmp.l	#184,SampleBufferLen
	ble	OrigShow
	move.l	SampleBuffer(PC),a0
	move.l	SampleBufferLen(PC),d1
	MOVE.L	D1,D4
	move.l	#184*$10000,d0
	divu	d1,d0
	AND.L	#$FFFF,D0
	moveq	#0,d1
	move.l	L628,a1
	lea	[63*40]+16(a1),a1
	lea	SAMPLEROFFSETTABLE,a2
	MOVEQ	#0,d3
	moveq	#22,d7
	MOVE.B	#$80,D5
ByteLoop:
	moveq	#7,d6	
PixelLoop:
	MOVEQ	#0,d2
	move.b	(a0)+,d2
	DBF	D4,NAJ
	BRA.S	SS_END
NAJ:	add.w	d2,d2
	move.w	(a2,d2.w),d2
	bset	d6,(a1,d2.w)
	add.w	d0,d1
	bcc.s	PixelLoop
	dbf	d6,PixelLoop
	addq.l	#1,a1
	dbf	d7,ByteLoop
SS_End:	BRA	SHOWLOOP

i=40
sampleroffsetTable:
	dc.w I*16,I*16,I*16,I*16			;0
	dc.w I*17,I*17,I*17,I*17,I*17,I*17,I*17,I*17
	dc.w I*18,I*18,I*18,I*18,I*18,I*18,I*18,I*18
	dc.w I*19,I*19,I*19,I*19,I*19,I*19,I*19,I*19
	dc.w I*20,I*20,I*20,I*20,I*20,I*20,I*20,I*20
	dc.w I*21,I*21,I*21,I*21,I*21,I*21,I*21,I*21
	dc.w I*22,I*22,I*22,I*22,I*22,I*22,I*22,I*22
	dc.w I*23,I*23,I*23,I*23,I*23,I*23,I*23,I*23
	dc.w I*24,I*24,I*24,I*24,I*24,I*24,I*24,I*24
	dc.w I*25,I*25,I*25,I*25,I*25,I*25,I*25,I*25
	dc.w I*26,I*26,I*26,I*26,I*26,I*26,I*26,I*26
	dc.w I*27,I*27,I*27,I*27,I*27,I*27,I*27,I*27
	dc.w I*28,I*28,I*28,I*28,I*28,I*28,I*28,I*28
	dc.w I*29,I*29,I*29,I*29,I*29,I*29,I*29,I*29
	dc.w I*30,I*30,I*30,I*30,I*30,I*30,I*30,I*30
	dc.w I*31,I*31,I*31,I*31,I*31,I*31,I*31,I*31	;$7F
	dc.w I*32,I*32,I*32,I*32
	dc.w I*0,I*0,I*0,I*0				;-$80
	dc.w I*1,I*1,I*1,I*1,I*1,I*1,I*1,I*1
	dc.w I*2,I*2,I*2,I*2,I*2,I*2,I*2,I*2
	dc.w I*3,I*3,I*3,I*3,I*3,I*3,I*3,I*3
	dc.w I*4,I*4,I*4,I*4,I*4,I*4,I*4,I*4
	dc.w I*5,I*5,I*5,I*5,I*5,I*5,I*5,I*5
	dc.w I*6,I*6,I*6,I*6,I*6,I*6,I*6,I*6
	dc.w I*7,I*7,I*7,I*7,I*7,I*7,I*7,I*7
	dc.w I*8,I*8,I*8,I*8,I*8,I*8,I*8,I*8
	dc.w I*9,I*9,I*9,I*9,I*9,I*9,I*9,I*9
	dc.w I*10,I*10,I*10,I*10,I*10,I*10,I*10,I*10
	dc.w I*11,I*11,I*11,I*11,I*11,I*11,I*11,I*11
	dc.w I*12,I*12,I*12,I*12,I*12,I*12,I*12,I*12
	dc.w I*13,I*13,I*13,I*13,I*13,I*13,I*13,I*13
	dc.w I*14,I*14,I*14,I*14,I*14,I*14,I*14,I*14
	dc.w I*15,I*15,I*15,I*15,I*15,I*15,I*15,I*15	;-$1
	dc.w I*16,I*16,I*16,I*16

SHOWORIGLOOP:
	move.l	L628,a1
	lea	[59*40]+16(a1),a1
	CLR.L	(A1)
	CLR.L	4(A1)
	CLR.L	8(A1)
	CLR.L	12(A1)
	CLR.L	16(A1)
	CLR.L	20(A1)

	TST.W	L658
	BEQ	alfRTS
	MOVE.L	L671,D4
	BEQ	ALFRTS
	CMP.L	#1,D4
	BEQ	alfRTS

	MOVE.W	L671,D1
	ASL.W	#1,D1
	MOVE.W	D1,D2
	LSR.W	#$3,D1
	AND.W	#$7,D2
	EOR.W	#$7,D2
	bset	d2,(a1,d1.w)

	MOVE.W	L671,D1
	ADD.W	L672,D1
	ASL.W	#1,D1
	MOVE.W	D1,D2
	LSR.W	#$3,D1
	AND.W	#$7,D2
	EOR.W	#$7,D2
	bset	d2,(a1,d1.w)
	rts

SHOWLOOP:
	CMP.W	#6,L713
	BNE	alfRTS
	BSR	GETMEMORY
	cmp.l	#184,SampleBufferLen
	ble	SHOWOrigLOOP
	move.l	SampleBufferLen(PC),d1
	move.l	#184*$10000,d0
	divu	d1,d0
	and.l	#$ffff,d0
	move.l	L628,a1
	lea	[59*40]+16(a1),a1
	CLR.L	(A1)
	CLR.L	4(A1)
	CLR.L	8(A1)
	CLR.L	12(A1)
	CLR.L	16(A1)
	CLR.L	20(A1)

	TST.W	L658
	BEQ	alfRTS
	MOVE.L	L671,D4
	BEQ	alfRTS
	CMP.L	#1,D4
	BEQ	alfRTS

	MOVE.W	L671,D1
	ASL.W	#1,D1
	MULU	D0,D1
	SWAP	D1

	MOVE.W	D1,D2
	LSR.W	#$3,D1
	AND.W	#$7,D2
	EOR.W	#$7,D2
	CMP.W	#23,D1
	BGE.S	NOPLOTT
	bset	d2,(a1,d1.w)
NOPLOTT:
	MOVE.W	L671,D1
	ADD.W	L672,D1
	ASL.W	#1,D1
	MULU	D0,D1
	SWAP	D1

	MOVE.W	D1,D2
	LSR.W	#$3,D1
	AND.W	#$7,D2
	EOR.W	#$7,D2
	CMP.W	#23,D1
	BGE.S	NOPLOT2
	bset	d2,(a1,d1.w)
NOPLOT2:rts

OrigShow:
	move.l	SampleBuffer(PC),A4
	add.l	SampleBufferLen(PC),A4
	move.l	SampleBuffer(PC),a0
	move.l	L628,a1
	lea	[63*40]+16(a1),a1
	lea	SAMPLEROFFSETTABLE,a2
	moveq	#22,d7
	MOVEQ	#7,D6
	TST.L	SAMPLEBUFFERLEN
	BEQ.S	SHOWZEROES
ByteLoop2:
	moveq	#7,d6	
PixelLoop2:
	clr.w	d2
	move.b	(a0)+,d2
	CMP.L	A0,A4
	BEQ.S	SHOWZEROES
	add.w	d2,d2
	move.w	(a2,d2.w),d2
	bset	d6,(a1,d2.w)
	dbf	d6,PixelLoop2
	addq.l	#1,a1
	dbf	d7,ByteLoop2
	BRA	SHOWLOOP

BYTELOOP7:
	moveq	#7,d6	
PixelLoop7:
SHOWZEROES:
	MOVEQ	#$0,D2
	move.w	(a2,d2.w),d2
	bset	d6,(a1,d2.w)
	dbf	d6,PixelLoop7
	addq.l	#1,a1
	dbf	d7,BYTELOOP7
	Bsr	SHOWLOOP

SHOWSOUND:
	CMP.W	#$6,L713
	BNE	P_RTS
	BSR	GETMEMORY
	TST.L	SAMPLEBUFFERLEN
	BNE	P_RTS
	move.l	l697,a1
	move.w	l658,d0
	mulu	#$1e,d0
	lea	-10(a1,d0.w),a0
	cmp.l	#'Mupp',(a0)
	bne	p_rts
	MOVEQ	#0,D0
	MOVE.B	4(A0),PATTWAVENO
	MOVE.B	5(A0),CURRSOUNDREPEAT
	MOVE.B	6(A0),CURRSOUNDREPEND

	bsr	L121

	MOVEQ	#0,D1
	MOVE.B	WAVENO,D1
	lea	L558(PC),a0
	divu	#$a,d1
	add.w	#$30,d1
	move.b	d1,(a0)
	clr.w	d1
	swap	d1
	add.w	#$30,d1
	move.b	d1,1(a0)
	MOVE.L	L628(PC),A6
	LEA	[3*40]+[$A0/8](A6),A6
	lea	PATTCHARS-$100(PC),a1
	moveq	#0,d1
	move.b	(a0)+,d1
	lsl.w	#3,d1
	LEA	(A1,D1.W),A2
	move.b	(a2)+,(a6)+
	move.b	(a2)+,$27(a6)
	move.b	(a2)+,$4F(a6)
	move.b	(a2)+,$77(a6)
	move.b	(a2),$9F(a6)
	moveq	#0,d1
	move.b	(a0),d1
	lsl.w	#3,d1
	LEA	(A1,D1.W),A2
	move.b	(a2)+,(a6)
	move.b	(a2)+,$28(a6)
	move.b	(a2)+,$50(a6)
	move.b	(a2)+,$78(a6)
	move.b	(a2),$a0(a6)

	MOVEQ	#0,D1
	MOVE.B	PATTWAVENO(PC),D1
	lea	L558(PC),a0
	divu	#$a,d1
	add.w	#$30,d1
	move.b	d1,(a0)
	clr.w	d1
	swap	d1
	add.w	#$30,d1
	move.b	d1,1(a0)
	MOVE.L	L628(PC),A6
	LEA	[3*40]+[$B8/8](A6),A6
	lea	PATTCHARS-$100(PC),a1
	moveq	#0,d1
	move.b	(a0)+,d1
	lsl.w	#3,d1
	LEA	(A1,D1.W),A2
	move.b	(a2)+,(a6)+
	move.b	(a2)+,$27(a6)
	move.b	(a2)+,$4F(a6)
	move.b	(a2)+,$77(a6)
	move.b	(a2),$9F(a6)
	moveq	#0,d1
	move.b	(a0),d1
	lsl.w	#3,d1
	LEA	(A1,D1.W),A2
	move.b	(a2)+,(a6)
	move.b	(a2)+,$28(a6)
	move.b	(a2)+,$50(a6)
	move.b	(a2)+,$78(a6)
	move.b	(a2),$a0(a6)

	MOVE.L	L628,A1
	LEA	[[5+24]*40]+[$78/8](A1),A1
	MOVEQ	#0,D0
	MOVE.B	PATTWAVENO(PC),D0
	MULU	#$400,D0
	MOVE.L	L697,A2
	LEA	$43C(A2),A2
	LEA	(A2,D0.W),A2
	MOVEQ	#0,D0
	MOVE.B	WAVENO(PC),D0
	MULU	#$20,D0
	LEA	(A2,D0.W),A0

	MOVEQ	#$3,D7
SPLOP:	MOVEQ	#$7,D6
SPLOP2:	MOVE.B	(A0)+,D0
	EXT.W	D0
	MULS	#48*2*$80,D0
	SWAP	D0
	MULS	#40,D0
	BSET	D6,(A1,D0.W)
	DBF	D6,SPLOP2
	ADDQ.W	#1,A1
	DBF	D7,SPLOP

	MOVE.L	L628,A1
	LEA	[10*40]+[$A0/8](A1),A1
	LEA	$380(A2),A0

	MOVEQ	#[64/8]-1,D7	;WAVEFORMLIST
SPLOP3:	MOVEQ	#$7,D6
SPLOP32:MOVEQ	#0,D0
	MOVE.B	(A0)+,D0
	AND.B	#$1F,D0
	MULS	#40,D0
	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$1F,D1
	MULS	#40,D1
	BSET	D0,(A2,D1.W)
	BTST	#6,$BFE001
	BEQ	WAVELISTED
	RTS

ONOFFED:MOVE.L	L697,A0
	LEA	$43C(A0),A1
	MOVE.W	L658,D1
	MULU	#$1E,D1
	LEA	-10(A0,D1.W),A0
	CMP.L	#'Mupp',(A0)	;MUPPLJUD?
	BNE	L139

	MOVEQ	#0,D2
	MOVE.B	PATTWAVENO(PC),D2
	MULU	#$400,D2
	LEA	(A1,D2.L),A1
	LEA	$3C0(A1),A1

	SUB.W	#$F8,D0
	LSR.W	#1,D0
	TST.W	D0
	BEQ	L139
	CMP.W	#27,D0
	BEQ	L139

	LEA	(A1,D0.W),A2
	EOR.B	#$80,(A2)

	BSR	L504
	BSR	L124
	BSR	L504
	BSR	INTERPOLCALCULATOR
	BRA	SHOWSOUND

VOLUMEED:
	MOVE.W	L665,L667
	MOVE.W	L666,L668

	MOVE.L	L697,A0
	MOVE.W	L658,D0
	MULU	#$1E,D0
	LEA	-10(A0,D0.W),A0
	CMP.L	#'Mupp',(A0)	;MUPPLJUD?
	BNE	L139

	MOVEM.W	L667,D0-D1

	CMP.W	#$A0,D0
	BLT	P_RTS
	CMP.W	#$DF,D0
	BGT	P_RTS
	CMP.W	#$0A,D1
	BLT	P_RTS
	CMP.W	#$2A,D1
	BGT	P_RTS
	SUB.W	#$A0,D0
	SUB.W	#$0A,D1

	MOVE.L	L697,A0
	LEA	$43C(A0),A0
	MOVEQ	#0,D2
	MOVE.B	PATTWAVENO(PC),D2
	MULU	#$400,D2
	LEA	(A0,D2.L),A0

	LEA	$3C0(A0),A0
	LEA	(A0,D0.W),A0
	MOVE.W	D0,D2
	LSR.W	#3,D2
	AND.W	#$7,D0
	eor.w	#$7,d0

	MOVE.B	(A0),D7
	AND.B	#$80,D7
	ADD.B	D1,D1
	MOVE.W	#$40,D6
	SUB.W	D1,D6
	MOVE.W	D6,D1
	MOVE.B	D1,(A0)
	OR.B	D7,(A0)


	Lea	L759+[10*40]+[$A0/8]+10240,a1
	LEA	(A1,D2.W),A1

	MOVE.L	A1,A2
	MOVEQ	#$1F,D7
DIMBO:	BCLR	D0,(A1)
	LEA	40(A1),A1
	DBF	D7,DIMBO

	MOVEQ	#0,D2
	MOVE.B	(A0),D2
	AND.W	#$7F,D2
	LSR.W	#1,D2
	MOVE.W	#$1F*40,D1
	BRA.S	SULO
SULOO:	BSET	D0,(A2,D1.W)
	SUB.W	#40,D1
SULO:	DBF	D2,SULOO

	BTST	#6,$BFE001
	BEQ	VOLUMEED
	RTS

CLEARNOTUSEDWAVES:
	MOVE.L	L697,A0
	LEA	$43C(A0),A1
	LEA	$14(A0),A0
	moveq	#$1e,d7
CLNOUSL:CMP.L	#"Mupp",(a0)
	bne.s	NotThisOne
	moveq	#0,d0
	move.b	4(a0),d0
	mulu	#$400,d0
	lea	(a1,d0.l),a2
	lea	$3c0(a2),a3

	moveq	#0,d1
	moveq	#27,d6
Cllo2:	tst.b	(a3)+
	bmi.s	itson
	lea	(a2,d1.w),a4
	clr.l	(a4)+	;clr $20 bytes
	clr.l	(a4)+
	clr.l	(a4)+
	clr.l	(a4)+
	 clr.l	(a4)+
	 clr.l	(a4)+
	 clr.l	(a4)+
	 clr.l	(a4)+
itson:	add.w	#$20,d1
	dbf	d6,Cllo2
NotThisOne:
	LEA	$1E(A0),A0
	dbf	d7,ClNouSl
	rts

InterpolAll:
	moveq	#$1f,d7
.InterAlo:
	move.w	d7,L658
	move.l	d7,-(a7)
	bsr.s	InterpolCalculator
	move.l	(a7)+,d7
	dbf	d7,.InterAlo
	rts

INTERPOLCALCULATOR:
	MOVE.L	L697,A0
	lea	$43c(a0),a1
	MOVE.W	L658,D0
	MULU	#$1E,D0
	lea	-10(a0,d0.w),a0
	cmp.l	#'Mupp',(a0)
	bne	p_rts
	moveq	#0,d0
	move.b	4(a0),d0
	mulu	#$400,d0
	lea	(a1,d0.l),a1

	lea	$3c0(a1),a5
	lea	$3c0+27(a1),a6
interlo:move.l	a5,a4	;a4=inter-from source
	tst.b	(a5)+
.intoo:	tst.b	(a5)+
	bpl.s	.intoo
	tst.b	-(a5)
	move.l	a5,a3	;a3=inter-to source

	move.l	a3,d0
	sub.l	a4,d0
	move.l	d0,d3	;d3=att divsa med
	subq.l	#1,d0	;d0=antal interpols

	move.l	a4,d1
	sub.l	a1,d1	;d1=startinterpolwave i byte
	sub.l	#$3c0,d1
	move.l	a3,d2
	sub.l	a1,d2	;d2=destint i byte
	sub.l	#$3c0,d2

	mulu	#$20,d1
	mulu	#$20,d2
	lea	(a1,d1.w),a2	;start
	lea	(a1,d2.w),a3	;end

	moveq	#$1f,d7
theloop:move.w	d0,d6

	moveq	#0,d1
	move.b	(a2)+,d1
	ext.w	d1
	ext.l	d1
	move.b	(a3)+,d2
	ext.w	d2
	ext.l	d2
	sub.l	d1,d2
	asl.L	#$6,d2
	divs	d3,d2	;interpols+1
	asl.L	#$8,d2
	ASL.L	#$2,D2
	AND.L	#$FFFF,D1
	swap	d1
	lea	$1f(a2),a4
	bra.s	zelopp
zeloop:	add.l	d2,d1
	swap	d1
	move.b	d1,(a4)
	swap	d1
	lea	$20(a4),a4
zelopp:	dbf	d6,zeloop
	dbf	d7,theloop

	cmp.l	a5,a6
	bgt	interlo
	rts



;------------	;gor till ako-rut

AkoText1:	dc.b " Ackordtillverkare   "
AkoText2:	dc.b " 1   2   3  len dest "
AkoText3:	dc.b "C-2 D#2 G-2 0000 02  "
AkoText4:	even

AkoPosses:	dc.w $8c,$ac,$cc, $ec,$f4,$fc,$104, $114,$11c
AkoTabs:	dc.b 1,  0,  0,   1,  0,  0,  0,    1,   0,$ff
AkoPos:	dc.w	0

AkoPeriods:	dc.w	12,15,19
AkoLength:	dc.w	0
AkoDest:	dc.b	$02
		dc.b	0

AkoMaker:
	bsr	L308
	bsr	L138
	bsr	GetMemory
	bne	L139
	move.l	SampleBufferLen,AkoSourceLen
	cmp.l	#$80,SampleBufferLen
	blt	L139

	bsr	clearLow
	move.l	#akotext1,L635
	move.l	#akotext2-akotext1,L636
	move.l	#[$42*40]+[$88/8],a5
	move.l	a5,L629
	bsr	l566
	move.l	#akotext2,L635
	lea	[12*40](a5),a5
	move.l	a5,L629
	bsr	l566
	move.l	#akotext3,L635
	lea	[6*40](a5),a5
	move.l	a5,L629
	bsr	l566

	move.l	L697(PC),a6
	move.w	#292,L649
	move.w	#$59,L650
	bsr	L246
	MOVE.W	#1,MYEDIT
	move.w	#-1,AkoPos
	bra	CalcLengthFirst

AkoLo:	move.w	akoPos,d0
	add.w	d0,d0
	lea	AkoPosses(pc),a0
	move.w	(a0,d0.w),L649
	bsr	L246

AkoLoo:	btst	#2,$dff016
	beq	akocancel
	move.b	L647,d1
	beq.s	AkoLoo
	CLR.W	L647

	CMP.B	#$50,D1
	BNE.S	AkoF1
	move.l	#L598,L643
	move.l	#L599,L644
	BRA.S	AkoLoo
AkoF1:	CMP.B	#$51,D1
	BNE.S	AkoFK
	move.l	#L600,L643
	move.l	#L601,L644
	BRA.S	AkoLoo
AkoFK:	cmp.b	#$42,d1
	bne.s	NoAkoTab
	lea	AkoTabs(pc),a0
	move.w	AkoPos(pc),d0
Akoagga:addq.w	#1,d0
	tst.b	(a0,d0.w)
	beq.s	Akoagga
	bpl.s	Akossa
	moveq	#0,d0
Akossa:	move.w	d0,AkoPos
	bra	AkoLo
NoAkoTab:
	cmp.b	#$44,d1
	beq	akodoit
	cmp.b	#$45,d1
	beq	AkoCancel
	cmp.b	#$4f,d1
	bne.s	AknoVanst
	move.w	AkoPos(pc),d0
	bne.s	.Akod
	moveq	#9,d0
.Akod:	subq.w	#1,d0
	move.w	d0,AkoPos
	bra	AkoLo
AKnoVanst:
	cmp.b	#$4e,d1
	bne.s	AknoHoger
	move.w	AkoPos(pc),d0
	addq.w	#1,d0
	cmp.w	#9,d0
	bne.s	.Akom
	moveq	#0,d0
.Akom:	move.w	d0,AkoPos
	bra	AkoLo
AKnoHoger:
	cmp.w	#2,AkoPos
	bgt	AkoNoPeriodPos

	lea	L597,a0
	moveq	#0,d0
AkoL:	cmp.b	(a0,d0.w),d1
	beq.s	AkoFUND
	addq.b	#1,d0
	cmp.b	#$27,d0
	bne.s	AkoL
	bra	AkoLo
AkoFUND:clr.W	L647
	Asl.w	#1,d0
	moveq	#0,d3
	move.l	L643,a1
	move.w	(a1,d0.l),d3

	tst.l	d3
	beq	AkoLo
	lea	l602,a0
	moveq	#[[l603-l602]/2]-1,d7
	moveq	#$0,d0
Akfop:	cmp.w	(a0)+,d3
	bge.s	Akopff
	addq.w	#$1,d0
	dbf	d7,Akfop
	bra	AkoLo
Akopff:	move.w	AkoPos(pc),d1
	asl.w	#1,d1
	lea	AkoPeriods(pc),a0
	move.w	d0,(a0,d1.w)
	asl.w	#1,d1

	lea	L603,a0
	asl.w	#2,d0
	lea	AkoText3(pc),a1
	move.l	(a0,D0.W),(a1,d1.w)

CalcLengthFirst:
	lea	CalcValues(pc),a3
	move.w	AkoPeriods(pc),d0
	asl.w	#2,d0
	move.l	(a3,d0.w),a4
	move.w	AkoPeriods+2(pc),d0
	asl.w	#2,d0
	move.l	(a3,d0.w),a5
	move.w	AkoPeriods+4(pc),d0
	asl.w	#2,d0
	move.l	(a3,d0.w),a6
	move.l	Akosourcelen(pc),a3
	subq.l	#1,a3

	cmp.l	a4,a5
	bge.s	calchy
	exg	a4,a5
calchy:	cmp.l	a5,a6
	bge.s	calche
	exg	a5,a6
calche:	cmp.l	a4,a5
	bge.s	calchi
	exg	a4,a5
calchi:	move.l	Akosourcelen(pc),d7
	move.l	a4,d0
	lsr.l	#2,d0
	asl.l	#8,d7
	asl.l	#6,d7
	divu	d0,d7
	and.l	#$fffe,d7
	move.w	d7,AkoLength
	bra	AkoPrintLen


AkoNoPeriodPos:
	moveq	#0,d7
	lea	PiNums,a0
AkoGetNumb:
	cmp.b	(a0,d7),d1
	beq.s	AkoFound
	addq.w	#1,d7
	cmp.w	#$10,d7
	bne.s	AkoGetNumb
	bra	AkoLo
AkoFound:
	;d7=hexno	$0-$f
	cmp.w	#$6,AkoPos
	bgt	AkoNoLenpos

	move.w	AkoPos(pc),d0
	subq.w	#$3,d0
	move.w	d0,d1
	lsr.w	#1,d1
	lea	AkoLength(pc),a1
	lea	(a1,d1.w),a1	;a1=lengthbytepos
	and.w	#1,d0
	bne.s	lagnybbel
	asl.b	#4,d7
	and.b	#$0f,(a1)
	or.b	d7,(a1)
	bra.s	AkoprintLen
lagnybbel:
	and.b	#$f0,(a1)
	or.b	d7,(a1)
AkoprintLen:
	and.w	#$fffe,AkoLength

	lea	L605,a0
	moveq	#0,d0
	moveq	#0,d1
	move.b	AkoLength(pc),d0
	move.b	AkoLength+1(pc),d1
	asl.w	#1,d0
	asl.w	#1,d1
	move.w	(a0,d0.w),Akotext3+12
	move.w	(a0,d1.w),Akotext3+14

	move.l	#21,L636
	move.l	#akotext3,L635
	move.l	#$54*40+[$88/8],L629
	bsr	L566
	addq.w	#1,AkoPos
	bra	AkoLo

AkoNoLenpos:
	move.w	AkoPos(pc),d0
	lea	AkoDest(pc),a1
	and.w	#1,d0
	beq.s	alagnybbel
	cmp.b	#$1,d7
	bgt	AkoLo
	asl.b	#4,d7
	and.b	#$0f,(a1)
	or.b	d7,(a1)
	bra.s	AkoprintDes
alagnybbel:
	and.b	#$f0,(a1)
	or.b	d7,(a1)
AkoprintDes:
	tst.b	(a1)
	bne.s	AkoNuy
	move.b	#1,(a1)
AkoNuy:	and.b	#$1f,(a1)

	lea	L605,a0
	moveq	#0,d0
	move.b	AkoDest(pc),d0
	asl.w	#1,d0
	move.b	(a0,d0.w),Akotext3+17
	move.b	1(a0,d0.w),Akotext3+18

	move.l	#21,L636
	move.l	#akotext3,L635
	move.l	#$54*40+[$88/8],L629
	bsr	L566
	addq.w	#1,AkoPos
	cmp.w	#$9,AkoPos
	bne	AkoLo
	move.w	#0,AkoPos
	bra	AkoLo

AkoCancel:
AkoReset:
	clr.w	L649
	move.w	#$010e,L650
	BSR	L246
	CLR.B	L647
	clr.w	MyEdit
	bra	L309


AkoDoIt:MOVEQ	#0,D2
	MOVE.B	AkoDest(PC),D2
	cmp.w	l658,d2
	beq	L139
	MULU	#$1E,D2
	MOVE.L	L697(PC),A0
	LEA	-$A(A0,D2.W),A2
	move.w	#'El',(a2)+
	clr.b	(a2)+
	move.b	#'H',(a2)+
	move.b	L658+1,(a2)+
	move.b	AkoPeriods+1,(a2)+
	move.b	AkoPeriods+3,(a2)+
	move.b	AkoPeriods+5,(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	clr.l	(a2)+
	clr.w	(a2)+
	move.w	AkoLength(pc),d1
	lsr.w	#1,d1
	move.w	d1,(a2)+
	move.w	#$40,(a2)+
	move.l	#$1,(a2)+

	move.l	AkoPeriods(pc),AkkoPeriods
	move.w	AkoPeriods+4(pc),AkkoPeriods+4
	move.b	AkoDest(pc),AkkoDest
	bsr	AkoReset

AkoProdukter:
	bsr	GetMemory
	moveq	#0,d0
	move.b	akkoDest(pc),d0
	Asl.w	#2,d0
	lea	L698,A4
	LEA	(A4,D0.W),A4

	move.l	(A4),D1
	beq.s	AkoNoOld
	clr.l	(a4)
	move.l	D1,A1
	move.l	$7C(A4),D0
	CLR.L	$7C(A4)
	move.l	$04.w,a6
	jsr	-210(A6)
AkoNoOld:
	MOVEQ	#0,D2
	MOVE.w	L658,D1
	move.b	akkoDest(pc),d2
	MULU	#$1E,D1
	MULU	#$1E,D2
	MOVE.L	L697(PC),A0
	LEA	-$A(A0,D2.W),A1
	LEA	-$A(A0,D1.W),A0

	MOVEQ	#0,D0
	MOVE.W	$16(A1),D0
	add.w	d0,d0
	MOVE.L	D0,D7
	move.l	#$10002,d1
	move.l	$04.w,a6
	jsr	-198(a6)
	tst.l	d0
	BNE.S	AkokOKK
	MOVEQ	#0,D0
	MOVE.B	AkkoDest(PC),D0
	mulu	#$1e,d0
	move.l	L697(PC),a0
	LEA	-$A(a0,D0.W),A0
	clr.l	(a0)
	clr.l	4(a0)
	clr.l	8(a0)
	clr.l	$c(a0)
	clr.l	$10(a0)
	clr.w	$14(a0)
	CLR.L	$16(A0)
	CLR.L	$1A(A0)
	BRA	CopRedCan

AkokOKK:moveq	#0,d1
	move.b	AkkoDest(pc),d1
	Asl.w	#2,d1
	lea	L698,A4
	move.l	d0,(a4,d1.w)
	move.l	D7,$7C(a4,d1.w)

	MOVE.L	D0,AkoDestPoi
	move.l	d7,AkoDestLen

	MOVE.W	L658,D1
	asl.w	#2,d1
	move.l	(a4,d1.w),AkoSourcePoi
	MOVE.w	L658,D1
	MULU	#$1E,D1
	MOVE.L	L697(PC),A0
	LEA	-$A(A0,D1.W),A0
	moveq	#0,d0
	move.w	$16(a0),d0
	add.w	d0,d0
	move.l	d0,AkoSourceLen
	tst.w	$1a(a0)
	bne.s	LoopAko

	bsr	CalcAko
	move.w	#1,PrintFree

	BSR	STP
	JSR	L552
	BSR	SHOWSAMPLE
	BRA	L134

AkoLoopLength:	dc.l	0

LoopAko:move.w	$1a(a0),a3
	add.w	$1c(a0),a3
	add.w	a3,a3
	moveq	#0,d0
	move.w	$1c(a0),d0
	add.w	d0,d0
	swap	d0
	move.l	d0,AkoLoopLength

	move.l	AkosourcePoi(pc),a0
	move.l	AkodestPoi(pc),a1
	lea	workspace(pc),a2
	move.w	#$7fff,d3
	lea	CalcValues(pc),a6
	move.w	AkkoPeriods(pc),d0
	asl.w	#2,d0
	move.l	(a6,d0.w),a4
	move.w	AkkoPeriods+2(pc),d0
	asl.w	#2,d0
	move.l	(a6,d0.w),a5
	move.w	AkkoPeriods+4(pc),d0
	asl.w	#2,d0
	move.l	(a6,d0.w),a6

	cmp.l	a4,a5
	bge.s	cal3hy
	exg	a4,a5
cal3hy:	cmp.l	a5,a6
	bge.s	cal3he
	exg	a5,a6
cal3he:	cmp.l	a4,a5
	bge.s	cal3hi
	exg	a4,a5
cal3hi:
	move.l	Akodestlen(PC),D7
	moveq	#0,d4
	moveq	#0,d5
	moveq	#0,d6
	subq.l	#1,d7

CalcGnu:move.l	d4,d0
	swap	d0
	cmp.w	a3,d0
	bcs.s	NoAkoL	;blt-u
	sub.l	AkoLoopLength(pc),d4
	move.l	d4,d0
	swap	d0
NoAkoL:	move.b	(a0,d0.w),d1
	move.b	1(a0,d0.w),d2
	ext.w	d1
	ext.w	d2
	swap	d0
	lsr.w	#1,d0
	muls	d0,d2
	eor.w	d3,d0	;#$7fff
	muls	d0,d1
	add.l	d1,d2
	move.l	d2,(a2)+

	move.l	d5,d0
	swap	d0
	cmp.w	a3,d0
	bcs.s	NoAkoL2	;blt-u
	sub.l	AkoLoopLength(pc),d5
	move.l	d5,d0
	swap	d0
NoAkoL2:move.b	(a0,d0.w),d1
	move.b	1(a0,d0.w),d2
	ext.w	d1
	ext.w	d2
	swap	d0
	lsr.w	#1,d0
	muls	d0,d2
	eor.w	d3,d0	;#$7fff
	muls	d0,d1
	add.l	d1,d2
	move.l	d2,(a2)+

	move.l	d6,d0
	swap	d0
	cmp.w	a3,d0
	bcs.s	NoAkoL3	;blt-u
	sub.l	AkoLoopLength(pc),d6
	move.l	d6,d0
	swap	d0
NoAkoL3:move.b	(a0,d0.w),d1
	move.b	1(a0,d0.w),d2
	ext.w	d1
	ext.w	d2
	swap	d0
	lsr.w	#1,d0
	muls	d0,d2
	eor.w	#$7fff,d0
	muls	d0,d1
	add.l	d1,d2

	move.l	-(a2),d1
	move.l	-(a2),d0
	add.l	d0,d0
	add.l	d1,d1
	add.l	d2,d2
	add.l	d0,d1
	add.l	d1,d2
	swap	d2
	ext.l	d2
	divs	#3,d2
	move.b	d2,(a1)+
	add.l	a4,d4
	add.l	a5,d5
	add.l	a6,d6
	dbf	d7,CalcGnu

	move.w	#1,PrintFree
	BSR	STP
	JSR	L552
	BSR	SHOWSAMPLE
	BRA	L134


AkoSourcePoi:	dc.l	$50000
AkoDestPoi:	dc.l	$60000
Akosourcelen:	dc.l	0
Akodestlen:	dc.l	0
AkkoPeriods:	dc.w	0,0,0
AkkoDest:	dc.b	0
		dc.b	0
CalcValues:
	dc.l	32768,34716,36781,38968,41285,43740		;c-1
	dc.l	46341,49097,52016,55109,58386,61858
	dc.l	65536,69433,73562,77936,82570,87480		;c-2
	dc.l	92682,98193,104032,110218,116772,123715
	dc.l	131072,138866,147123,155872,165140,174960	;c-3
	dc.l	185364,196386,208064,220436,233544,247431
workspace:	dc.l	0,0,0

CalcAko:move.l	AkosourcePoi(pc),a0
	move.l	AkodestPoi(pc),a1
	lea	workspace(pc),a2
	move.w	#$7fff,d3
	lea	CalcValues(pc),a3
	move.w	AkkoPeriods(pc),d0
	asl.w	#2,d0
	move.l	(a3,d0.w),a4
	move.w	AkkoPeriods+2(pc),d0
	asl.w	#2,d0
	move.l	(a3,d0.w),a5
	move.w	AkkoPeriods+4(pc),d0
	asl.w	#2,d0
	move.l	(a3,d0.w),a6
	move.l	Akosourcelen(pc),a3
	subq.l	#1,a3

	cmp.l	a4,a5
	bge.s	cal2hy
	exg	a4,a5
cal2hy:	cmp.l	a5,a6
	bge.s	cal2he
	exg	a5,a6
cal2he:	cmp.l	a4,a5
	bge.s	cal2hi
	exg	a4,a5
cal2hi:
	move.l	Akodestlen(PC),D7
	moveq	#0,d4
	moveq	#0,d5
	moveq	#0,d6
	subq.l	#1,d7

CalcLo:	move.l	d4,d0
	swap	d0
	move.b	(a0,d0.w),d1
	move.b	1(a0,d0.w),d2
	ext.w	d1
	ext.w	d2
	swap	d0
	lsr.w	#1,d0
	muls	d0,d2
	eor.w	d3,d0	;#$7fff
	muls	d0,d1
	add.l	d1,d2
	move.l	d2,(a2)+

	move.l	d5,d0
	swap	d0
	move.b	(a0,d0.w),d1
	move.b	1(a0,d0.w),d2
	ext.w	d1
	ext.w	d2
	swap	d0
	lsr.w	#1,d0
	muls	d0,d2
	eor.w	d3,d0	;#$7fff
	muls	d0,d1
	add.l	d1,d2
	move.l	d2,(a2)+

	move.l	d6,d0
	swap	d0
	cmp.w	a3,d0
	bcc.s	calc2left	;bge-u
	move.b	(a0,d0.w),d1
	move.b	1(a0,d0.w),d2
	ext.w	d1
	ext.w	d2
	swap	d0
	lsr.w	#1,d0
	muls	d0,d2
	eor.w	d3,d0	;#$7fff
	muls	d0,d1
	add.l	d1,d2

	move.l	-(a2),d1
	move.l	-(a2),d0
	add.l	d0,d0
	add.l	d1,d1
	add.l	d2,d2
	add.l	d0,d1
	add.l	d1,d2
	swap	d2
	ext.l	d2
	divs	#3,d2
	move.b	d2,(a1)+
	add.l	a4,d4
	add.l	a5,d5
	add.l	a6,d6
	dbf	d7,CalcLo
	rts

Calc2left:
	move.l	-(a2),d2
	move.l	-(a2),a2
	bra.s	Calc2lef

Calc2Lo:move.l	d4,d0
	swap	d0
	move.b	(a0,d0.w),d1
	move.b	1(a0,d0.w),d2
	ext.w	d1
	ext.w	d2
	swap	d0
	lsr.w	#1,d0
	muls	d0,d2
	eor.w	d3,d0	;#$7fff
	muls	d0,d1
	add.l	d1,d2
	move.l	d2,a2

	move.l	d5,d0
	swap	d0
	cmp.w	a3,d0
	bcc.s	calc1left	;bge-u

	move.b	(a0,d0.w),d1
	move.b	1(a0,d0.w),d2
	ext.w	d1
	ext.w	d2
	swap	d0
	lsr.w	#1,d0
	muls	d0,d2
	eor.w	d3,d0	;#$7fff
	muls	d0,d1
	add.l	d1,d2
Calc2lef:
	add.l	a2,a2
	add.l	d2,d2
	add.l	a2,d2
	swap	d2
	ext.l	d2
	divs	#3,d2
	move.b	d2,(a1)+
	add.l	a4,d4
	add.l	a5,d5
	dbf	d7,Calc2Lo
	rts

calc1left:
	move.l	a2,d2
	bra.s	calc1lef
Calc1Lo:move.l	d4,d0
	swap	d0
	cmp.w	a3,d0
	bcc.s	calc0left	;bge-u
	move.b	(a0,d0.w),d1
	move.b	1(a0,d0.w),d2
	ext.w	d1
	ext.w	d2
	swap	d0
	lsr.w	#1,d0
	muls	d0,d2
	eor.w	d3,d0	;#$7fff
	muls	d0,d1
	add.l	d1,d2
Calc1lef:
	add.l	d2,d2
	swap	d2
	ext.l	d2
	divs	#3,d2
	move.b	d2,(a1)+
	add.l	a4,d4
	dbf	d7,Calc1Lo
	rts

Calc0left:
	moveq	#0,d0
Calc0:	move.b	d0,(a1)+
	dbf	d7,Calc0
	rts


*************************************
*************************************

L16:	move.l	L518,a0
	cmp.w	#$00aa,$0002(a0)
	bne.s	L17
	bsr	L134
L17:	bsr	L124
	lea	L707,a0
	lea	L706,a1
	moveq	#$16,d7
L18:	clr.w	(a0)+
	clr.w	(a1)+
	dbf	d7,L18
	bsr	L121
	move.w	#$0001,L713
	BSR	L530
	RTS
L18_8:	bra	L530

EXITDISKOP:
	move.l	L518,a0
	cmp.w	#$00aa,$0002(a0)
	bne.s	F17
	bsr	L134
F17:	bsr	L124
	lea	L707,a0
	lea	L706,a1
	moveq	#$16,d7
F18:	clr.w	(a0)+
	clr.w	(a1)+
	dbf	d7,F18
	bsr	L121
	LEA	MDR,A0
	BSR	L117
	move.w	#1,L713
	BSR	L37
	BSR	L530
	RTS

L18_2:	CMP.W	#1,L713
	BNE.S	L18_8
	TST.W	L726
	BNE.S	L18_8
	TST.W	NTREMOVED
	BEQ.S	L18_8
	MOVEQ	#$28,D5
	MOVEQ	#$7E,D6
	LEA	L706,A0
	LEA	L707,A1
	LEA	L25,A2
	MOVE.L	L628,A3
	ADD.W	#$7B8,A3
	MOVEQ	#$16,D7
L18_B:	MOVE.W	(A0)+,D0
	CMP.W	#$24,D0
	BLT.S	L18_3
	MOVE.W	#$24,D0
L18_3:	MOVE.W	(A1)+,D1
	CMP.W	D0,D1
	BEQ.S	L18_9
	BLT.S	L18_A
	SUB.W	D0,D1
	SUBQ.W	#1,D1
	LSL.W	#1,D0
	MOVE.W	(A2,D0.W),D0
L18_4:	CLR.B	(A3,D0.W)
	SUB.W	D5,D0
	DBF	D1,L18_4
	BRA.S	L18_9

L18_A:	SUB.W	D1,D0
	SUBQ.W	#1,D0
	LSL.W	#1,D1
	MOVE.W	(A2,D1.W),D1
L18_5:	MOVE.B	D6,(A3,D1.W)
	SUB.W	D5,D1
	DBF	D0,L18_5
L18_9:	ADDQ.W	#1,A3
	DBF	D7,L18_B
	LEA	L706,A0
	LEA	L707,A1
	MOVEQ	#$16,D7
L18_7:	MOVE.W	(A0),D0
	MOVE.W	D0,(A1)+
	BEQ.S	L18_6
	SUBQ.W	#1,D0
L18_6:	MOVE.W	D0,(A0)+
	DBF	D7,L18_7
	RTS

L19:	movem.l	d0-d3/a0,-(a7)
	moveq	#0,d2
	move.B	$03(a6),d2
	bra.s	L20

L19_2:	MOVEM.L	D0-D3/A0,-(A7)
	MOVEQ	#0,D2
	MOVE.B	$13(A6),D2

L20:	bsr	L51
	beq.s	L24
	Asl.w	#$8,d2
	divu	#$02aa,d2
	move.w	d2,d3
	lsr.w	#1,d3
	lea	L706,a0
	sub.w	#$71,d0
	move.w	#$02e7,d1
	sub.w	d0,d1
	mulu	d1,d1
	divu	#$6205,d1
	move.w	d1,d0
	cmp.w	#$2e,d0
	blt.s	L21
	moveq	#$2d,d0
L21:	lsl.w	#1,d0
	add.w	d2,(a0,d0.w)
	cmp.w	#$24,(a0,d0.w)
	blt.s	L22
	move.w	#$24,(a0,d0.w)
L22:	tst.w	d0
	beq.s	L23
	add.w	d3,-2(a0,d0.w)
	cmp.w	#$24,-2(a0,d0.w)
	blt.s	L23
	move.w	#$24,-2(a0,d0.w)
L23:	cmp.w	#$2c,d0
	beq.s	L24
	add.w	d3,2(a0,d0.w)
	cmp.w	#$24,2(a0,d0.w)
	blt.s	L24
	move.w	#$24,2(a0,d0.w)
L24:	movem.l	(a7)+,d0-d3/a0
	rts

L25:	dc.W $0730,$0708,$06e0,$06b8,$0690,$0668,$0640,$0618,$05f0
	dc.W $05c8,$05a0,$0578,$0550,$0528,$0500,$04d8,$04b0,$0488
	dc.W $0460,$0438,$0410,$03e8,$03c0,$0398,$0370,$0348,$0320
	dc.W $02f8,$02d0,$02a8,$0280,$0258,$0230,$0208,$01e0,$01b8
	dc.W $0190,$0168,$0140,$0118,$00f0

L26:	move.w	L667,d0

	cmp.w	#$130,d0
	bge	L32
	cmp.w	#$120,d0
	bge	L31
	cmp.w	#$110,d0
	bge.s	L30
	CMP.w	#$100,d0
	bge.s	L29
L28:	rts

L29:	lea	L42(pc),a0
	bra.s	L33
L30:	lea	L44(pc),a0
	bra.s	L33
L31:	lea	L46(pc),a0
	bra.s	L33
L32:	lea	L48(pc),a0

L33:	btst	#6,$bfe001
	beq.s	L33
	CLR.W	L647

	LEA	L759,A1
	moveq	#0,d0
	move.w	$0002(a0),d0
	add.l	d0,a1
	eor.w	#$0001,(a0)
	tst.w	(a0)
	bne.s	L34
	clr.w	$0004(a0)
	BSR	VOIOFF
	bra.s	L35

L34:	BSR	VOION
L35:	clr.w	d0
	move.w	L48(PC),d0
	lsl.b	#1,d0
	or.w	L46(PC),d0
	lsl.b	#1,d0
	or.w	L44(PC),d0
	lsl.b	#1,d0
	or.w	L42(PC),d0
	move.w	d0,L50
	MOVE.W	SACHA,D1
	AND.W	D0,D1
	BNE.S	NOCLRSAD
	CLR.W	SAPER
NOCLRSAD:
	EOR.W	#$F,D0
	MOVE.W	D0,$DFF096
WAII:	move.w	#$8000,d0
L36:	dbf	d0,L36
	bsr	L504
	BRA	L504

L37:	lea	L42(pc),a0
	bsr.s	L38
	lea	L44(pc),a0
	bsr.s	L38
	lea	L46(pc),a0
	bsr.s	L38
	lea	L48(pc),a0
L38:	lea	L759,a1
	moveq	#$00,d0
	move.w	$0002(a0),d0
	add.l	d0,a1
	tst.w	(a0)
	bne	VOION
	BRA	VOIOFF

L40:	moveq	#$05,d4
L41:	move.b	(a0),(a1)
	move.b	$01(a0),$0001(a1)
	move.b	$02(a0),$0002(a1)
	move.b	$30(a0),$2800(a1)
	move.b	$31(a0),$2801(a1)
	move.b	$32(a0),$2802(a1)
	addq.l	#$4,a0
	add.l	#$28,a1
	dbf	d4,L41
	rts

VOION:	MOVE.W	L713,D0
	BEQ.S	VOK
	CMP.W	#1,L713
	BNE	ALFRTS
VOK:	MOVE.W	#$FFFE,(A1)
	MOVE.W	#$FFFF,$2800(A1)
	MOVE.W	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	.L41_6
	ADDQ.B	#1,(A2)
.L41_6:	RTS
L42:	dc.W	$0001,72
L43:	dc.W	$0000
L44:	dc.W	$0001,74
L45:	dc.W	$0000
L46:	dc.W	$0001,76
L47:	dc.W	$0000
L48:	dc.W	$0001,78
L49:	blk.b	2,0
L49_2:	BLK.B	6,0
L49_3:	BLK.B	6,0
L49_4:	BLK.B	6,0
L49_5:	BLK.B	6,0

L50:	DC.B	$00,$0F
L50_2:	dc.b	$00,$00,$01,$02,$02,$03,$04,$05,$05,$06,$07
	dc.b	$08,$08,$09,$0a,$0b,$0b,$0c,$0d,$0e,$0e,$0f,$10
	dc.b	$11,$11,$12,$13,$14,$14,$15,$16,$17,$17,$18,$19
	dc.b	$1a,$1a,$1b,$1c,$1d,$1d,$1e,$1f,$20,$20,$21,$22
	dc.b	$23,$23,$24,$25,$26,$26,$27,$28,$29,$29,$2a,$2b
	dc.b	$2c,$2c,$2d,$2e,$2f,$2f,$00

L51:	movem.l	d0-d3/a0,-(a7)
	lsl.w	#$8,d2
	divu	#$280,d2
	cmp.l	#$dff0a0,a5
	bne.s	.L52
	tst.w	L42
	beq.s	.L56
	cmp.w	L43,d2
	blt.s	.L52
	move.w	d2,L43
.L52:	cmp.l	#$dff0b0,a5
	bne.s	.L53
	tst.w	L44
	beq.s	.L56
	cmp.w	L45,d2
	blt.s	.L53
	move.w	d2,L45
.L53:	cmp.l	#$dff0c0,a5
	bne.s	.L54
	tst.w	L46
	beq.s	.L56
	cmp.w	L47,d2
	blt.s	.L54
	move.w	d2,L47
.L54:	cmp.l	#$dff0d0,a5
	bne.s	.L55
	tst.w	L48
	beq.s	.L56
	cmp.w	L49,d2
	blt.s	.L55
	move.w	d2,L49
.L55:	movem.l	(a7)+,d0-d3/a0
	moveq	#1,d4
	rts

.L56:	movem.l	(a7)+,d0-d3/a0
	moveq	#0,d4
	rts

L57:	bsr	L124
	CMP.L	#'edit',L632
	BNE.S	.L57_1
	CLR.L	L632
	BSR	L134
.L57_1:	CMP.L	#'edit',L631
	BNE.S	.L57_11
	CLR.L	L631
	BSR	L134
.L57_11:move.w	#$0003,L713
	bsr	L121
	LEA	MDR,A0
	bsr	L117
	clr.w	L708
	bsr	L124
	BSR	PRINTMODDIR
	MOVE.W	#$8000,D0
.L57_2:	DBF	D0,.L57_2
	bra	L534

PRINTMODDIR:
	CMP.W	#$3,L713
	BNE	P_RTS
	MOVE.L	#L82,L635
	MOVE.L	#[$25*40]+24,L629
	MOVE.L	#$F,L636
	BRA	L562

L58:	movem.w	L667,d0-d1
	sub.w	#$0078,d0
	sub.w	#$002c,d1
	cmp.w	#$0003,L713
	beq.s	L59
	rts

L59:	cmp.w	#$00bd,d0
	blt	L76
	cmp.w	#$000c,d1
	blt	L72
	cmp.w	#$002d,d1
	blt	EXITDISKOP
	bra	L74


SELECTDRIVE:
	bsr	L124
	BSR	L134
	BSR	SEL129
	bsr	L124
	BSR	WAII
SEL127:	BTST	#2,$DFF016
	BEQ	SELERR
	btst	#6,$bfe001
	bne.s	SEL127
	movem.w	L665,d0-d1
	ADD.W	D5,D0
	cmp.w	#$F0,d0
	blt.s	SELERR
	cmp.w	#$137,d0
	bgt.s	SELERR
	cmp.w	#$2,d1
	blt.s	SELERR
	cmp.w	#$23,d1
	bgt.s	SELERR
	CMP.W	#$115,D0
	BLT.S	NEGG
	CMP.W	#$133,D0
	BGE.S	NEGG
	CMP.W	#$7,D1
	BLT.S	NEGG
	CMP.W	#$11,D1
	BLE.S	SELDF2
NEGG:	cmp.w	#$15,d1
	blt.s	SEL127
	cmp.w	#$1F,d1
	bGt.s	SEL127
	CMP.W	#$F5,D0
	BLT.S	SEL127
	CMP.W	#$113,D0
	BLT.S	SELDF0
	CMP.W	#$117,D0
	BLT.S	SEL127
	CMP.W	#$132,D0
	BGT.S	SEL127

	bsr.s	SEL129
	BSR	L124
	BSR	WAII
	moveq	#1,d0
	rts
SELERR:	BSR.S	SEL129
	BSR	WAII
	MOVEQ	#-1,D0
	RTS
SELDF0:	bsr.s	SEL129
	BSR	L124
	BSR	WAII
	moveq	#0,d0
	rts
SELDF2:	bsr.s	SEL129
	BSR	L124
	BSR	WAII
	moveq	#$2,d0
	rts

SEL129:	lea	L759+[2*40]+[$F0/8],a0
	MOVE.L	L628,A2
	ADD.L	#[2*40]+[$F0/8],A2
	lea	SER,a1
	MOVE.W	D5,D6
	LSR.W	#$3,D6
	NEG.W	D6
	LEA	(A0,D6.W),A0
	LEA	(A2,D6.W),A2
	moveq	#$21,d0
SEL130:	moveq	#$08,d1
SEL131:	move.b	$2800(a0),d2
	move.b	$154(a1),$2800(a0)
	move.b	d2,$154(a1)
	move.b	(a0),d2
	move.b	(a1),(a0)+
	move.b	d2,(a1)+
	CLR.B	(A2)+
	dbf	d1,SEL131
	add.l	#$1F,a0
	ADD.L	#$1F,A2
	addq.l	#1,a1
	dbf	d0,SEL130

	move.w	#$5000,d7
SEL126:	dbf	d7,SEL126
	rts


GOBACKNOW:
	MOVE.W	#$5000,D7
GOBACKL:DBF	D7,GOBACKL
	BRA	L309

LOADSAMPLE:
	BSR	L308
	bsr	L124
	CLR.B	L647
	clr.w	L708
	bsr	CLEARLOW
	MOVEQ	#0,D5
	BSR	SELECTDRIVE
	TST.L	D0
	BMI.S	GOBACKNOW
	ADD.B	#$30,D0
	MOVE.B	D0,LOADSAMDEVNO

	MOVE.W	#$2,CHECKMOD
	lea	LOADSAMDIR(PC),a4
	lea	L79(pc),a5
	bsr	L85
	beq.s	LSAM1

	MOVE.W	L711,D0
	MOVE.W	#'ST',D1
	AND.W	#$1F1F,D0
	AND.W	#$1F1F,D1
	CMP.W	D0,D1
	BNE.S	LSAMERR

	LEA	LOADSAMDISKNAME,A1
	MOVE.L	A1,A0
	MOVEQ	#$F,D7
.LSAMLOP:CLR.B	(A1)+
	DBF	D7,.LSAMLOP

	MOVE.L	A0,A1
	LEA	L711,A0
	MOVEQ	#$F,D7
.LSAML2P:MOVE.B	(A0)+,D0
	BEQ.S	.LSAMCON
	MOVE.B	D0,(A1)+
	DBF	D7,.LSAML2P

.LSAMCON:MOVE.B	#':',(A1)+
	bsr	L92
	bsr	L88
	beq.S	LSAM1
LSAMERR:BSR	L92
	BRA	L139

LSAM1:	move.w	L80,d0
	move.w	#$0005,L708
	bsr	L107
	bra	L134

LOADTHESAMPLE:
	bsr	L308
	tst.w	L658
	beq	L9366
	clr.b	L647

	move.w	L658,d0
	mulu	#$1e,d0
	move.l	L697(PC),a1
	lea	-$a(a1,d0.w),a1
	move.l	a1,a2

	LEA	LOADSAMPLENAMEPOJ(PC),A4
	MOVEQ	#$1D,D0
LSAML5:	CLR.B	(A1)+
	CLR.B	(A4)+
	DBF	D0,LSAML5
	MOVE.L	A2,A1

	moveq	#$14,d1
	LEA	LOADSAMDISKNAME,A0
	LEA	LOADSAMPLENAMEPOJ(PC),A4
LSAML3P:move.b	(a0)+,D0
	BEQ.S	GOAHEAD
	MOVE.B	D0,(a1)+
	MOVE.B	D0,(A4)+
	dbf	d1,LSAML3P
GOAHEAD:MOVE.L	LOADSAMPLENAMEPOI,A0
	MOVE.L	A0,A3
LSAML4P:move.b	(a0)+,D0
	BEQ.S	LSAM8
	MOVE.B	D0,(a1)+
	MOVE.B	D0,(A4)+
	dbf	d1,LSAML4P
LSAM8:	MOVE.B	(A0)+,(A4)+
	MOVE.B	(A0)+,(A4)+
	MOVE.B	(A0)+,(A4)+
	MOVE.B	(A0)+,(A4)+
	MOVE.B	(A0)+,(A4)+
	MOVE.W	$1A(A3),D0
	LSR.W	#1,D0
	MOVE.W	D0,$16(A2)
	MOVE.W	#$40,$18(A2)
	CLR.W	$1A(A2)
	MOVE.W	#1,$1C(A2)

	MOVE.B	#1,LOADTHESAMPLEFLAG
	bsr	L334
	CLR.B	LOADTHESAMPLEFLAG
L9366:	jsr	L552
	bra	L309




L60:	bsr	L124
	clr.w	L708
	bsr	CLEARLOW
	CLR.W	CHECKMOD
	lea	L81(pc),a4
	lea	L79(pc),a5
	bsr	L85
	beq.s	L61
	bsr	L92
	bsr	L88
	beq.s	L61
	BRA	L139

L61:	move.w	L80,d0
	move.w	#$0001,L708
	bsr	L107
	bra	L134

L62:	BSR	L308
	bsr	L138
	MOVEQ	#0,D0
	bsr	L125
	bne	L139
	bsr	CLEARLOW
	bsr	L363
	clr.w	L708
	bsr	L368
	bra	L134

L64:	bsr	L124
	clr.w	L708
	MOVE.L	L518,A4
	CMP.W	#$AA,2(A4)
	BEQ.S	L64_2
	BSR	L308
L64_2:	bsr	CLEARLOW
	CLR.W	CHECKMOD
	lea	L81(pc),a4
	lea	L79(pc),a5
	bsr	L85
	beq.s	L65
	bsr	L92
	bsr	L88
	beq.s	L65
	BRA	L139
L65:	move.w	L80,d0
	move.w	#$0002,L708
	bsr	L107
	bra	L133

;L66:	bsr	L124	;delete mod
;	clr.w	L708
;	MOVE.L	L518,A4
;	CMP.W	#$AA,2(A4)
;	BEQ.S	L66_2
;	BSR	L308
;L66_2:	bsr	CLEARLOW
;	MOVE.W	#1,CHECKMOD
;	lea	L82(pc),a4
;	lea	L79(pc),a5
;	bsr	L85
;	beq.s	L67
;	bsr	L92
;	bsr	L88
;	beq.s	L67
;	BRA	L139

;L67:	move.w	L80,d0
;	move.w	#$0004,L708
;	bsr	L107
;	bra	L133

L68:	bsr	L124
	clr.w	L708
	bsr	CLEARLOW
	MOVE.W	#1,CHECKMOD
	lea	L82(pc),a4
	lea	L79(pc),a5
	bsr	L85
	beq.s	L69
	bsr	L92
	bsr	L88
	beq.s	L69
	BRA	L139

L69:	move.w	L80,d0
	move.w	#$0003,L708
	bsr	L107
	bra	L134

;L70:	bsr	L138
;	MOVEQ	#0,D0
;	CLR.W	L708
;	bsr	L125
;	bne	L139
;	bsr	L439
;	bra	L134

L72:	tst.w	L708
	beq.s	L73
	lea	L79(pc),a5
	move.w	L80,d0
	beq.s	L73
	subq.w	#1,d0
	bsr	L107
L73:	CLR.W	MOVEDISKLIST
	rts

L74:	tst.w	L708
	beq.s	L75
	lea	L79(pc),a5
	move.w	L80,d0
	addq.w	#1,d0
	move.w	$0010(a5),d1
	subq.w	#$7,d1
	cmp.w	d1,d0
	bgt.s	L75
	bsr	L107
L75:	CLR.W	MOVEDISKLIST
	rts

L76:	MOVE.W	#1,PRINTFREE
	tst.w	L708
	beq	L78
	cmp.w	#$0003,d1
	blt	L78
	cmp.w	#$0032,d1
	bgt	L78
	subq.w	#$3,d1
	and.l	#$ffff,d1
	divu	#$0006,d1
	lea	L79(pc),a5
	move.w	L80,d0
	add.w	d1,d0
	cmp.w	$0010(a5),d0
	bge.s	L78
	MOVE.W	D0,DELETENO
	mulu	#$001c,d0
	add.l	(a5),d0
	move.l	d0,a0
	MOVE.L	A0,LOADSAMPLENAMEPOI
	move.w	$001a(a5),d0
	lea	L691,a1
	subq.w	#1,d0
L77:	move.b	(a0)+,(a1)+
	dbf	d0,L77
	cmp.w	#$0002,L708
	beq	L340
	cmp.w	#$0003,L708
	beq	L431
	cmp.w	#$0004,L708
	beq	AlfRts		;L343-delete mod
	CMP.W	#$5,L708
	BEQ	LOADTHESAMPLE
	CMP.W	#$6,L708
	BEQ	AlfRts		;DELETETHESAMPLE
	bra	L346	;LSONG

L78:	rts

L79:	blk.b	18,$00
	dc.l	L691
	dc.l	L346
	dc.b	$00,$1c
L80:	dc.b	$00,$00
L81:	DC.B	'Music:',0,0
L82:	DC.B	'st-00:modules/',0,0
	BLK.B	$18,0
	EVEN

CLEARTIMER:
	CLR.B	TIM1
	MOVE.B	#$30,TIM2
	MOVE.B	#$30,TIM3
	MOVE.B	#$30,TIM4
	MOVE.B	#$30,TIM5
	MOVE.L	#TIM5,L635
	MOVE.L	#[131*40]+22,L629
	MOVE.L	#5,L636
	JMP	L562

L83:	btst	#6,$bfe001
	beq.s	L83

	bsr	L363
	bsr	L136

	BSR.S	CLEARTIMER
	clr.w	L699
	clr.w	L684
	move.l	#-1,L679
	clr.l	L692
	clr.w	L652
	bsr	L507
	moveq	#$00,d1
	move.w	L587,d1
	move.l	L693,d0
	cmp.l	d1,d0
	bpl.S	L455
	move.l	#'patp',L632
	jmp	music_init

L455:	CLR.L	L693
	move.l	#'patp',L632
	jmp	music_init

SONGREC:btst	#$06,$bfe001
	beq.s	SONGREC
	bsr	L363
	CLR.L	L692
	CLR.L	L695
	CLR.W	L652
	BSR	L506
	bsr	L507

	bsr	L137
	move.l	#'edit',L631
	BSR	CLEARTIMER
	clr.w	L699
	clr.w	L684
	move.l	#-1,L679
	moveq	#0,d1
	move.w	L587,d1
	move.l	L693,d0
	cmp.l	d1,d0
	bpl.S	SONGRES
	move.l	#'patp',L632
	rts
SONGRES:CLR.L	L693
	move.l	#'patp',L632
	RTS


L84:	btst	#6,$bfe001
	beq.s	L84
	CLR.L	L692
	CLR.L	L695
	CLR.W	L652
	BSR	L506
	BSR	L363
	bsr	L507
	bsr	L137
	move.l	#'edit',L631
	bra	L457


L85:	MOVE.W	#1,PRINTFREE
	move.l	L686,a6
	move.l	a4,d1
	MOVE.L	A4,OLDDIRNAM
	moveq	#-2,d2
	jsr	-$0054(a6)
	move.l	d0,L709
	beq	L87
	move.l	L709,d1
	move.l	#L710,d2
	jsr	-$0066(a6)
	tst.l	d0
	beq.s	L87
	lea	L710,a0
	move.l	$0084(a0),d0
	cmp.l	$0004(a5),d0
	bne.s	L86
	move.l	$0088(a0),d0
	cmp.l	$0008(a5),d0
	bne.s	L86
	move.l	$008c(a0),d0
	cmp.l	$000c(a5),d0
	bne.s	L86
	MOVE.W	CHECKMOD,D0
	CMP.W	DIRLISTCHECK,D0
	BNE.S	L86
	move.l	L709,d1
	jsr	-$005a(a6)
	moveq	#$00,d0
	rts

L86:	move.l	$0084(a0),$0004(a5)
	move.l	$0088(a0),$0008(a5)
	move.l	$008c(a0),$000c(a5)
	MOVE.W	CHECKMOD,DIRLISTCHECK
	move.l	L709,d1
	jsr	-$005a(a6)
	moveq	#-$01,d0
	rts

L87:	clr.l	$0004(a5)
	moveq	#-$01,d0
	rts

L88:	bsr	L308
	bsr	L135
	clr.w	L80
	move.l	L686,a6
	move.l	a4,d1
	moveq	#-2,d2
	jsr	-$0054(a6)
	move.l	d0,L709
	beq.s	L91

	MOVE.L	L709,D1
	MOVE.L	#DISKSPSHIT,D2
	JSR	-$72(A6)
	MOVE.L	DISKSPSHIT+12,D0
	SUB.L	DISKSPSHIT+16,D0
	MOVE.W	D0,DISKBLOCKSFREE

	move.l	L709,d1
	move.l	#L710,d2
	jsr	-$0066(a6)
	tst.l	d0
	beq.s	L91
L89:	move.l	L709,d1
	move.l	#L710,d2
	jsr	-$006c(a6)
	tst.l	d0
	beq.s	L90
	cmpi.b	#$2e,L712
	bsr.s	L93
	bra.s	L89

L90:	move.l	L709,d1
	jsr	-$005a(a6)
	bsr	L309
	moveq	#$00,d0
	rts

L91:	bsr	L309
	moveq	#-$01,d0
	rts

L92:	clr.w	$0010(a5)
	rts

L93:	MOVE.W	CHECKMOD,D0
	BEQ	NOCHECK
	CMP.W	#$2,D0
	BNE.S	CHECKIT

	CMP.L	#'.fas',L711	;.fastdir & .info, length<>0 + < $14
	BNE.S	INFT
	CMP.L	#'tdir',L711+4
	BEQ	P_RTS
INFT:	LEA	L711,A0
	MOVEQ	#0,D0
INFOLOP:ADDQ.W	#1,D0
	TST.B	(A0)+
	BNE.S	INFOLOP
	CMP.B	#$14,D0
	BGE	P_RTS
	CMP.B	#'.',-6(A0)
	BNE.S	NEJ
	CMP.B	#'i',-5(A0)
	BNE.S	NEJ
	CMP.B	#'n',-4(A0)
	BNE.S	NEJ
	CMP.B	#'f',-3(A0)
	BNE.S	NEJ
	CMP.B	#'o',-2(A0)
	BEQ	P_RTS
NEJ:	MOVE.L	L711+$74,D0
	BEQ	P_RTS
	CMP.L	#$FFFE,D0
	BLE.S	ANOLEN
	MOVE.L	#$FFFE,L711+$74
ANOLEN:	BRA.S	NOCHECK

CHECKIT:CMP.L	#'mod.',L711
	BEQ.S	NOCHECK
	CMP.L	#'Mod.',L711
	BEQ.S	NOCHECK
	CMP.L	#'MOD.',L711
	BNE	P_RTS

NOCHECK:LEA	L711,A0
	MOVEQ	#0,D0
I2FOLOP:TST.B	(A0)+
	BNE.S	I2FOLOP
	CMP.B	#'.',-4(A0)
	BNE.S	N2J
	CMP.B	#'N',-3(A0)
	BNE.S	N2J
	CMP.B	#'T',-2(A0)
	BEQ	P_RTS

N2J:	move.w	$0010(a5),d6
	beq.s	L102
	subq.w	#1,d6
	lea	L711,a0
	move.l	(a5),a1
L94:	moveq	#$00,d2
	moveq	#$00,d3
L95:	move.b	(a0,d2.w),d0
	beq.s	L100
	cmp.b	#$60,d0
	blt.s	L96
	sub.b	#$20,d0
L96:	move.b	(a1,d3.w),d1
	beq.s	L98
	cmp.b	#$60,d1
	blt.s	L97
	sub.b	#$20,d1
L97:	cmp.b	d0,d1
	bgt.s	L100
	beq.s	L99
L98:	add.L	#$1c,a1
	dbf	d6,L94
	move.l	(a5),a1
	move.w	$10(a5),d0
	mulu	#$1c,d0
	add.w	d0,a1
	bra.s	L103

L99:	addq.w	#1,d2
	addq.w	#1,d3
	bra.s	L95

L100:	move.l	(a5),a2
	move.w	$10(a5),d0
	mulu	#$1c,d0
	add.L	d0,a2
	move.l	a2,a3
	add.L	#$1c,a3
L101:	move.w	-(a2),-(a3)
	cmp.l	a2,a1
	bne.s	L101
	bra.s	L103

L102:	move.l	(a5),a1
L103:	lea	L711,a0
	move.l	a1,a3
	moveq	#$1b,d0
L104:	clr.b	(a3)+
	dbf	d0,L104
	moveq	#$1b,d0
L105:	move.b	(a0)+,d1
	move.b	d1,(a1)+
	tst.b	d1
	beq.s	L106
	dbf	d0,L105
L106:	CLR.B	-5(A3)
	MOVE.L	L711+$74,-4(A3)
	addq.w	#1,$10(a5)
	rts

L107:	move.w	d0,-(a7)
	bsr	CLEARLOW
	move.w	(a7)+,d0
	move.w	d0,L80

	MOVE.W	$10(A5),D1
	SUB.W	D0,D1
	CMP.W	#$8,D1
	BGE	NOSPAC

	MOVEM.L	D0-D7/A0-A6,-(A7)
	MOVE.L	#[$2F*40]+16+[$F0*7]+1,L629
	MOVE.W	DISKBLOCKSFREE,D1
	MULU	#$1C8,D1
	MOVE.L	D1,D6
	CLR.W	D0
	MOVE.L	D1,D0
	SWAP	D0
	ASL.W	#1,D0
	LEA	L606,A0
	MOVE.B	(A0,D0.W),L655
	CLR.B	L656
	MOVE.L	#L655,L635
	MOVE.L	#1,L636
	BSR	L562
	MOVE.W	D6,L655
	BSR	L561
	MOVE.L	#BYTESFRE,L635
	MOVE.L	#12,L636
	BSR	L562
	MOVEM.L	(A7)+,D0-D7/A0-A6

NOSPAC:	tst.w	$0010(a5)
	beq	L110
	move.l	#[$2F*40]+16,a6
	move.l	a6,L629
	move.l	(a5),d6
	mulu	#$001c,d0
	add.l	d0,d6
	move.w	$0010(a5),d0
	sub.w	L80,d0
	cmp.w	#$0008,d0
	bge.s	L108
	subq.w	#1,d0
	move.w	d0,d7
	bra.s	L109

BYTESFRE:
	DC.B	' BYTES FREE '

L108:	moveq	#$07,d7
L109:	CMP.W	#$3,L708	;PRINT MODDIR
	BEQ.L	L110_2
	CMP.W	#$4,L708
	BEQ.L	L110_2
	CMP.W	#$5,L708	;PRINT LSAMDIR
	BEQ	L110_7
	CMP.W	#$6,L708
	BEQ	L110_7

L109_2:	move.l	d6,L635		;TuneDIRLPRINT
	move.l	a6,L629
	move.l	#$11,L636
	bsr	L566
	MOVE.L	D6,A0
	CLR.W	D0
	MOVE.B	$19(A0),D0
	ASL.W	#1,D0
	LEA	L606,A0
	MOVE.B	(A0,D0.W),L655
	CLR.B	L656
	MOVE.L	#L655,L635
	MOVEQ	#1,D0
	MOVE.L	D0,L636
	BSR	L562
	MOVE.L	D6,A0
	MOVE.W	$1A(A0),L655
	BSR	L561
	add.l	#$1c,d6
	add.l	#$f0,a6
	dbf	d7,L109_2
L110:	rts

L110_2:	ADDQ.L	#$4,D6
L110_3:	move.l	d6,L635		;MODULEDIRLISTPRINT
	move.l	a6,L629
	move.l	#$11,L636
	bsr	L566
	MOVE.L	D6,A0
	CLR.W	D0
	MOVE.B	$15(A0),D0
	ASL.W	#1,D0
	LEA	L606,A0
	MOVE.B	(A0,D0.W),L655
	CLR.B	L656
	MOVE.L	#L655,L635
	MOVEQ	#1,D0
	MOVE.L	D0,L636
	BSR	L562
	MOVE.L	D6,A0
	MOVE.W	$16(A0),L655
	BSR	L561
	addi.l	#$1c,d6
	add.l	#$f0,a6
	dbf	d7,L110_3
	RTS

L110_7:	move.l	d6,L635		;LSAMDIRLPRINT
	move.l	a6,L629
	move.l	#$12,L636
	bsr	L566
	MOVE.L	D6,A0
	MOVE.W	$1A(A0),L655
	BSR	L561
	add.l	#$1c,d6
	add.l	#$f0,a6
	dbf	d7,L110_7
	RTS

L111:	move.w	#$0091,d0
	bsr	L132
	lea	L761,a1
	lea	L611,a0
	moveq	#$01,d7
L112:	moveq	#$2B,d6
L113:	moveq	#$18,d5
L114:	move.b	(a0)+,(a1)+
	dbf	d5,L114
	addq.l	#1,a0
	add.l	#$f,a1
	dbf	d6,L113
	add.l	#$1f68+[11*40],a1
	dbf	d7,L112
	BRA	L37

L117:	move.w	#$0091,d0
	bsr	L132
	lea	L760-1,a1
	moveq	#$62,d6
L119:	moveq	#$C,d5
L120:	MOVE.W	$A0E(A0),D2
	MOVE.W	$2800(A1),$A0E(A0)
	MOVE.W	D2,$2800(A1)
	move.W	(a0),D2
	MOVE.W	(a1),(A0)+
	MOVE.W	D2,(A1)+
	dbf	d5,L120
	add.l	#$E,a1
	dbf	d6,L119
	rts

L121:	move.w	#$0091,d0
	bsr	L132
	move.l	L628,a1
	add.l	#$f,a1
	moveq	#$63,d6
L122:	moveq	#$18,d5
L123:	clr.b	(a1)+
	dbf	d5,L123
	add.l	#$f,a1
	dbf	d6,L122
	MOVE.B	#-1,PRTED
	rts

CLEARLOW:
	CMP.W	#$5,L713
	BEQ	RRTS
	move.w	#$0091,d0
	bsr	L132
	move.l	L628,a1
	add.l	#[$2D*40]+$F,a1
	moveq	#$37,d6
CLL:	moveq	#$18,d5
CRL:	clr.b	(a1)+
	dbf	d5,CRL
	add.l	#$f,a1
	dbf	d6,CLL
	MOVE.B	#-1,PRTED
	rts

L123_2:	MOVEQ	#0,D0
	MOVE.B	$DFF00A,D0
	MOVE.W	D0,L662
	MOVE.B	$DFF00B,D0
	MOVE.W	D0,L661
	RTS

L124:	btst	#$06,$00bfe001
	beq.s	L124
	btst	#$02,$dff016
	beq.s	L124
	move.w	#$0091,d0
	bra	L132

L124LEFT:
	btst	#$06,$00bfe001
	beq.s	L124LEFT
	move.w	#$0091,d0
	bra	L132

L125:	MOVE.L	D0,D6
	bsr.s	L124
	move.w	#$4000,d7
L126:	dbf	d7,L126
	TST.L	D6
	BNE.S	NOCLY
	bsr	CLEARLOW
NOCLY:	bsr.s	L129
	bsr.s	L124
	CLR.B	L647
L127:	CMP.B	#$44,L647
	BEQ.S	L128
	CMP.B	#$45,L647
	BEQ.S	ASUNO
	btst	#$06,$bfe001
	bne.s	L127
	movem.w	L665,d0-d1
	cmp.w	#$00ab,d0
	blt.s	L127
	cmp.w	#$00fc,d0
	bgt.s	L127
	cmp.w	#$0048,d1
	blt.s	L127
	cmp.w	#$0052,d1
	bgt.s	L127
	cmp.w	#$00c5,d0
	blt.s	L128
	cmp.w	#$00ea,d0
	blt.s	L127
ASUNO:	bsr.s	L129
	CLR.B	L647
	moveq	#-1,d0
	rts

L128:	bsr.s	L129
	CLR.B	L647
	moveq	#0,d0
	rts

L129:	lea	L763,a0
	lea	L615,a1
	MOVE.L	L628,A2
	ADD.L	#L763-L759,A2
	moveq	#$26,d0
L130:	moveq	#$0c,d1
L131:	move.b	$2800(a0),d2
	move.b	$0222(a1),$2800(a0)
	move.b	d2,$0222(a1)
	move.b	(a0),d2
	move.b	(a1),(a0)+
	move.b	d2,(a1)+
	CLR.B	(A2)+
	dbf	d1,L131
	add.l	#$1b,a0
	ADD.L	#$1B,A2
	addq.l	#1,a1
	dbf	d0,L130
	rts

L132:	move.l	$dff004,d1
	lsr.l	#$8,d1
	and.w	#$01ff,d1
	cmp.w	d1,d0
	bne.s	L132
	rts

L133:	move.l	L518,a0
	move.w	#$00aa,$0002(a0)
	move.w	#$0077,$0006(a0)
	move.w	#$0044,$000a(a0)
	rts

L134:	move.l	L518,a0
	move.w	#$0aaa,$0002(a0)
	move.w	#$0777,$0006(a0)
	move.w	#$0444,$000a(a0)
	rts

L135:	move.l	L518,a0
	move.w	#$0A0,$0002(a0)
	move.w	#$070,$0006(a0)
	move.w	#$040,$000a(a0)
	rts

L136:	move.l	L518,a0
	move.w	#$ba0,$0002(a0)
	move.w	#$970,$0006(a0)
	move.w	#$740,$000a(a0)
	rts

L137:	move.l	L518,a0
	move.w	#$05b,$0002(a0)
	move.w	#$049,$0006(a0)
	move.w	#$006,$000a(a0)
	rts

L138:	move.l	L518,a0
	move.w	#$a5a,$0002(a0)
	move.w	#$727,$0006(a0)
	move.w	#$404,$000a(a0)
	rts

L139:	MOVE.W	#1,PRINTFREE
	move.l	L518,a0
	move.w	#$0c00,$0002(a0)
	move.w	#$0900,$0006(a0)
	move.w	#$0700,$000a(a0)
	moveq	#$0f,d1
L140:	bsr	L504
	dbf	d1,L140
	bra	L134

;**** PRINTRUT

LOADSAMDIR:	DC.B	'DF1:',$00,$00
LOADSAMDEVNO=LOADSAMDIR+2

;*** END OF PRINTR

L141:	cmp.b	#$5f,L647
	bne	L143
GOPLST:	MOVE.W	L713,D0
	cmp.w	#3,D0
	beq	L143
	CMP.W	#5,D0
	BEQ	L143
	CMP.W	#6,D0
	BEQ.S	L143
	clr.W	L647
	tst.w	L726
	beq.s	L142
EXITPLST:
	BSR	L124
	MOVE.W	#1,L713
	bsr	L121
	bsr	L144
	bsr	L16
	BSR	L37
	not.w	L726
	MOVE.W	#$3333,D0
GOPLOP:	DBF	D0,GOPLOP
	RTS

L142:	MOVE.W	#$4,L713
	not.w	L726
	BSR	L124
	bsr	L121
	bsr	L144
	MOVE.L	PRINTPLSTSOUND1,-(A7)
	MOVE.W	FOUNDPOS,-(A7)
	BSR	SEARCHRUT
	MOVE.W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1,D7
SHOWALL:
	MOVE.W	L722,FOUNDPLST
	MOVE.L	L720,FOUNDPLSTL
	CLR.W	FOUNDPOS
	CLR.L	PRINTPLSTSOUND1
	RTS

PRINTSEARCH:
	RTS

PRINTPLST:
	TST.W	L726
	BEQ	L143
	MOVE.W	FOUNDPLST,L655
	MOVE.L	#[$4*40]+$19,L629
	BSR	L556
	MOVE.L	PRINTPLSTSOUND1,D6
	MOVE.L	#PLST,A6
	MOVE.L	#[$18*40]+16,A5
	LEA	PRINTPLSTSOUND1,A4
	MOVEQ	#11,D7

PLST_LOP:
	MOVE.L	D6,(A4)+

	MOVE.L	A5,L629
	MOVE.L	#19,L636
	LEA	(A6,D6.L),A3
	ADDQ.L	#$3,A3
	MOVE.L	A3,L635
	BSR	L566
	MOVE.W	$16(A6,D6.L),L655
	ASL.W	#1,L655
	BSR	L561
	CLR.B	D0
	CMP.W	#1,$1C(A6,D6.L)
	BEQ.S	NOREPP
	MOVE.B	#$60,D0
NOREPP:	TST.W	$1A(A6,D6.L)
	BEQ.S	NO2EPP
	MOVE.B	#$60,D0
NO2EPP:	MOVE.L	L629,A2
	ADD.L	L628,A2
	MOVE.B	D0,80(A2)
	ADD.L	#$1E,D6
	ADD.L	#[$6*40],A5
	DBF	D7,PLST_LOP
	RTS

L144:	MOVE.W	#$91,D0
	BSR	L132
	lea	L760,a0
	lea	L617,a1
	moveq	#$62,d0
.L145:	moveq	#$18,d1
.L146:	move.b	$2800(a0),d2
	move.b	$0a0e(a1),$2800(a0)
	move.b	d2,$0a0e(a1)
	move.b	(a0),d2
	move.b	(a1),(a0)+
	move.b	d2,(a1)+
	dbf	d1,.L146
	add.l	#$f,a0
	addq.l	#1,a1
	dbf	d0,.L145
	rts

PLSTCL:	move.l	L628,a1
	add.l	#[$17*40]+$F,a1
	moveq	#$4A,d6
ELL:	moveq	#$18,d5
ERL:	clr.b	(a1)+
	dbf	d5,ERL
	add.l	#$f,a1
	dbf	d6,ELL
	RTS

DONTLOADPLST:
	BSR	PRINTPLST
	BRA	L139

LOADPLST:
	BRA	L139

L147:	cmp.b	#$55,L647
	bne.s	L149
	clr.b	L647
	TST.W	L512
	BNE	GREY
	TST.W	L511
	BNE	L29
	tst.l	L632
	BNE	RRTS
	clr.w	L652
	bsr	L507
	rts

L149:	cmp.b	#$56,L647
	bne.s	L150
	clr.b	L647
	TST.W	L512
	BNE	RED
	TST.W	L511
	BNE	L30
	tst.l	L632
	BNE	RRTS
	move.w	#$0010,L652
	bsr	L507
	rts

L150:	cmp.b	#$57,L647
	bne.s	L151
	clr.b	L647
	TST.W	L512
	BNE	GREEN
	TST.W	L511
	BNE	L31
	tst.l	L632
	BNE	RRTS
	move.w	#$0020,L652
	bsr	L507
	rts

L151:	cmp.b	#$58,L647
	bne.s	L152
	clr.b	L647
	TST.W	L512
	BNE	BLUE
	TST.W	L511
	BNE	L32
	tst.l	L632
	BNE	RRTS
	move.w	#$0030,L652
	bsr	L507
	rts

L152:	cmp.b	#$59,L647
	bne.s	L153
	clr.b	L647
	TST.W	L512
	BNE	ORANGE
	tst.w	L511
	BNE	CHANGEMUSPEK
	tst.l	L632
	BNE	RRTS
	move.w	#$003f,L652
	bsr	L507
L153:	rts

CHANGEMUSPEK:
	LEA	L752+4,A1
	LEA	MUSPEKARE2,A0
	MOVEQ	#$F,D7
CHMUSLO:MOVE.L	(A1),D0
	MOVE.L	(A0),(A1)+	
	MOVE.L	D0,(A0)+
	DBF	D7,CHMUSLO
	MOVE.L	MUPP2,D0
	MOVE.L	MUSPEKOFFSET,MUPP2
	MOVE.L	D0,MUSPEKOFFSET
	CLR.W	L647
	RTS

L154:	tst.w	L511
	bne.s	L155
	moveq	#$00,d0
	move.l	d0,a0
	tst.w	L512
	bne.s	L160
	rts

L155:	cmpi.w	#$0012,L653
	bne.s	L156
	moveq	#$0c,d0
	move.l	d0,a0
	bra.s	L160

L156:	cmpi.w	#$000c,L653
	bne.s	L157
	moveq	#$08,d0
	move.l	d0,a0
	bra.s	L160

L157:	cmpi.w	#$0006,L653
	bne.s	L158
	moveq	#$04,d0
	move.l	d0,a0
	bra.s	L160

L158:	tst.w	L653
	bne.s	L159
	moveq	#$00,d0
	move.l	d0,a0
	bra.s	L160

L159:	rts

L160:	add.l	L697(PC),a0
	add.l	#$43c,a0
	move.l	L637,d0
	lsl.l	#$8,d0
	lsl.l	#$2,d0
	add.l	d0,a0
	tst.w	L512
	bne.s	L161
	cmpi.b	#$52,L647
	beq	L168
	cmpi.b	#$53,L647
	beq	L170
	cmpi.b	#$54,L647
	beq	L172
	rts

L161:	cmpi.b	#$52,L647
	beq.s	L162
	cmpi.b	#$53,L647
	beq.s	L164
	cmpi.b	#$54,L647
	beq.s	L166
	rts

L162:	lea	L619,a1
	MOVEQ	#0,d0
L163:	move.l	(a0,d0.w),(a1)+
	clr.l	(a0,d0.w)
	addq.w	#$4,d0
	cmp.w	#$400,d0
	bne.s	L163
	clr.W	L647
	bra	L543

L164:	lea	L619,a1
	MOVEQ	#0,d0
L165:	move.l	(a0,d0.w),(a1)+
	addq.w	#$4,d0
	cmp.w	#$0400,d0
	bne.s	L165
	clr.W	L647
	rts

L166:	lea	L619,a1
	MOVEQ	#0,d0
L167:	move.l	(a1)+,$00(a0,d0.w)
	addq.w	#4,d0
	cmp.w	#$0400,d0
	bne.s	L167
	clr.W	L647
	bra	L543

L168:	lea	L618,a1
	MOVEQ	#0,D0
L169:	move.l	(a0,d0.w),(a1)+
	clr.l	(a0,d0.w)
	add.w	#$0010,d0
	cmp.w	#$0400,d0
	bne.s	L169
	clr.W	L647
	bra	L543

L170:	lea	L618,a1
	MOVEQ	#0,D0
L171:	move.l	(a0,d0.w),(a1)+
	addi.w	#$0010,d0
	cmp.w	#$0400,d0
	bne.s	L171
	clr.W	L647
	rts

L172:	lea	L618,a1
	MOVEQ	#0,d0
L173:	move.l	(a1)+,(a0,d0.w)
	addi.w	#$0010,d0
	cmp.w	#$0400,d0
	bne.s	L173
	clr.W	L647
	bra	L543


TRANSPOSE:
	tst.w	L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D3
	DBF	D1,T_LOOP
	BRA.S	T_NEXT
T_YEP:	AND.W	#$F000,(A0)
	ADD.L	D4,D3
	BMI.S	T_NEXT
T_GO:	MOVE.W	(A1,D3.W),D3
	OR.W	D3,(A0)

T_NEXT:	ADD.L	#$10,A0
	DBF	D7,T_LOP
	RTS

T_NEXTNOTZERO:
	MOVEQ	#0,D1
	BRA.S	T_NEXT

L174:	CMP.B	#$66,L647
	BNE.S	NOSTAMM
	clr.b	l647
	moveq	#1,d0
	tst.w	l512
	bne.s	okkiro
	moveq	#-1,d0
OKKIRO:	move.l	L697(PC),a0
	move.w	l658,d1
	mulu	#$1e,d1
	lea	-$a(a0,d1.w),a0

	move.b	$18(a0),d2
	add.b	d0,$18(a0)
	cmp.b	#-$10,$18(a0)
	bge.s	nottoosm
	move.b	d2,$18(a0)
nottoosm:
	cmp.b	#$10,$18(a0)
	ble.s	nottoobig
	move.b	d2,$18(a0)
nottoobig:
	bra	l552

NOSTAMM:cmp.b	#$51,L647
	beq.s	L176
	cmp.b	#$50,L647
	BNE	RRTS

L175:	clr.b	L647
	MOVEQ	#-2,D4
	TST.W	L511
	BNE	TRANSPOSE
	TST.W	L512
	BNE	TRANSPOSE
	move.l	#L598,L643
	move.l	#L599,L644
	rts

L176:	clr.b	L647
	MOVEQ	#2,D4
	TST.W	L511
	BNE	TRANSPOSE
	TST.W	L512
	BNE	TRANSPOSE
	move.l	#L600,L643
	move.l	#L601,L644
	rts

L177:	move.w	L665,d0
	addq.w	#$3,d0
	SUB.W	MUSPEKOFFSET,D0
	move.w	L666,d1
	SUB.W	MUSPEKOFFSET+2,D1
	moveq	#$11,d2
	move.l	L572,a0
	bra	L568

L178:	cmp.l	#'edit',L631
	beq.s	L179
	rts

L179:	lea	L596,a0
	moveq	#$00,d0
	moveq	#$00,d1
	move.b	L647,d0
L180:	cmp.b	(a0)+,d0
	beq.s	L182
	addq.b	#1,d1
	cmp.b	#$10,d1
	beq.s	L181
	bra.s	L180
L181:	rts

L182:	cmp.w	#1,L653
	bne.s	L183
	cmp.w	#1,d1
	bgt.s	L181
	move.l	#$fff,d2
	clr.w	L646
	lsl.w	#4,d1
	lsl.w	#8,d1
	bra	L202

L183:	cmp.w	#2,L653
	bne.s	L184
	move.l	#$fff,d2
	move.w	#2,L646
	lsl.w	#4,d1
	lsl.w	#8,d1
	bra	L202

L184:	cmp.w	#$3,L653
	bne.s	L185
	move.l	#$f0ff,d2
	move.w	#$2,L646
	lsl.w	#$8,d1
	bra	L202

L185:	cmpi.w	#$4,L653
	bne.s	L186
	move.l	#$ff0f,d2
	move.w	#$2,L646
	lsl.w	#$4,d1
	bra	L202

L186:	cmp.w	#$5,L653
	bne.s	L187
	move.l	#$fff0,d2
	move.w	#$2,L646
	bra	L202

L187:	cmp.w	#$7,L653
	bne.s	L188
	cmp.w	#1,d1
	bgt	L181
	move.l	#$fff,d2
	move.w	#$4,L646
	lsl.w	#$4,d1
	lsl.w	#$8,d1
	bra	L202

L188:	cmp.w	#$8,L653
	bne.s	L189
	move.l	#$fff,d2
	move.w	#$6,L646
	lsl.w	#$4,d1
	lsl.w	#$8,d1
	bra	L202

L189:	cmp.w	#$9,L653
	bne.s	L190
	move.l	#$f0ff,d2
	move.w	#$6,L646
	lsl.w	#$8,d1
	bra	L202

L190:	cmp.w	#$a,L653
	bne.s	L191
	move.l	#$ff0f,d2
	move.w	#$6,L646
	lsl.w	#$4,d1
	bra	L202

L191:	cmp.w	#$b,L653
	bne.s	L192
	move.l	#$fff0,d2
	move.w	#$6,L646
	bra	L202

L192:	cmp.w	#$d,L653
	bne.s	L193
	cmp.w	#1,d1
	bgt	L181
	move.l	#$fff,d2
	move.w	#$8,L646
	lsl.w	#$4,d1
	lsl.w	#$8,d1
	bra	L202

L193:	cmp.w	#$e,L653
	bne.s	L194
	move.l	#$fff,d2
	move.w	#$a,L646
	lsl.w	#$4,d1
	lsl.w	#$8,d1
	bra	L202

L194:	cmp.w	#$f,L653
	bne.s	L195
	move.l	#$f0ff,d2
	move.w	#$a,L646
	lsl.w	#$8,d1
	bra	L202

L195:	cmp.w	#$10,L653
	bne.s	L196
	move.l	#$ff0f,d2
	move.w	#$a,L646
	lsl.w	#$4,d1
	bra	L202

L196:	cmp.w	#$11,L653
	bne.s	L197
	move.l	#$fff0,d2
	move.w	#$a,L646
	bra	L202

L197:	cmp.w	#$13,L653
	bne.s	L198
	cmp.w	#1,d1
	bgt	L181
	move.l	#$fff,d2
	move.w	#$c,L646
	lsl.w	#$4,d1
	lsl.w	#$8,d1
	bra.s	L202

L198:	cmp.w	#$14,L653
	bne.s	L199
	move.l	#$fff,d2
	move.w	#$e,L646
	lsl.w	#$4,d1
	lsl.w	#$8,d1
	bra.s	L202

L199:	cmp.w	#$15,L653
	bne.s	L200
	move.l	#$f0ff,d2
	move.w	#$e,L646
	lsl.w	#$8,d1
	bra.s	L202

L200:	cmpi.w	#$16,L653
	bne.s	L201
	move.l	#$ff0f,d2
	move.w	#$e,L646
	lsl.w	#$4,d1
	bra.s	L202

L201:	move.l	#$fff0,d2
	move.w	#$e,L646
L202:	move.l	L697(PC),a0
	add.l	#$43c,a0
	move.l	L637,d0
	lsl.l	#$8,d0
	lsl.l	#$2,d0
	add.l	d0,a0

	MOVEM.L	D1-D7/A0-A1,-(A7)
	MOVEQ	#0,D0
	MOVE.W	L652(PC),D0
	BSR	L219
	cmp.l	#'patt',L632
	beq.s	EXITNUQUANT
	CMP.L	#'patp',L632
	BEQ.S	EXITNUQUANT
	MOVEQ	#0,D1
	MOVE.B	QUANT,D1
	add.w	D1,L652
	and.w	#$3f,L652
	MOVE.L	D0,-(A7)
	BSR	L507
	MOVE.L	(A7)+,D0

EXITNUQUANT:
	MOVEM.L	(A7)+,D1-D7/A0-A1
	MOVE.W	D0,CURRENTREC
	lsl.w	#4,d0
	ext.l	d0
	add.l	d0,a0

	add.w	L646,a0
	and.w	d2,(a0)
	add.w	d1,(a0)
	move.w	(a0),L655
	moveq	#0,d0
	move.w	CURRENTREC(PC),d0
	mulu	#$118,d0
	move.w	L653,d1
	divu	#6,d1
	mulu	#9,d1
	add.l	d1,d0
	add.l	#$1d68,d0
	move.l	d0,L629
	TST.w	L646
	beq.s	L204
	cmp.w	#4,L646
	beq.s	L204
	cmp.w	#8,L646
	beq.s	L204
	cmp.w	#$c,L646
	beq.s	L204
	bsr	L561
L203:	clr.b	L647
	BRA	L507

L204:	subq.l	#1,L629
	move.l	#1,L636
	moveq	#0,d0
	move.w	(a0),d0
	and.w	#$F000,d0
	lsr.w	#4,d0
	lsr.w	#7,d0
	add.l	#L606,d0
	move.l	d0,L635
	bsr	L562
	bra.s	L203

ALFABETET:
	DC.B $0A,$01,$02,$03,$04,$05,$06,$07,$08,$09,$00,$00,$00,$00,$00,$00
	DC.B $00,$20,$35,$33,$22,$12,$23,$24,$25,$17,$26,$27,$28,$37,$36,$18
	DC.B $19,$10,$13,$21,$14,$16,$34,$11,$32,$15,$31,0

ALFOUND:CLR.B	L647
	MOVE.L	#PLST,A0
	ADD.L	#$6,A0
	MOVE.W	L722,D7
	MOVEQ	#0,D5
	BRA.S	GOL
ALLOOP:	MOVE.B	(A0,D5.L),D0
	CMP.B	#$60,D0
	BLE.S	ALLOO2
	SUB.B	#$20,D0
ALLOO2:	CMP.B	D6,D0
	BGE.S	ALLLFOU
	ADD.L	#$1E,D5
GOL:	DBF	D7,ALLOOP

ALLLFOU:MOVE.L	D5,D0
	DIVU	#$1E,D5
	CMP.W	#$4,L713
	BNE.S	ALFR
	MOVE.W	D5,D0
	BRA.S	MOVEPLSTSCR
ALFR:	bra	alfrts

MOVEPLSTSCR:
	MOVEQ	#0,D1
	MOVEQ	#0,D6
	MOVE.L	#PLST,A0
	BRA.S	KOU
LOJ:	ADDQ.W	#1,D1
FFYUND:	ADD.L	#$1E,D6
KOU:	DBF	D0,LOJ
	MOVE.W	D1,D0
	BRA	MO2

PLSTGOCHAR:
	CMP.W	#$4,L713
	BEQ.S	OKR
	CMP.W	#$5,L713
	BNE.S	KOUR
OKR:	TST.L	L720
	BEQ	RRTS

	MOVE.B	L647,D0
	LEA	ALFABETET,A0
	MOVEQ	#43,D7
	MOVEQ	#$30,D6
ALFLOOP:CMP.B	(A0)+,D0
	BEQ	ALFOUND
	ADDQ.B	#1,D6
	DBF	D7,ALFLOOP
ALFRTS:	RTS

L205:	tst.b	L647
	bEQ	RTS
	MOVEQ	#0,D7

L206:	TST.B	L647
	BMI.S	ALFRTS
	TST.W	L511
	BNE.S	PLSTGOCHAR
KOUR:	MOVE.w	L653,D0
	beq.s	L207
	cmp.w	#$0006,D0
	beq.s	L207
	cmp.w	#$000c,D0
	beq.s	L207
	cmp.w	#$0012,D0
	beq.s	L207
	CMP.W	#4,L713
	BEQ	TIM_RTS
	cmp.l	#'edit',L631
	beq	L178
	rts

DEDIT:	CMP.L	#'edit',L631
	BEQ.S	L208
	RTS

L207:	moveq	#0,d1
	lea	L597,a0
	move.b	L647,d1
	moveq	#0,d0
	CMP.B	#$46,D1
	BEQ.S	DEDIT
L208:	move.l	d0,d4
	cmp.b	(a0,d0.w),d1
	beq.s	L209
	addq.b	#1,d0
	cmp.b	#$27,d0
	bne.s	L208
	rts

L209:	clr.b	L647
	Asl.w	#1,d0
	Asl.w	#1,d4
NOMIDICHANHE:
NOCHANHE:
	TST.L	D7
	BNE.S	NOOCTAVESHIT
	moveq	#0,d3
	move.l	L643,a1
	move.w	(a1,d0.l),d3
	move.w	d3,L648

	TST.W	L512
	BEQ.S	GOONWITHHER
	MOVEQ	#-1,D7
	LEA	LJUDPERIODS,A3
	MOVE.W	L658,D6
	BEQ.S	GOONWITHHER
	ASL.W	#1,D6
	MOVEQ	#0,D0
	LEA	L602,A0
	MOVEQ	#[L603-L602]/2,D5
K505_D:	CMP.W	(A0)+,D3
	BGE.S	K505_E
	ADDQ.W	#$2,D0
	DBF	D5,K505_D
	BRA.S	GOONWITHHER
K505_E:
	MOVE.W	D0,(A3,D6.W)
	BRA.S	GOONWITHHER
NOOCTAVESHIT:
	moveq	#0,d3
	LEA	L602,a1
	move.w	(a1,d0.l),d3
	move.w	d3,L648

GOONWITHHER:
	CLR.W	L684
	TST.L	D7
	BMI	L212
	CMP.W	#4,L713
	BEQ	L212
	tst.l	L631
	beq	L212
	move.l	L697(PC),a0
	add.l	#$43c,a0
	move.l	L637,d0
	lsl.l	#8,d0
	lsl.l	#2,d0
	add.l	d0,a0
	moveq	#0,d0
	move.w	L652,d0
	bsr	L219
	MOVE.W	D0,CURRENTREC
	lsl.w	#$4,d0
	ext.l	d0
	add.l	d0,a0
	move.w	L653,d0
	divu	#$6,d0
	lsl.w	#$2,d0
	ext.l	d0
	add.l	d0,a0
	move.w	d3,(a0)
	tst.w	L648
	beq.s	L210
	moveq	#$00,d0
	move.w	L658,d0
	lsl.w	#4,d0
	and.b	#$f,2(a0)
	add.b	d0,2(a0)
	lsl.w	#4,d0
	and.w	#$F000,d0
	or.w	d0,(a0)
	bra.s	L211

L210:	and.w	#$fff,2(a0)
L211:	move.w	2(a0),L633
	LEA	L603,A0
	TST.L	D7
	BNE.S	TOLLE
	MOVE.L	L644,A0
TOLLE:	lsl.w	#1,d4
	ext.l	d4
	add.l	d4,a0
	move.l	a0,L635
	move.l	#3,L636
	moveq	#0,d0
	move.w	CURRENTREC(PC),d0
	mulu	#$118,d0
	moveq	#0,d1
	move.w	L653,d1
	divu	#6,d1
	mulu	#9,d1
	add.l	d1,d0
	add.l	#$1d64,d0
	move.l	d0,L629
	bsr	L562
	bsr	L559
	move.w	L633,L655
	bsr	L561
	cmp.l	#'patt',L632
	beq.s	L212
	CMP.L	#'patp',L632
	BEQ.S	L212
	MOVEQ	#0,D0
	MOVE.B	QUANT,D0
	add.w	D0,L652
	and.w	#$3f,L652
	BSR	L507

L212:	tst.w	L684
	bne.s	L213
	tst.w	L648
	bne.s	L214
L213:	rts

CURRENTREC:	DC.W	0

L214:	move.l	#0,a5
	cmp.w	#$12,L653
	bne.s	L215
	lea	$dff0d0,a5
	LEA	L595,A4
	move.w	#8,L699
	bra	L222

L215:	cmp.w	#$c,L653
	bne.s	L216
	lea	$dff0c0,a5
	LEA	L594,A4
	move.w	#4,L699
	bra	L222

L216:	cmp.w	#$6,L653
	bne.s	L217
	lea	$dff0b0,a5
	LEA	L593,A4
	move.w	#2,L699
	bra	L222

L217:	tst.w	L653
	bne.s	L218
	lea	$dff0a0,a5
	LEA	L592,A4
	move.w	#1,L699
	bra	L222

L218:	rts

L219:	MOVEM.L	D1-D6,-(A7)
	BSR.S	QUAX
	MOVEM.L	(A7)+,D1-D6
	RTS

QUAX:	MOVE.L	L632,D5
	beq.s	L220

	MOVEQ	#1,D1
	cmp.l	#'patt',D5
	BEQ.s	YEKL
	CMP.L	#'patp',D5
	BNE.S	L220
YEKL:	MOVEQ	#0,D6
	MOVE.B	QUANT,D6
	MOVEQ	#0,D5
	MOVE.W	D0,D5
	DIVU	D6,D5
	MOVE.L	D5,D2
	SWAP	D5
	MOVE.L	L642,D1
	MULU	D1,D5
	ADD.L	L695,D5	;D5=EDITPOS

	MOVE.L	D6,D4
	MULU	D1,D4	;D6=MAXPOS
	LSR.W	#1,D4
	CMP.W	D4,D5
	BLE.S	NORM

INGES2D:ADDQ.W	#1,D2
	MULU	D6,D2
	MOVE.W	D2,D0
	and.w	#$3f,d0
	move.w	#1,L684
	rts
NORM:	MULU	D6,D2
	MOVE.W	D2,D0
L220:	AND.W	#$3F,D0
	clr.w	L684
	rts


STOPSUND:MOVE.W	L699,D2
	MOVE.W	D2,$DFF096
	RTS

L222:	TST.W	L648
	BEQ	RTS
	MOVE.B	CURRSTAMM,$1E(A4)
	tst.b	currsoundonoff
	bne	gosoundplay
	TST.W	L669
	BEQ.S	STOPSUND
	MOVE.W	L699,SACHA	;ALLT NEDANFOR E NORMALLJUD
	MOVE.L	A5,SACHAMPOS
	MOVE.L	A4,SACHAMPO2
	lea	L669,a6
	MOVEQ	#0,D3
	move.w	$4(a6),d0
	BNE.s	L222_2
	move.w	(a6),D0
	MOVEQ	#-1,D3
	BRA.S	L223
L222_2:	ADD.W	$6(A6),D0
L223:	move.w	$2(a6),$8(a5)
	 MOVE.B	$3(A6),$13(A4)
	 MOVE.B	#$40,$12(A4)	;NOPROGVOLUME
	MOVE.W	L648,$10(A4)
	CLR.B	$1B(A4)
	CLR.W	$18(A4)
	CLR.B	$1C(A4)		;PROG OFF
	MOVE.L	D0,-(A7)
	move.w	L648,D0	;period
	BSR	PERCALCA4
	MOVE.L	(A7)+,D0
	move.w	L699,d2
	move.w	d2,$dff096
	 move.l	$8(a6),$a(a4)	;loopstartpoi for om vbl avbryter rut
	 move.w	d0,$e(a4)	;looplen	-""-
	move.l	$8(A6),(a5)
	MOVE.W	D0,$4(A5)

	MOVE.W	D0,SALEN
	CLR.W	SAPER
	MOVE.W	SACHA,D0
	JSR	SAMDOTINIT	;samdot
	move.w	L648,d0
	bsr	L19		;analyzer
	MOVE.W	#$12C,D0
L223_2:	DBF	D0,L223_2
	move.w	L699,d0
	or.w	#$8000,d0
	move.w	d0,$dff096
	move.W	#$12C,d0
L224:	dbf	d0,L224
	lea	L669,a6

	MOVEQ	#0,D1		;calc loopvalues
	MOVE.W	$4(A6),D1
	ASL.W	#1,D1
	ADD.L	$8(A6),D1
	MOVE.L	D1,$A(A4)
	MOVE.W	$6(A6),$E(A4)
	TST.L	D3
	BEQ.S	OKNOLOO
	move.L	#DUMMYSOUND,D1

OKNOLOO:move.l	d1,$a(a4)	;loopstart
	move.l	d1,(a5)
	move.w	6(a6),4(a5)
	clr.w	L699
	CMP.B	#3,DRUMMERON
	BNE	P_RTS
	BRA	TABRUT

gosoundplay:
	clr.w	saper	;samdot off
	lea	L669,a6

	move.l	a0,-(a7)
	move.b	#1,$1c(a4)	;prog on
	clr.b	$1d(a4)		;datacou
	move.l	L697,a0
	lea	$43c(a0),a0
	moveq	#0,d2
	move.b	pattwaveno,d2	;pattno
	mulu	#$400,d2
	lea	(a0,d2.l),a0
	move.l	a0,4(a4)	;proginstr data-start
	moveq	#0,d2
	move.b	$380(a0),d2
	moveq	#0,d0
	move.b	$3c0(a0),d0
	mulu	#$20,d2
	lea	(a0,d2.w),a0
	move.l	a0,$a(a4)	;loopstartmempoi = startmempoi
	move.w	#$10,$e(a4)	;looplen
	move.w	2(a6),$12(a4)	;currvolume
	move.b	currsoundrepeat,8(a4)	;dataloopstart
	move.b	currsoundrepend,9(a4)	;dataloopend
	move.l	(a7)+,a0

	move.w	L699,$dff096

	moveq	#0,d2
	move.b	$13(a4),d2
	and.w	#$7f,d0
	mulu	d0,d2
	lsr.w	#$6,d2
	move.w	d2,$8(a5)	;volume

	move.l	$a(a4),(a5)	;loopstartpoi
	move.w	$e(a4),$4(a5)
	MOVE.W	L648,$10(A4)	;currperiod
	move.w	L648,D0	;period
	BSR	PERCALCA4
	CLR.B	$1B(A4)
	CLR.W	$18(A4)

	move.w	L648,d0
	bsr	L19		;analyzer
	MOVE.W	#$12C,D0
L999:	DBF	D0,L999
	move.w	L699,d0
	or.w	#$8000,d0
	move.w	d0,$dff096
	clr.w	L699
	CMP.B	#3,DRUMMERON
	BNE	P_RTS


TABRUT:	CLR.W	L647
	ADDQ.W	#$6,L653
	CMP.W	#$18,L653
	BMI.S	NOWRAP
	SUB.W	#$18,L653
NOWRAP:	MOVEQ	#0,D0
	MOVE.W	L653,D0
	DIVU	#$6,D0
	MULU	#$6,D0
	MOVE.W	D0,L653
	BRA	L245

L227:	move.b	L647,d0
	CMP.B	#$42,D0
	BEQ.S	TABRUT
	cmp.b	#$4e,d0
	beq	L238
	cmp.b	#$4f,d0
	beq	L242
	cmp.b	#$4c,d0
	beq.s	L228
	cmp.b	#$4d,d0
	beq	L233
	clr.w	L225
	rts

L227_2:	MOVE.W	#1,MOVEDISKLIST
	RTS

L227_3:	MOVE.W	#$2,MOVEDISKLIST
	RTS

L227_4:	MOVE.W	#1,MOVEPLSTCON
	RTS

L227_5:	MOVE.W	#$2,MOVEPLSTCON
	RTS

L228:	CMP.W	#$3,L713
	BEQ.S	L227_2
	TST.W	L726
	BNE.S	L227_4
	CMP.W	#$5,L713
	BEQ.S	L227_4
	tst.w	L225
	beq.s	L231
	addq.w	#1,L226
	tst.w	L511
	bne.s	L229
	TST.B	REPCON
	BNE.S	L229
	tst.w	L512
	bne.s	L230
	cmpi.w	#$0006,L226
	bpl.s	L231
	rts

L229:	cmpi.w	#$0003,L226
	bpl.s	L231
	rts

L230:	cmpi.w	#$0001,L226
	bpl.s	L231
	rts

L231:	clr.w	L226
	move.w	#$FFFF,L225
	cmp.l	#'patt',L632
	beq.s	L232
	CMP.L	#'patp',L632
	BEQ.S	L232
	subq.w	#1,L652
	and.w	#$003f,L652
	bra	L507

L232:	rts

L233:	CMP.W	#$3,L713
	BEQ	L227_3
	TST.W	L726
	BNE	L227_5
	CMP.W	#$5,L713
	BEQ	L227_5
	tst.w	L225
	beq.s	L236
	addq.w	#1,L226
	tst.w	L511
	bne.s	L234
	TST.B	REPCON
	BNE.S	L234
	tst.w	L512
	bne.s	L235
	cmpi.w	#$0006,L226
	bpl.s	L236
	rts

L234:	cmp.w	#$0003,L226
	bpl.s	L236
	rts

L235:	cmp.w	#$0001,L226
	bpl.s	L236
	rts

L236:	clr.w	L226
	move.w	#$FFFF,L225
	cmp.l	#'patt',L632
	beq.s	L237
	CMP.L	#'patp',L632
	BEQ.S	L237
	addq.w	#1,L652
	and.w	#$003f,L652
	bra	L507

L237:	rts

L238:	TST.W	MYEDIT
	BNE.S	L237
	tst.w	L511
	bne.s	INCSONGPO
	tst.w	L512
	bne.s	INCPATTNO
	tst.w	L225
	beq	L240
	addq.w	#1,L226
	cmp.w	#$0006,L226
	bpl	L240
	rts

DECSONGPO:
	MOVEQ	#-1,D0
	BRA.S	SON1
INCSONGPO:
	MOVEQ	#1,D0
SON1:	TST.W	L225
	BEQ.S	SON_1
	ADDQ.W	#1,L226
	CMP.W	#$5,L226
	BPL.S	SON_1
	RTS

SON_1:	CLR.W	L226
	MOVE.W	#$FFFF,L225
	MOVE.L	D0,PATSODIR
	MOVE.W	#1,PATSOGO
	RTS

DECPATTNO:
	MOVEQ	#-1,D0
	BRA.S	PAT1
INCPATTNO:
	MOVEQ	#1,D0
PAT1:	CMP.L	#'patp',L632
	BEQ	P_RTS

	MOVE.L	D0,PATSODIR
	MOVE.W	#$2,PATSOGO
	CLR.W	L647
	RTS

CHANGEPATT:
	MOVE.L	PATSODIR,D0
	MOVE.L	L637,D1
	ADD.L	D0,L637
	CMP.L	#$3F,L637
	BLS.S	CPOK
	SUB.L	D0,L637
CPOK:	CLR.W	PATSOGO
	CMP.L	L637,D1
	BEQ	ALFRTS
	BRA	L543

PATSORUT:
	MOVE.W	PATSOGO,D0
	BEQ	P_RTS
	CMP.W	#$2,D0
	BEQ.S	CHANGEPATT
	CLR.W	PATSOGO
	MOVE.L	PATSODIR,D0
	BMI.S	SUBIT
	CMP.L	#$7F,L693
	BEQ	P_RTS
	ADD.L	D0,L693
	AND.L	#$7F,L693
	Bra	L548

SUBIT:	TST.L	L693
	BEQ	P_RTS
	ADD.L	D0,L693
	AND.L	#$7F,L693
	Bra	L548

L240:	clr.w	L226
	move.w	#$FFFF,L225
	addq.w	#1,L653
	cmpi.w	#$0018,L653
	bmi.s	L241
	clr.w	L653
L241:	bra.s	L245

L242:	TST.W	MYEDIT
	BNE	P_RTS
	tst.w	L511
	bne	DECSONGPO
	tst.w	L512
	bne	DECPATTNO
	tst.w	L225
	beq.s	L244
	addq.w	#1,L226
	cmpi.w	#$0006,L226
	bpl.s	L244
	rts

L244:	clr.w	L226
	move.w	#$FFFF,L225
	subq.w	#1,L653
	tst.w	L653
	bpl.s	L245
	move.w	#$0017,L653
L245:	move.w	L653,d0
	lea	L607,a0
	move.b	$00(a0,d0.w),d0
	lsl.w	#$3,d0
	addi.w	#$0009,d0
	move.w	#$00bd,d1
	moveq	#$0e,d2
	LEA	L753,A0
	bra	L568

L246:	move.w	L649,d0
	move.w	L650,d1
	subq.w	#1,d0
	moveq	#$02,d2
	LEA	L754,A0
	bra	L568

L247:	bsr	L177
	bsr	L227
	bsr	L250
	cmp.w	#$FFFF,L654
	beq.s	L249
	moveq	#$00,d0
L248:	addq.l	#1,d0
	cmp.l	#$9c40,d0
	beq.s	L249
	btst	#$06,$bfe001
	beq.s	L248
	clr.w	L660
	bra	L7

L249:	move.w	#-$0001,L654
	btst	#$06,$bfe001
	beq.s	L247
	clr.w	L654
	clr.w	L660
	bra	L7

L250:	move.w	L665,L667
	move.w	L666,L668
	MOVEM.W	L667,D0-D1
	CMP.W	#7,D0
	BGT.S	L251
	CMP.W	#8,D1
	BGT.S	L251
	bsr	L363
	BSR	L138
	MOVE.W	L713,D0
	BEQ.S	JIP
	CMP.W	#3,D0
	BEQ.S	JIP
	CMP.W	#1,D0
	BEQ.S	JIP
	CMP.W	#6,D0
	BEQ.S	JIP
	BSR	PLSTCL
JIP:	MOVEQ	#-1,D0
	bsr	L125
	beq	L14
	BSR	SHOWSAMPLE
	BSR	L139
	CMP.W	#4,L713
	BNE.S	L250_2
	BSR	PRINTPLST
	BRA.S	L251
L250_2:	CMP.W	#3,L713
	BNE.S	L251
	CLR.W	L708
L251:	move.w	L668,d0
	cmp.w	#$007a,d0
	bge	L310
	cmp.w	#$006f,d0
	bge	L332
	cmp.w	#$0064,d0
	bge	L330
	move.w	L667,d0
	tst.w	L726
	bne	L254_2
	cmp.w	#3,L713
	bne.s	L251_8
	cmp.w	#$0078,d0
	bge	L260
L251_8:	cmp.w	#6,L713
	bne.s	L252
	cmp.w	#$0078,d0
	bge	SAMPLERBUTTONS
L252:	cmp.w	#$100,d0
	BGE	HOGERRAD
	cmp.w	#$00bC,d0
	bge	L255
	cmp.w	#$0078,d0
	bge	L258
L253:	cmp.w	#$0078,d0
	bge.s	L254
	cmp.w	#$006d,d0
	bge	L304
	cmp.w	#$0062,d0
	bge	L305
	MOVE.W	L668,D1
	CMP.W	#$C,D1
	BGE.S	L254
	CMP.W	#$3E,D0
	BGE.S	L254
	CMP.W	#$33,D0
	BGE	SV_INSERT
	CMP.W	#$28,D0
	BGE	SV_DELETE
L254:	RTS

L254_2:	MOVEQ	#0,D1
	MOVEM.W	L667,D0/D1
	CMP.W	#$78,D0
	BLT.S	L254_3
	CMP.W	#$B,D1
	BGT.S	L254_4
	CMP.W	#$C1,D0
	BLE	LOADPLST
	CMP.W	#$11C,D0
	BGE	EXITPLST
	RTS

L254_4:	CMP.W	#$16,D1
	BGT.S	L254_5
	CMP.W	#$10C,D0
	BGE	AlfRts
	CMP.W	#$DC,D0
	BGE	AlfRts
	CMP.W	#$AC,D0
	BGE	AlfRts
	CMP.W	#$78,D0
	BGE	AlfRts
	RTS

L254_5:	CMP.W	#$138,D0
	BGT.S	L254_3
	CMP.W	#$80,D0
	BLT.S	L254_3
	CMP.W	#$18,D1
	BLT.S	L254_3
	CMP.W	#$5F,D1
	BGT.S	L254_3
	SUB.W	#$18,D1
	AND.L	#$FF,D1
	DIVU	#$6,D1
	BRA	LOADSOUND

L254_3:	MOVE.W	L667,D0
	BRA	L253

L255:	move.w	L668,d0
	CMP.W	#$37,D0
	BGE.S	L257
	cmp.w	#$002c,d0
	bge	GOSAMPLER
	cmp.w	#$0022,d0
	bge	L57
	cmp.w	#$0017,d0
	bge	GOPLST
	cmp.w	#$000c,d0
	bge	L295
	BRA	L363
L257:	rts

L258:	move.w	L668,d0
L259:	CMP.W	#$37,D0
	BGE.S	L257
	cmp.w	#$002c,d0
	bge	SONGREC
	cmp.w	#$0022,d0
	bge	L84
	cmp.w	#$0017,d0
	bge	L367
	cmp.w	#$000c,d0
	bge	L456
	BRA	L83

HOGERRAD:
	move.w	L668,d0
	CMP.W	#$37,D0
	BGE.S	L257
	cmp.w	#$002c,d0
	bge	AlfRts	;CHECKMIDI
	cmp.w	#$0022,d0
	bge	AlfRts	;GOMIDI
	cmp.w	#$0017,d0
	bge	AlfRts	;GOPED
	cmp.w	#$000c,d0
	bge	AlfRts	;P319
	BRA	L26

L260:	movem.w	L667,d0-d1
	cmp.w	#$002D,d1
	bge.l	L58
	CMP.W	#$22,D1
	BGE.S	CHMODDIR
	cmp.w	#$00FC,d0
	BLT.s	L263

	cmp.w	#$0016,d1
	bge	AlfRts		;DELETESAMPLE
	cmp.w	#$000b,d1	;SAVESAM
	bge	AlfRts		;L264
	bra	LOADSAMPLE

CHMODDIR:
	CMP.W	#$B8,D0
	BGE	CHANGEMODULEDIR
	RTS

L263:	CMP.W	#$00B8,D0
	BLT.S	DISKOPLEFTSPALT

	cmp.w	#$0016,d1
	bge	AlfRts		;L66	;DMOD
	cmp.w	#$000b,d1
	bge	AlfRts		;L70	;SMOD
	bra	L68	;LMOD

DISKOPLEFTSPALT:
	cmp.w	#$21,d1
	bge	rts	;packon/off
	CMP.W	#$16,D1
	BGE	L64	;DSON
	CMP.W	#$0B,D1
	BGE	L62	;SSON
	BRA	L60	;LSON

L267:	move.l	L689,d1
	move.l	L688,d2
	move.l	L690,d3
	jsr	-$30(a6)
	move.l	L689,d1
	jsr	-$24(a6)
	clr.l	L689
	BRA	L309




CLEAR_SONGD:
	bsr	L363
	BSR	L138
	MOVEQ	#0,D0
	bsr	L125
	bne	L300
	move.l	L697(PC),a1
	ADD.L	#$3B8,A1
	move.l	a1,a2
	add.l	#$80,a2
CL29:	clr.l	(a1)+
	cmp.l	a1,a2
	bne.s	CL29

	move.l	L697(PC),a0
	move.w	#$100,$3b6(a0)
	move.l	#'FEST',$438(a0)
	clr.l	L693
	clr.l	L692
	clr.l	L696
	bsr	L507
	bsr	L550
	bsr	L552
	bsr	L551
	BSR	L548
	bsr	L134
	BRA	SHOWSAMPLE


CLEAR_INSTRS:
	bsr	L363
	BSR	L138
	MOVEQ	#0,D0
	bsr	L125
	bne	L300
	bsr	L301

	move.l	L697(PC),a0
	move.l	a0,a1
	ADD.L	#$14,A1
	move.l	a1,a2
	add.l	#$1E*$1F,a2
CL5:	clr.W	(a1)+
	cmp.l	a1,a2
	bne.s	CL5
	move.l	a0,a1
	add.l	#$14,a1
	moveq	#$1e,d0
CL2:	move.w	#1,$1c(a1)
	add.l	#$1e,a1
	dbf	d0,CL2
	BSR	CLEARNT
	move.w	#1,L658
	CLR.W	L652
	bsr	L507
	bsr	L550
	bsr	L552
	bsr	L551
	bsr	L134
	BRA	SHOWSAMPLE


CLEAR_PATTS:
	bsr	L363
	BSR	L138
	MOVEQ	#0,D0
	bsr	L125
	bne	L300
	move.l	L697(PC),a0
	MOVE.L	A0,A1
	ADD.L	#$43C,A1
	MOVE.L	A1,A2
	add.l	#$10000,a2
CL6:	clr.l	(a1)+
	cmp.l	a1,a2
	bne.s	CL6
	move.l	#'FEST',$438(a0)
	clr.l	L693
	clr.l	L692
	clr.l	L696
	bsr	L548
	clr.l	L637
	clr.w	L652
	bsr	L543
	bsr	L507
	bsr	L550
	bsr	L552
	bsr	L551
	bsr	L134
	BRA	SHOWSAMPLE

CLEARNT:LEA	M_LS,A0
	MOVEQ	#$1F,D7
CLML:	MOVE.B	#48,$20(A0)
	MOVE.B	#4,(A0)+
	DBF	D7,CLML
	LEA	LJUDPERIODS,A0
	MOVEQ	#$1F,D7
CLETULO:MOVE.W	#$18,(A0)+
	DBF	D7,CLETULO
	RTS

CLR_ALT:bsr	L124
	BSR	L134
	bsr	CLR129
	bsr	L124
	BSR	L504
	BSR	L504
	BSR	L504
	BSR	L504
	CLR.W	L647
CLR127:	CMP.B	#$45,L647
	BEQ	CLRERR
	BTST	#2,$DFF016
	BEQ	CLRERR
	btst	#6,$bfe001
	bne.s	CLR127
	movem.w	L665,d0-d1
	cmp.w	#$C8,d0
	blt	CLRERR
	cmp.w	#$FF,d0
	bgt	CLRERR
	cmp.w	#$10,d1
	blt	CLRERR
	cmp.w	#$41,d1
	bgt	CLRERR
	cmp.w	#$13,d1
	blt.s	CLR127
	cmp.w	#$3E,d1
	bGt.s	CLR127
	CMP.W	#$CB,D0
	BLT.S	CLR127
	CMP.W	#$FC,D0
	BGT.S	CLR127
	MOVEQ	#0,D0
	CMP.W	#$1E,D1
	BLT	CLR_RETURN
	MOVEQ	#1,D0
	CMP.W	#$29,D1
	BLT	CLR_RETURN
	MOVEQ	#$2,D0
	CMP.W	#$34,D1
	BLT	CLR_RETURN
	MOVEQ	#$3,D0
CLR_RETURN:
	MOVE.L	D0,D6
	BSR.S	CLR129
	MOVE.L	D6,D0
	RTS

CLRERR:	BSR.S	CLR129
	MOVEQ	#-1,D0
	RTS

CLR129:	LEA	L759+[$10*40]+[$C8/8],a0
	MOVE.L	L628,A2
	ADD.L	#[$10*40]+[$C8/8],A2
	LEA	CLRR,a1
	moveq	#$31,d0
CLR130:	moveq	#$06,d1
CLR131:	move.b	$2800(a0),d2
	move.b	$190(a1),$2800(a0)
	move.b	d2,$190(a1)
	move.b	(a0),d2
	move.b	(a1),(a0)+
	move.b	d2,(a1)+
	CLR.B	(A2)+
	dbf	d1,CLR131
	add.l	#$21,a0
	ADD.L	#$21,A2
	addq.l	#1,a1
	dbf	d0,CLR130

	move.w	#$4C00,d7
CLR126:	dbf	d7,CLR126
	RTS

L295:	BSR	L363
	BSR	CLR_ALT
	MOVE.W	#1,PRINTFREE
	TST.L	D0
	BMI	L504
	BEQ.S	CLEAR_ALL
	CMP.W	#1,D0
	BEQ	CLEAR_PATTS
	CMP.W	#$2,D0
	BEQ	CLEAR_INSTRS
	BRA	CLEAR_SONGD

CLEAR_ALL:
	bsr	L363
	BSR	L138
	MOVEQ	#0,D0
	bsr	L125
	bne	L300
CLEARTUNE:
	bsr	L301
	move.l	L697(PC),a0
	move.l	a0,a1
	move.l	a1,a2
	add.l	#$1143c,a2
L296:	clr.l	(a1)+
	cmp.l	a1,a2
	bne.s	L296
	LEA	L581,a1
	moveq	#$1b,d0
L297:	clr.b	(a1)+
	dbf	d0,L297
	move.l	a0,a1
	add.l	#$14,a1
	moveq	#$1e,d0
L298:	move.w	#1,$1c(a1)
	add.l	#$1e,a1
	dbf	d0,L298
;	LEA	L583(pc),a1
	 LEA	L49,A1
	 ADD.L	#L583-L49,A1
	moveq	#$1b,d0
L299:	clr.b	(a1)+
	dbf	d0,L299
	move.l	L697(PC),a0
	move.w	#$100,$3b6(a0)
	move.l	#'FEST',$438(a0)
	move.l	L697,a0
	moveq	#0,d0
	move.w	#$1000,$43c+$e(a0)
	clr.l	L693
	clr.l	L692
	clr.l	L696
	BSR	CLEARNT
	move.w	#1,L658
	move.l	#$6,L642
	bsr	L548
	clr.l	L637
	clr.w	L652
	bsr	L543
	bsr	L507
	bsr	L550
	bsr	L552
	bsr	L551
L300:	bsr	L134
	BRA	SHOWSAMPLE

L301:	MOVE.W	#1,PRINTFREE
	moveq	#$01,d7
	move.l	$04.w,a6
L302:	move.w	d7,d2
	lsl.w	#$2,d2
	lea	L698,a0
	LEA	IFFSHIT,A1
	CLR.L	(A1,D2.W)
	move.l	(a0,d2.w),d1
	beq.s	L303
	move.l	$7c(a0,d2.w),d0
	clr.l	(a0,d2.w)
	clr.l	$7c(a0,d2.w)
	move.l	d1,a1
	jsr	-$d2(a6)
L303:	addq.w	#1,d7
	cmp.w	#$20,d7
	bne.s	L302
	rts

L304:	move.w	#$FFFF,L660
	bra.s	L306

L305:	clr.w	L660
L306:	MOVE.W	#1,PRINTFREE
	move.w	L668,d0
	cmp.w	#$64,d0
	bge.s	L307
	cmp.w	#$59,d0
	bge	L463
	cmp.w	#$4e,d0
	bge	L458
	cmp.w	#$43,d0
	bge	L468
	cmp.w	#$38,d0
	bge	L473
	cmp.w	#$2d,d0
	bge	L478
	cmp.w	#$22,d0
	bge	L484
	cmp.w	#$17,d0
	bge	L492
	cmp.w	#$0c,d0
	bge	L496
	tst.w	L668
	bge	L500
L307:	rts

L308:	move.l	L518,a0
	move.w	2(a0),L714
	move.w	6(a0),L715
	move.w	$a(a0),L716
	rts

L309:	MOVE.W	#1,PRINTFREE
	move.l	L518,a0
	move.w	L714,2(a0)
	move.w	L715,6(a0)
	move.w	L716,$a(a0)
	rts

L310:	cmp.l	#'patp',L632
	bEQ	TIM_RTS

L311:	bsr.s	L308
	bsr	L138
	clr.W	L647
	move.w	#$c,L649
	move.w	#$86,L650
	bsr	L246
	move.l	#$1401,L629
	bsr.s	L312
	BNE.S	CHPAA
	move.b	d1,d0
	mulu	#$a,d0
	move.b	d0,L717
	bsr	L314
	move.w	#$14,L649
	move.w	#$86,L650
	bsr	L246
	bsr.s	L312
	BNE.S	CHPAA
	move.b	L717,L638
	add.b	d1,L638
	and.l	#$3f,L637
CHPAA:	clr.w	L649
	move.w	#$010e,L650
	bsr	L246
	bsr	L543
	bsr	L245
	bra	L309

CHPAEX:	MOVEQ	#-1,D7
	RTS

L312:	BTST	#2,$DFF016
	BEQ.S	CHPAEX
	moveq	#$00,d0
	move.b	L647,d0
	beq.s	L312
	clr.W	L647
	cmp.b	#$0a,d0
	beq.s	L313
	bgt.s	L312
	cmp.b	#$01,d0
	blt.s	L312
	move.l	d0,d1
	MOVEQ	#0,D7
	rts

L313:	moveq	#$00,d1
	MOVEQ	#0,D7
	rts

L314:	addi.b	#$30,d1
	move.b	d1,L558
	clr.w	d1
	swap	d1
	move.l	#1,L636
	move.l	#L558,L635
	bsr	L562
	clr.l	L558
	clr.w	L655
	rts

L651:	DC.L	0
L697:	DC.L	0
MODDIRPOI:	DC.L	0

STP:	MOVE.W	#$F,$DFF096
	CLR.W	SAPER
	RTS

PRINTMODDIR2:
	CMP.W	#$3,L713
	BNE	RTS
	TST.L	MODDIRPOI
	BEQ	RTS
	CMP.L	MODDIRPOI(PC),A6
	BGE.S	NOMODSUB
	ADDQ.W	#8,L649
	BSR	L246
	SUBQ.L	#1,MODDIRPOI
NOMODSUB:
	MOVE.L	MODDIRPOI(PC),D0
	ADD.L	#$F,D0
	CMP.L	D0,A6
	BLT.S	NOMODADD
	SUBQ.W	#8,L649
	BSR	L246
	ADDQ.L	#1,MODDIRPOI
NOMODADD:
	MOVE.L	MODDIRPOI(PC),L635
	MOVE.L	#[$25*40]+24,L629
	MOVE.L	#$F,L636
	BRA	L562

PR2ALL:	BSR	L552
	BSR	L550
	BRA	PRINTMODDIR

CLRTEXT:MOVE.L	EDITSTPOI(PC),A6
	MOVE.L	A6,A4
CLRLOP:	CLR.B	(A4)+
	CMP.L	L651(PC),A4
	BNE.S	CLRLOP
	BSR.S	PRALL
	BSR	L124
	BRA	L328

PRALL:	BSR	PRINTMODDIR2
	BSR	L552
	BRA	L550

EDITSTPOI:	DC.L	0

L315:	MOVE.L	A6,EDITSTPOI
	MOVEQ	#0,D7
	MOVE.L	D7,MODDIRPOI
	CMP.L	#L82,A6
	BNE.S	NOMODQ
	MOVE.L	A6,MODDIRPOI
	MOVEQ	#-1,D7
NOMODQ:	MOVE.W	#1,MYEDIT
	MOVE.L	L651(PC),A0
	CLR.B	(A0)
	move.w	L649,d5
	move.w	L665,d0
	addq.l	#$3,d0
	move.w	#$010e,d1
	moveq	#$11,d2
	move.l	L572,a0
	bsr	L568
	lea	L604,a5
	clr.W	L647
	BSR.S	PRALL

L316:	BTST	#2,$DFF016
	BEQ	CLRTEXT
	CLR.W	D1
	MOVE.B	L647,D1
	beq.s	L316
	CMP.B	#$4E,D1
	BEQ	CURSRIGHT
	CMP.B	#$4F,D1
	BEQ	CURSLEFT
	CMP.B	#$46,D1
	BEQ	DELPRE
	cmp.b	#$41,D1
	beq	L324
	cmp.b	#$44,D1
	beq	L328
	TST.L	D7
	BEQ.S	NOMODF1RUT
	CMP.B	#$50,D1
	BEQ	MODF1RUT
NOMODF1RUT:
	btst	#7,d1
	bne.s	L316
	tst.w	L511
	beq.s	L317
	bset	#7,d1
L317:	moveq	#0,d0
L318:	cmp.b	(a5,d0.w),d1
	beq.s	L319
	addq.b	#1,d0
	cmp.b	#$2e,d0
	bgt.s	L316
	bra.s	L318

L319:	cmp.l	L651(PC),a6
	BEQ.s	L316

L320:	MOVE.L	L651(PC),A4
L320_2:	MOVE.B	-(A4),1(A4)
	CMP.L	A4,A6
	BNE.S	L320_2
	MOVE.L	L651(PC),A4
	CLR.B	(A4)
	lea	L608,a0
	move.b	(a0,d0.w),d1
	move.b	d1,(a6)+
	addq.w	#$8,L649
	bsr	L246
	BSR	PRALL
	clr.W	L647
	bra	L316

L324:	CMP.L	EDITSTPOI,A6
	bne.s	L325
	bra	L316
L325:	SUBQ.L	#1,A6
	MOVE.L	A6,A4
L325_2:	MOVE.B	1(A4),(A4)+
	CMP.L	L651(PC),A4
	BNE.S	L325_2
	subq.w	#$8,L649
	bsr	L246
	BSR	PRALL
	bsr	L504
	bsr	L504
	bsr	L504
	bra	L316

DELPRE:	CMP.L	L651(PC),A6
	BEQ.S	NODELPRE
	MOVE.L	A6,A4
L325_7:	MOVE.B	1(A4),(A4)+
	CMP.L	L651(PC),A4
	BNE.S	L325_7
NODELPRE:
	BSR	PRALL
	bsr	L504
	bsr	L504
	bsr	L504
	bra	L316

CURSRIGHT:
	cmp.l	L651(PC),a6
	BEQ	L316
	ADDQ.L	#1,A6
	addq.w	#8,L649
	bsr	L246
	BSR	PRALL
	bsr	L504
	bsr	L504
	bsr	L504
	bra	L316

CURSLEFT:
	cmp.L	EDITSTPOI,A6
	BEQ	L316
	SUBQ.L	#1,A6
	subq.w	#8,L649
	bsr	L246
	BSR	PRALL
	bsr	L504
	bsr	L504
	bsr	L504
	bra	L316

MODF1RUT:
	MOVE.L	EDITSTPOI(PC),A6
	LEA	DEFA(PC),A4
	MOVEQ	#DEFAEND-DEFA,D7
MODF1LO:MOVE.B	(A4)+,(A6)+
	DBF	D7,MODF1LO

L328:	MOVE.L	L651(PC),A0
	CLR.B	(A0)

	MOVE.L	EDITSTPOI(PC),A6
L329_3:	MOVE.L	A6,A4
L329_2:	TST.B	(A4)+
	BNE.S	L329_2
	SUBQ.L	#1,A4
L329_5:	CMP.L	L651(PC),A4
	BEQ.S	L329_4
	CLR.B	(A4)+
	BRA.S	L329_5

L329_4:	clr.w	L649
	move.w	#$010e,L650
	BSR	L246
	CLR.W	MYEDIT
	CLR.W	L647
	BRA	PR2ALL

DEFA:	DC.B	'st-00:modules/',0,0
DEFAEND:

PRINTQUANT:
	LEA	QUANT(PC),A0
	MOVEQ	#0,D0
	MOVE.B	(A0)+,D0
	ADD.W	#$30,D0
	MOVE.B	D0,(A0)

	MOVE.L	#[103*40]+6,L629
	MOVE.L	A0,L635
	MOVEQ	#1,D0
	MOVE.L	D0,L636
	BRA	L562

QUANT:	DC.B	1,0
QUW:	DC.B	0
	DC.B	0

QUANTADD:
	TST.B	QUW
	BEQ.S	QUGO
	ADDQ.B	#1,QUW
	CMP.B	#17,QUW
	BLT	RTS
	CLR.B	QUW
QUGO:	ADDQ.B	#1,QUW
	MOVEQ	#1,D5
	TST.W	L511
	BNE.S	QSUB
	BTST	#2,$DFF016
	BNE.S	QUANTCH
QSUB:	MOVEQ	#-1,D5
QUANTCH:BSR	L124LEFT
	MOVE.B	QUANT(PC),D0
	ADD.B	D5,D0
	CMP.B	#$9,D0
	BLE.S	QK
	MOVEQ	#$9,D0
QK:	CMP.B	#$1,D0
	BGE.S	QOK
	MOVEQ	#1,D0
QOK:	MOVE.B	D0,QUANT
	BSR	L124LEFT
	BSR	PRINTQUANT
	BSR	L504
	BRA	L504

L330:	MOVE.W	L667,D0
	CLR.B	QUW
	CMP.W	#61,D0
	BLE.S	QUANTADD
	bsr	L308
	bsr	L138
	clr.l	L631
	move.l	L697(PC),a6
	move.w	#$6c+[5*8],L649
	move.w	#$6c,L650
	bsr	L246
	move.l	a6,L651
	add.l	#$13,L651
	bsr	L315
	clr.l	L651
	bra	L309

L332:	TST.W	L658
	BEQ	RRTS
	CMP.W	#$121,L667
	BGE	CLEARSAMPLE
;	bsr	L308
;	bsr	L139
;	bra	L309

	bsr	L308
	bsr	L138
	clr.l	L631
	move.l	L697(PC),a6
	lea	-$a(a6),a6
	move.w	L658,d7
	mulu	#$1e,d7
	add.l	d7,a6
	move.w	#$6c,L649
	move.w	#$77,L650
	bsr	L246
	move.l	a6,L651
	add.l	#$15,L651
	bsr	L315
	bsr	L552
	clr.l	L651
	bra	L309

CLEARSAMPLE:
	BSR	L124
	lea	L698,a0
	moveq	#0,d0
	move.w	L658,d0
	asl.w	#$2,d0
	move.l	(a0,d0.w),d1
	beq.s	CLEAR2
	move.l	$7c(a0,d0.w),d0
	move.l	d1,a1
	move.l	$04.w,a6
	jsr	-$00d2(a6)
CLEAR2:	move.w	L658,d0
	LEA	M_LS,A0
	MOVE.B	#4,(A0,D0.W)
	MOVE.B	#48,$20(A0,D0.W)
	LEA	LJUDPERIODS,A0
	ASL.W	#1,D0
	MOVE.W	#$18,(A0,D0.W)
	asl.w	#1,d0
	lea	L698,a0
	CLR.L	(A0,D0.W)
	CLR.L	$7C(A0,D0.W)
	LEA	IFFSHIT,A0
	CLR.L	(A0,D0.W)

	moveq	#0,d0
	move.w	L658,d0
	mulu	#$1e,d0
	move.l	L697(PC),a0
	SUB.l	#$A,a0
	add.l	d0,a0

	moveq	#29,d0
CLRLE:	CLR.B	(A0,D0.W)
	DBF	D0,CLRLE
	MOVE.W	#1,$1C(A0)
	BSR	STP
	MOVE.W	#1,PRINTFREE
	BSR	L552
	BSR	SHOWSAMPLE
	BSR	L504
	BSR	L504
	BSR	L504
	BRA	L504

L334:	BSR	STP
	clr.W	L647
	lea	L583,a0
	moveq	#$1b,d0
L335:	clr.b	(a0)+
	dbf	d0,L335
	LEA	L698,a0
	moveq	#0,d0
	move.w	L658,d0
	asl.w	#$2,d0
	move.l	(a0,d0.w),d1
	beq.s	L336
	move.l	$7c(a0,d0.w),d0
	move.l	d1,a1
	move.l	$04.w,a6
	jsr	-$00d2(a6)
L336:	move.w	L658,d0
	LEA	M_LS,A0
	MOVE.B	#4,(A0,D0.W)
	MOVE.B	#48,$20(A0,D0.W)
	asl.w	#1,d0
	LEA	LJUDPERIODS,a0
	MOVE.W	#$18,(A0,D0.W)
	LEA	L698,a0
	move.w	L658,d0
	asl.w	#$2,d0
	CLR.L	(A0,D0.W)
	CLR.L	$7C(A0,D0.W)
	LEA	IFFSHIT,A0
	CLR.L	(A0,D0.W)
	moveq	#0,d0
	move.w	L658,d0
	mulu	#$1e,d0
	move.l	L697(PC),a0
	add.l	#$c,a0
	add.l	d0,a0
	moveq	#0,d0
	move.w	(a0),d0
	add.l	d0,d0
	move.l	d0,L690
	sub.l	#$16,a0
	MOVE.W	$18(A0),OLDVOL
	AND.W	#$FF,OLDVOL
	CLR.B	$19(A0)	;VOL=0
	LEA	L583,a1

	cmp.w	#'El',(a0)
	bne.L	noElsound
	moveq	#0,d0
	move.b	2(a0),d0
	bne.s	noElSkipsound

	moveq	#0,d0
	move.w	L658,d0
	mulu	#$1e,d0
	move.l	L697(PC),a0
	SUB.l	#$A,a0
	add.l	d0,a0
	MOVE.W	OLDVOL,D0
	MOVE.B	D0,$19(A0)
	MOVE.W	$1A(A0),D0
	ADD.W	$1C(A0),D0
	CMP.W	$16(A0),D0
	BLE.s	MPTY
	LSR.W	#1,$1A(A0)
	MOVE.W	$1A(A0),D0
	ADD.W	$1C(A0),D0
	CMP.W	$16(A0),D0
	BLE.s	MPTY
	CLR.W	$1A(A0)
	MOVE.W	#1,$1C(A0)
mpty:	clr.w	L645
	MOVE.W	#1,PRINTFREE
	BRA	PRINTFREEMEM

noElskipsound:
	subq.w	#1,d0
	mulu	#$1e,d0
	move.l	#PLST,a0
	add.l	d0,a0

	moveq	#$15,d0
L337:	move.b	(a0)+,(a1)+
	dbf	d0,L337

	move.l	L690,-(a7)
	move.l	#CrunchShitLen,L690
	move.l	CrunchShitPoi,L688
	move.l	#L583,L687
	bsr	L573
	move.l	(a7)+,L690

	move.l	CrunchShitPoi,a0
	cmp.w	#'El',(a0)
	bne	LoadPresetErr
	move.l	(a0),d0
	eor.l	#'Elin',d0
	lea	(a0,d0.l),a0
	move.l	(a0),d0
	move.l	d0,d7
	BEQ	LoadPresetErr
	move.l	#$10002,d1
	move.l	$04.w,a6
	jsr	-$c6(a6)
	TST.L	D0
	BEQ	LOADPRESETERR
	move.l	d0,L688
	LEA	L698,a0
	moveq	#0,d1
	move.w	L658,d1
	asl.w	#$2,d1
	move.l	L688,(a0,d1.w)
	move.l	d7,$7c(a0,d1.w)

	move.l	L688,TimeDest
	jsr	Decrunch
	bra	GoAfterTime

noElsound:
	moveq	#$15,d0
	TST.B	LOADTHESAMPLEFLAG
	BEQ.s	L3372
	LEA	LOADSAMPLENAMEPOJ,A0
	MOVEQ	#$17,D0
L3372:	move.b	(a0)+,(a1)+
	dbf	d0,L3372

	move.l	#L583,L687
	cmp.b	#$3a,L584
	beq.s	L338
	move.l	#L582,L687
L338:	move.l	L690,d0
	BEQ.S	L338_2
	move.l	#$10002,d1
	move.l	$04.w,a6
	jsr	-$c6(a6)
	TST.L	D0
	BEQ	LOADPRESETERR
L338_2:	move.l	d0,L688
	bsr	L552
	LEA	L698,a0
	moveq	#0,d1
	move.w	L658,d1
	asl.w	#$2,d1
	move.l	L688,(a0,d1.w)
	move.l	L690,$7c(a0,d1.w)
	bsr	L573
GoAfterTime:
	MOVE.L	L688,A0
	MOVE.L	L690,D0
	LSR.L	#1,D0
	CMP.L	#$100,D0
	BLE.S	IFFLOOP
	MOVE.W	#$100,D0
IFFLOOP:CMP.L	#'BODY',(A0)
	BEQ.S	FOUND
	ADDQ.L	#$2,A0
	DBF	D0,IFFLOOP
	BRA	NEJDETVARINTEIFF

LOADPRESETERR:
	move.w	L658,d0
	mulu	#$1e,d0
	move.l	L697(PC),a0
	sub.l	#$A,a0
	CLR.L	$16(A0,D0.W)
	CLR.L	$1A(A0,D0.W)
	MOVE.W	#1,PRINTFREE
	BRA	L139

FOUND:	MOVE.L	L688,A1
	MOVE.L	A0,A2
	SUB.L	A1,A2
	ADDQ.L	#4,A2
	MOVE.W	L658,d0
	ASL.W	#$2,d0
	LEA	IFFSHIT,A0
	MOVE.L	A2,(A0,D0.W)


	MOVE.L	A2,D1

	MOVE.W	L658,D0
	ASL.W	#$2,D0
	LEA	L698,A1
	MOVE.L	$7C(A1,D0.W),D7
	MOVE.L	(A1,D0.W),D0
	MOVE.L	D0,SAMPLEBUFFER
	MOVE.L	D0,A0
	MOVE.L	D7,SAMPLEBUFFERLEN
	MOVE.L	A0,A1
	ADD.L	D1,A0
	CMP.L	A0,A1
	BEQ	CLE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IRNAM,d1
	moveq	#-2,d2
	jsr	-$0054(a6)
	move.l	d0,L709
	beq.s	NOLOCKK
	MOVE.L	L709,D1
	MOVE.L	#DISKSPSHIT,D2
	JSR	-$72(A6)
	MOVE.L	DISKSPSHIT+12,D0
	SUB.L	DISKSPSHIT+16,D0
	MOVE.W	D0,DISKBLOCKSFREE
	move.l	L709,d1
	jsr	-$005a(a6)
NOLOCKK:
	LEA	L79(PC),A5
	SUBQ.W	#1,$10(A5)
	MOVE.L	(A5),A0
	MOVE.L	A0,A1
	ADD.L	#$1C,A1
	MOVE.W	DELETENO,D0
	MOVE.W	$10(A5),D7
	SUB.W	D0,D7
	MULU	#$1C,D0
	ADD.L	D0,A0
	ADD.L	D0,A1
	BRA.S	DELNL
DELNAILOP:
	MOVE.L	(A1)+,(A0)+
	MOVE.L	(A1)+,(A0)+
	MOVE.L	(A1)+,(A0)+
	MOVE.L	(A1)+,(A0)+
	MOVE.L	(A1)+,(A0)+
	MOVE.L	(A1)+,(A0)+
	MOVE.L	(A1)+,(A0)+
DELNL:	DBF	D7,DELNAILOP
DELNOMANAGE:
	BSR	L504
	BSR	L504
	tst.w	L708
	beq.S	LR75
	LEA	L79(pc),a5
	move.w	L80,d0
	move.w	$0010(a5),d1
	subq.w	#$7,d1
	cmp.w	d1,d0
	BLE.S	LR75
	SUBQ.W	#1,D0
	BPL.S	LR75
	CLR.W	D0
LR75:	BSR	L107
	rts




L340:	bsr	L138
	MOVEQ	#-1,D0
	bsr	L125
	bne.w	L342
	BSR	L124
	BSR	L504
	clr.b	L647
	LEA	L691,a0
	LEA	L581,a1
	moveq	#$13,d0
L341:	move.b	(a0)+,(a1)+
	dbf	d0,L341
	move.l	#L580,L687
	move.l	L686,a6
	move.l	L687,d1
	move.l	d1,a0
	jsr	-$0048(a6)

	MOVE.L	D0,-(A7)	;DELETE .NT
	LEA	L580,A0
L852_2:	TST.B	(A0)+
	BNE.S	L852_2
	MOVE.B	#'.',-1(A0)
	MOVE.B	#'N',(A0)
	MOVE.B	#'T',1(A0)
	MOVE.B	#0,2(A0)
	move.l	L686,a6
	move.l	L687,d1
	move.l	d1,a0
	jsr	-$0048(a6)
	MOVE.L	(A7)+,D0

	TST.L	D0
	BEQ.S	DELSONGERR
	BSR	DELETENAMEINLIST
	bra	L133
DELSONGERR:
L342:	BSR	DELNOMANAGE
	bsr	L139
	bra	L133

;L343:	bsr	L138
;	MOVEQ	#-1,D0
;	bsr	L125
;	bne	L345
;	BSR	L124
;	BSR	L504
;	clr.b	L647
;	LEA	L82,A0
;	LEA	L585,A1
;	MOVEQ	#$21,D1
;L343_2:	MOVE.B	(A0)+,D0
;	BEQ.S	L343_3
;	MOVE.B	D0,(A1)+
;	DBF	D1,L343_2

;L343_3:	LEA	L691,a0
;	moveq	#$1B,d0
;L344:	move.b	(a0)+,(a1)+
;	dbf	d0,L344
;	move.l	#L585,L687
;	move.l	L686,a6
;	move.l	L687,d1
;	move.l	d1,a0
;	jsr	-$0048(a6)

;	MOVE.L	D0,-(A7)	;DELETE .NT
;	LEA	L585,A0
;L952_2:	TST.B	(A0)+
;	BNE.S	L952_2
;	MOVE.B	#'.',-1(A0)
;	MOVE.B	#'N',(A0)
;	MOVE.B	#'T',1(A0)
;	MOVE.B	#0,2(A0)
;	move.l	L686,a6
;	move.l	L687,d1
;	move.l	d1,a0
;	jsr	-$0048(a6)
;	MOVE.L	(A7)+,D0

;	TST.L	D0
;	BEQ.S	DELMODERR
;	BSR	DELETENAMEINLIST
;	bra	L133

;DELMODERR:
;L345:	BSR	DELNOMANAGE
;	bsr	L139
;	BRA	L133

TuneLoadHeader:
	blk.b	$10,0
	blk.w	$1f,0
TuneLoadHeaderEnd:

LoadErri:
	move.l	L689,d1
	jsr	-$0024(a6)
	clr.l	L689
	bra	LoadModErr

L346:	bsr	L363
	BSR	CLEARTIMER
	clr.b	L647
	bsr	L301		;deallocate samples
	move.l	L697(PC),a0
	add.l	#$43c,a0
	move.w	#$3fff,d0
L347:	clr.l	(a0)+
	dbf	d0,L347
	LEA	L581,a0
	moveq	#$1b,d0
L348:	clr.b	(a0)+
	dbf	d0,L348
	LEA	L691,a0
	LEA	L581,a1
	moveq	#$13,d0
L349:	move.b	(a0)+,(a1)+
	dbf	d0,L349

	bsr	L135
	move.l	L686,a6
	move.l	#L580,d1	;Music:filename
	move.l	#$3ed,d2
	jsr	-$001e(a6)
	move.l	d0,L689
	beq	LoadModErr	;clearTune

	move.l	L689,d1
	move.l	#TuneLoadHeader,d2
	move.l	#TuneLoadHeaderEnd-TuneLoadHeader,d3
	jsr	-$002a(a6)
	lea	TuneLoadHeader(pc),a0
	cmp.l	#'Gnom',(a0)+
	bne	LoadErri
	cmp.l	#'ie B',(a0)+
	bne	LoadErri
	cmp.l	#'y Ni',(a0)+
	bne	LoadErri
	cmp.l	#'ght!',(a0)+
	bne	LoadErri

	lea	TuneLoadHeader+$10(pc),a5
	move.w	#1,L658

LoadTuneInstr:
	moveq	#0,d0
	move.w	(a5)+,d0
	move.l	$04.w,a6
	move.l	#$10002,d1
	move.l	d0,-(a7)
	jsr	-$00c6(a6)
	move.l	(a7)+,d6
	move.w	L658,d7
	lsl.w	#$2,d7
	tst.l	d0
	beq.s	Nouy
	LEA	L698,a0
	move.l	d0,(a0,d7.w)
	move.l	d6,$7c(a0,d7.w)
	move.l	L686,a6
	move.l	L689,d1
	move.l	d0,d2
	move.l	d6,d3
	jsr	-$002a(a6)
Nouy:	MOVE.W	#1,PRINTFREE
	addq.w	#1,L658
	cmp.w	#$20,L658
	bne	LoadTuneInstr
	move.w	#1,L658

	move.l	L686,a6
	move.l	L689,d1
	move.l	L697(pc),d2
	move.l	#$1143c,d3
	jsr	-$002a(a6)
	move.l	L689,d1
	jsr	-$0024(a6)
	clr.l	L689

	move.l	L697(PC),a0
	cmp.l	#$5041434b,(a0)	;PACK
	bne.s	L350
	move.l	$0004(a0),L379
	move.l	$0008(a0),L376
	move.l	L697(PC),d0
	add.l	#$1143c,d0
	sub.l	L376,d0
	move.l	d0,L374
	bsr	L410
L350:
	move.l	L697(PC),a0
	MOVE.L	$438(A0),D1
	EOR.L	#$31415926,D1
	CMP.L	#$77040a72,D1	;'FEST'
	BNE	LoadModErr

	MOVE.L	L697(PC),A0
	MOVE.B	$3B7(A0),D0
	CMP.B	#$78,D0
	BNE.S	L351_2
	CLR.B	$3B7(A0)
	CLR.W	D0
L351_2:	CMP.B	$3B6(A0),D0
	BLT.S	NORESOVERLEN2
	CLR.B	$3B7(A0)
NORESOVERLEN2:
	BSR	CLEARNT
	LEA	L580,A0
	MOVE.L	A0,D1
	MOVEQ	#$4B,D0
L352_2:	TST.B	(A0)+
	BEQ.S	L352_3
	DBF	D0,L352_2
	BRA.s	NONT2
L352_3:	MOVE.B	#'.',-1(A0)
	MOVE.B	#'N',(A0)
	MOVE.B	#'T',1(A0)
	MOVE.B	#0,2(A0)
	move.l	L686,a6
	move.l	#$3ed,d2
	jsr	-$1e(a6)
	TST.L	D0
	BEQ.S	NONT2
	move.l	d0,L689
	move.l	d0,d1
	move.l	#M_SAVEBLOCK,d2
	move.l	#M_SAVEBLOCKEND-M_SAVEBLOCK,d3
	jsr	-$2a(a6)
	move.l	L689,d1
	jsr	-$0024(a6)
NONT2:	clr.l	L637
	clr.l	L693
	bsr	L548
	bsr	L543
	clr.w	L652
	bsr	L507
	bsr	L552
	bsr	L550
	BSR	L353
	LEA	L719,a0
	moveq	#$1e,d0
L352:	move.l	(a0)+,d1
	move.w	d1,L658
	movem.l	d0-d1/a0,-(a7)
	move.l	L697(pc),a0
	mulu	#$1e,d1
	lea	-$a(a0,d1.w),a0
	cmp.w	#'El',(a0)
	bne.s	NoLoadThis
	bsr	L334
NoLoadThis:
	movem.l	(a7)+,d0-d1/a0
	dbf	d0,L352
	move.w	#1,L658
	move.l	#$6,L642

	bsr	L137
	moveq	#0,d0		;commandorutin
	move.w	L658,d0
	mulu	#$1e,d0
	move.l	L697(PC),a0
	lea	-$a(a0,d0.w),a0
	moveq	#$1,d7
commandoloop:
	move.l	L518,a1
	move.w	#$05b,$2(a1)
	move.w	#$049,$6(a1)
	move.w	#$006,$a(a1)

	movem.l	d7/a0,-(a7)

	cmp.l	#'Mupp',(a0)
	bne.s	krolla
	movem.l	d0-d7/a0-a6,-(a7)
	move.w	d7,L658
	bsr	interpolcalculator
	movem.l	(a7)+,d0-d7/a0-a6
	bra	nokroom
Krolla:
	bsr	KollaEl
nokroom:
	movem.l	(a7)+,d7/a0
	lea	$1e(a0),a0
	addq.w	#1,d7
	cmp.w	#$20,d7
	bne	commandoloop
	MOVE.W	#$1,L658
	bsr	L552
	bsr	L134
	bra	PrintModDir


UndoLastCommand:
	bsr	L124
	moveq	#0,d0
	move.w	L658,d0
	mulu	#$1e,d0
	move.l	L697(PC),a0
	lea	-$a+3(a0,d0.w),a0
	cmp.w	#'El',-3(a0)
	bne	L139
	moveq	#0,d0
grekst:	moveq	#0,d1
	move.b	(a0),d1
	beq	L139
	sub.w	#$41,d1
	lea	commands(pc),a2
	move.b	(a2,d1.w),d1
	ext.w	d1
	tst.b	1(a0,d1.w)
	beq.s	Grupp5
	lea	1(a0,d1.w),a0
	moveq	#1,d0
	bra.s	grekst
Grupp5:	tst.b	-1(a0)
	bne.s	Grupp6
	tst.l	d0
	beq	L139
Grupp6:	clr.b	(a0)+
	dbf	d1,Grupp6


ReMakeInstr:
	move.w	L658,d1
	move.l	L697(pc),a0
	mulu	#$1e,d1
	lea	-$a(a0,d1.w),a0
	cmp.w	#'El',(a0)
	bne.s	NopLoadThis
	bsr	L334
NopLoadThis:
	moveq	#0,d0		;commandorutin
	move.w	L658,d0
	move.l	d0,d7
	mulu	#$1e,d0
	move.l	L697(PC),a0
	lea	-$a(a0,d0.w),a0
	bra.s	KollaEl


nocommando:
	rts
kollaEl:cmp.w	#'El',(a0)
	bne	nocommando
	move.l	a0,a1
	lea	3(a1),a1

comloop2:
	move.b	(a1)+,d0
	beq	nocommando
	move.w	d7,L658
	cmp.b	#'A',d0
	bne.s	noFadeOut
	moveq	#0,d1
	move.b	(a1)+,d1
	asl.w	#8,d1
	or.b	(a1)+,d1
	movem.l	d7/a1,-(a7)	;save ljudno + pos i instr-data
	bsr	LoadFadeOut
	movem.l	(a7)+,d7/a1
	bra.s	comloop2
NoFadeOut:
	cmp.b	#'B',d0
	bne.s	noFadeIn
	moveq	#0,d1
	move.b	(a1)+,d1
	asl.w	#8,d1
	or.b	(a1)+,d1

	movem.l	d7/a1,-(a7)	;save ljudno + pos i instr-data
	bsr	LoadFadeIn
	movem.l	(a7)+,d7/a1
	bra.s	comloop2
NoFadeIn:
	cmp.b	#'C',d0
	bne.s	NoFilte
	movem.l	d7/a1,-(a7)
	bsr	FiltTT
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoFilte:
	cmp.b	#'D',d0
	bne.s	NoReva
	movem.l	d7/a1,-(a7)
	bsr	Reva
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoReva:
	cmp.b	#'E',d0
	bne.s	noChangeVo
	moveq	#0,d5
	move.b	(a1)+,d5
	asl.w	#8,d5
	or.b	(a1)+,d5
	movem.l	d7/a1,-(a7)
	bsr	ChangeVo
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoChangeVo:
	cmp.b	#'F',d0
	bne.s	noOctUp
	moveq	#0,d5
	move.b	(a1)+,octfrom
	move.b	d7,octto
	movem.l	d7/a1,-(a7)
	bsr	Octie
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoOctUp:
	cmp.b	#'G',d0
	bne.s	noOctDown
	moveq	#0,d5
	move.b	(a1)+,octfrom
	move.b	d7,octto
	movem.l	d7/a1,-(a7)
	bsr	Octdie
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoOctDown:
	cmp.b	#'H',d0
	bne.s	noAkoMaker
	moveq	#0,d5
	move.b	(a1)+,d5
	move.w	d5,L658
	move.b	(a1)+,d5
	move.w	d5,AkkoPeriods
	move.b	(a1)+,d5
	move.w	d5,AkkoPeriods+2
	move.b	(a1)+,d5
	move.w	d5,AkkoPeriods+4
	move.b	d7,AkkoDest
	movem.l	d7/a1,-(a7)
	bsr	AkoProdukter
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoAkoMaker:
	cmp.b	#'I',d0
	bne.s	noCoppy
	move.b	(a1)+,cofrom
	move.b	d7,coto
	movem.l	d7/a1,-(a7)
	bsr	CopparOxid
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoCoppy:
	cmp.b	#'J',d0
	bne.s	noCutLeft
	move.b	(a1)+,cofrom
	move.b	d7,coto
	moveq	#0,d1
	move.b	(a1)+,d1
	asl.w	#8,d1
	move.b	(a1)+,d1
	movem.l	d7/a1,-(a7)
	bsr	CuttaLeft
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoCutLeft:
	cmp.b	#'K',d0
	bne.s	noCutRight
	move.b	(a1)+,cofrom
	move.b	d7,coto
	moveq	#0,d1
	move.b	(a1)+,d1
	asl.w	#8,d1
	move.b	(a1)+,d1
	movem.l	d7/a1,-(a7)
	bsr	CuttaRight
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoCutRight:
	cmp.b	#'L',d0
	bne.s	noCutBoth
	move.b	(a1)+,cofrom
	move.b	d7,coto
	moveq	#0,d1
	move.b	(a1)+,d1
	asl.w	#8,d1
	move.b	(a1)+,d1
	moveq	#0,d2
	move.b	(a1)+,d2
	asl.w	#8,d2
	move.b	(a1)+,d2
	movem.l	d7/a1,-(a7)
	bsr	CuttaBoth
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoCutBoth:
	cmp.b	#'M',d0
	bne.s	noMix
	move.b	d7,MixToo
	move.b	(a1)+,MixFr
	move.b	(a1)+,MixFrom1Vol
	move.b	(a1)+,MixFr2
	move.b	(a1)+,MixFrom2Vol
	movem.l	d7/a1,-(a7)
	bsr	JetteMixer
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoMix:	cmp.b	#'N',d0
	bne.s	noTZero
	move.b	d7,CoTo
	move.b	(a1)+,CoFrom
	move.b	(a1)+,ZeroLength
	move.b	(a1)+,ZeroLength+1
	movem.l	d7/a1,-(a7)
	bsr	SZeroNow
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoTZero:
	cmp.b	#'O',d0
	bne.s	noTZcop
	move.b	d7,CoTo
	move.b	(a1)+,CoFrom
	move.b	(a1)+,ZeroLength
	move.b	(a1)+,ZeroLength+1
	movem.l	d7/a1,-(a7)
	bsr	SZcopNow
	movem.l	(a7)+,d7/a1
	bra	comloop2
NoTZcop:
	rts

L353:	movem.l	d0-d1/d3-d4/a0-a1,-(a7)
	move.l	L697(PC),a0
	add.l	#$17,a0
	LEA	L719,a1
	moveq	#$01,d0
L354:	move.b	(a0)+,(a1)+
	move.b	(a0),(a1)+
	move.w	d0,(a1)+
	add.l	#$1d,a0
	addq.l	#1,d0
	cmp.l	#$20,d0
	bne.s	L354
L355:	clr.w	L718
	LEA	L719,a0
	moveq	#$1d,d2
L356:	move.w	(a0),d0
	move.w	$4(a0),d1
	cmp.w	d1,d0
	bgt.s	L359
L357:	addq.l	#$4,a0
	dbf	d2,L356
	tst.w	L718
	bne.s	L355
	LEA	L719,a0
	moveq	#$1e,d0
L358:	clr.w	(a0)
	addq.l	#$4,a0
	dbf	d0,L358
	movem.l	(a7)+,d0-d1/d3-d4/a0-a1
	rts

L359:	move.w	#$0001,L718
	move.l	(a0),d3
	move.l	$0004(a0),d4
	move.l	d4,(a0)
	move.l	d3,$0004(a0)
	bra.s	L357

L360:	move.l	L697(PC),a0
	move.l	a0,a1
	add.l	#$101d6,a0
	add.l	#$1d2,a1
L361:	move.l	(a0),$1e4(a0)
	clr.l	(a0)
	subq.l	#$4,a0
	cmp.l	a0,a1
	bne.s	L361
	move.l	L697(PC),a0
	move.l	a0,a1
	add.l	#$3b6,a0
	add.l	#$438,a1
L362:	move.w	$4(a0),(a0)+
	cmp.l	a0,a1
	bne.s	L362
	move.l	#'FEST',(a0)
	MOVE.L	L697(PC),A0
	ADD.L	#-$A+[$10*$1E]+$1C,A0
	MOVEQ	#$E,D0
L362_2:	MOVE.W	#1,(A0)
	ADD.L	#$1E,A0
	DBF	D0,L362_2
	rts

L363:	bsr	L134
	clr.b	L647
	clr.l	L631
	clr.l	L632
	clr.w	L699
	jsr	mt_end
	BRA	STP

L364:	bsr	L308
	tst.l	L720
	beq.s	L366
	tst.w	L658
	beq.s	L366
	clr.b	L647
	move.w	L659,d0
	subq.w	#1,d0
	mulu	#$1e,d0
	move.l	#PLST,a0
	add.l	d0,a0
	move.w	L658,d0
	mulu	#$1e,d0
	move.l	L697(PC),a1
	LEA	-$a(a1,d0.w),a1
	move.l	a1,a2
	moveq	#$1d,d0
L365f:	move.b	(a0)+,(a1)+
	dbf	d0,L365f

	MOVE.L	A2,A1
	MOVE.W	#'El',(a1)+	;totalt $16 bytes (hela namnet)
	move.w	l659,d0
	move.b	d0,(a1)+
	clr.b	(a1)+
	clr.w	(a1)+
	clr.l	(a1)+
	clr.l	(a1)+
	clr.l	(a1)+
	clr.l	(a1)+

	TST.W	$1C(A2)
	BNE.W	L365_2
	MOVE.W	#1,$1C(A2)
L365_2:	bsr	L334
L366:	bsr	L552
	bra	L309

L367:	bsr	L363
	bsr	L137
	bsr	L507
	move.l	#'edit',L631
	rts

L368:	MOVE.L	L697(PC),A0
	MOVE.L	#'FEST',$438(A0)
	TST.L	(A0)
	BEQ	L139
	bsr	L363
	clr.b	L647
	bsr	ClearNotUsedWaves
	move.l	L697(PC),a0
	add.l	#$3b8,a0
	moveq	#0,d0
	moveq	#0,d1
	moveq	#0,d2
	clr.w	L657
L369:	move.b	(a0,d0.w),d1
	addq.w	#1,d0
	cmp.w	#$80,d0
	bgt.s	L370
	move.w	L657,d2
	cmp.w	d2,d1
	ble.s	L369
	move.w	d1,L657
	bra.s	L369

L370:	move.l	L697(PC),a0
	LEA	L581,a1
	moveq	#$13,d0
L371:	move.b	(a0)+,(a1)+
	dbf	d0,L371
	move.l	#L580,L687
	move.l	L697(PC),L688
	move.l	#$43c,L690
	moveq	#0,d0
	move.w	L657,d0
	addq.l	#1,d0
	lsl.l	#$8,d0
	lsl.l	#$2,d0
	add.l	d0,L690

	bsr	L135	;grooon
	move.l	L686,a6		;open file
	move.l	#L580,d1	;Music:Filename
	move.l	#$3ee,d2
	jsr	-$1e(a6)
	move.l	d0,d7
	beq	L139	;error
	MOVE.L	L697,A5
	LEA	-$A+$1E(A5),A5
	lea	TuneHeader+$10(pc),a4
	moveq	#$1e,d6
SaveTuneLoop:
	moveq	#0,d1
	move.w	(a5),d0
	and.w	#$1f1f,d0
	cmp.w	#'st'&$1f1f,d0
	bne.s	skipthiss
	cmp.b	#':',5(a5)
	bne.s	skipthiss
	move.w	$16(a5),d1
	add.w	d1,d1
skipthiss:
	move.w	d1,(a4)+
	lea	$1e(a5),a5
	dbf	d6,SaveTuneLoop
	move.l	L686,a6
	move.l	d7,d1
	move.l	#TuneHeader,d2
	move.l	#TuneHeaderEnd-TuneHeader,d3
	jsr	-$0030(a6)
	tst.l	d0
	beq	TuneErr
	lea	TuneHeader+$10(pc),a4
	moveq	#$1,d6
SaveTIns:
	move.w	(a4)+,d5
	beq.s	TuneNoInstr
	movem.l	d6/a4,-(a7)
	bsr	SaveIn
	movem.l	(a7)+,d6/a4
	tst.l	d0
	bne	TuneErr
TuneNoInstr:
	addq.w	#1,d6
	cmp.w	#$20,d6
	bne	SaveTins

	move.l	d7,-(a7)
	BSR	L372	;CRUNCH
	move.l	(a7)+,d7

	move.l	L686,a6
	move.l	d7,d1
	move.l	L688,d2
	move.l	L690,d3
	jsr	-$0030(a6)
	tst.l	d0
	beq.s	TuneErr
	move.l	L686,a6
	move.l	d7,d1
	jsr	-$0024(a6)
	BSR	SAVENT
	bsr	L410
	BSR	INTERPOLall
	bra	L134

TuneErr:move.l	L686,a6
	move.l	d7,d1
	jsr	-$0024(a6)
	bra	L139

TuneHeader:
	dc.b	"Gnomie By Night!"
	blk.w	$1f,0
TuneHeaderEnd:



SaveIn:	move.w	d6,d0
	lsl.w	#$2,d0
	lea	L698,a0
	move.l	(a0,d0.w),d1
	beq.L	AlfRts
	move.l	d1,d2		;d2=memstart
	and.l	#$ffff,d5
	move.l	d5,d3		;d3=length

	move.l	L686,a6
	move.l	d7,d1
	jsr	-$0030(a6)
	tst.l	d0
	beq.w	L449
	moveq	#$00,d0
	rts
L449:	moveq	#-1,d0
	rts



SAVENT:	LEA	L580,A0
	MOVE.L	A0,L687
L444_2:	TST.B	(A0)+
	BNE.s	L444_2
	MOVE.B	#'.',-1(A0)
	MOVE.B	#'N',(A0)
	MOVE.B	#'T',1(A0)
	MOVE.B	#0,2(A0)
	MOVE.L	#M_SAVEBLOCK,L688
	MOVE.L	#M_SAVEBLOCKEND-M_SAVEBLOCK,L690
	BRA	L576

L647:	DC.B	0
OLDKEY:	DC.B	0
L648:	blk.b	2,0
L649:	blk.b	2,0
L650:	blk.b	2,0
L652:	blk.b	2,0
L653:	blk.b	2,0
L654:	blk.b	2,0
L655:	blk.b	1,0
L656:	blk.b	1,0
L657:	blk.b	2,0
L658:	blk.b	2,0

L372:	bsr	L135
	move.l	L697(PC),a0
	move.l	a0,a1
	add.l	#$c,a1
	move.l	a1,L377
	move.l	a0,a1
	add.l	#$1143c,a1
	move.l	a1,L375
	move.l	a0,a1
	add.l	#$1143c,a1
	sub.l	L690,a1
	move.l	a1,L374
	move.l	L690,L376
	move.l	L697(PC),a0
	MOVE.L	A0,A1
	add.l	L690,a0
	add.l	#$0001143c,a1
	move.l	L690,d0
L373:	move.b	-(a0),-(a1)
	subq.l	#1,d0
	bne.s	L373
	bsr.s	L380
	sub.l	L377,a2
	move.l	a2,d0
	move.l	d0,L379
	move.l	d0,d1
	add.l	L377,d1
	move.l	d1,L378
	move.l	L697(PC),a0
	move.l	#$5041434b,(a0)	;PACK
	move.l	L379,$4(a0)	;CRUNCHEDLENGTH
	move.l	L376,$8(a0)	;ORIGLENGTH
	move.l	L697(PC),L688
	move.l	L379,d0
	addi.l	#$c,d0
	move.l	d0,L690
	rts

L380:	move.l	L374,a0	;START
	move.l	L375,a1	;END
	move.l	L377,a2	;DEST
	moveq	#$01,d2
	clr.w	d1
L381:	bsr.s	L383
	tst.b	d0
	beq.s	L382
	addq.w	#1,d1
	cmp.w	#$0108,d1
	bne.s	L382
	bsr	L403
L382:	cmp.l	a0,a1
	bgt.s	L381
	bsr	L403
	bra	L408

L383:	move.l	a0,a3
	add.l	#$7f,a3
	cmp.l	a1,a3
	ble.s	L384
	move.l	a1,a3
L384:	moveq	#$01,d5
	move.l	a0,a5
	addq.l	#1,a5
L385:	move.b	(a0),d3
	move.b	$1(a0),d4
L386:	cmp.b	(a5)+,d3
	bne.s	L387
	cmp.b	(a5),d4
	beq.s	L388
L387:	cmp.l	a5,a3
	bgt.s	L386
	bra.s	L395

L388:	subq.l	#1,a5
	move.l	a0,a4
L389:	move.b	(a4)+,d3
	cmp.b	(a5)+,d3
	bne.s	L390
	cmp.l	a5,a3
	bgt.s	L389
L390:	move.l	a4,d3
	sub.l	a0,d3
	subq.l	#1,d3
	cmp.l	d3,d5
	bge.s	L394
	move.l	a5,d4
	sub.l	a0,d4
	sub.l	d3,d4
	subq.l	#1,d4
	cmp.l	#$4,d3
	ble.s	L392
	moveq	#$06,d6
	cmp.l	#$101,d3
	blt.s	L391
	move.w	#$100,d3
L391:	bra.s	L393

L392:	move.w	d3,d6
	subq.w	#$2,d6
	lsl.w	#1,d6
L393:	LEA	L400,a6
	cmp.w	(a6,d6.w),d4
	bge.s	L394
	move.l	d3,d5
	move.l	d4,L398
	move.b	d6,L399
L394:	cmp.l	a5,a3
	bgt.w	L385
L395:	cmp.l	#1,d5
	beq.w	L397
	bsr.w	L403
	move.b	L399,d6
	move.l	L398,d3
	move.w	$08(a6,d6.w),d0
	bsr	L406
	move.w	$10(a6,d6.w),d0
	beq.w	L396
	move.l	d5,d3
	subq.w	#1,d3
	bsr	L406
L396:	move.w	$18(a6,d6.w),d0
	move.w	$20(a6,d6.w),d3
	bsr.w	L406
	addi.w	#$0001,$28(a6,d6.w)
	add.l	d5,a0
	clr.b	d0
	rts

L397:	move.b	(a0)+,d3
	moveq	#$08,d0
	bsr.s	L406
	moveq	#$01,d0
	rts

L400:	dc.W	$0100,$0200,$0400,$1000,$0008,$0009,$000a,$0008
	blk.b	7,$00
	dc.B	$08,$00,$02,$00,$03,$00
	dc.B	$03,$00,$03,$00,$01,$00
	dc.B	$04,$00,$05,$00,$06
	blk.b	8,$00

L403:	tst.w	d1
	beq.s	L404
	move.w	d1,d3
	clr.w	d1
	cmp.w	#9,d3
	bge.s	L405
	addq.w	#1,L401
	subq.w	#1,d3
	moveq	#5,d0
	bra.s	L406

L404:	rts

L405:	addq.w	#1,L402
	subi.w	#$0009,d3
	ori.w	#$0700,d3
	moveq	#$0b,d0
L406:	subq.w	#1,d0
L407:	lsr.l	#1,d3
	roxl.l	#1,d2
	bcs.s	L409
	dbf	d0,L407
	rts

L408:	clr.w	d0
L409:	move.l	d2,(a2)+
	moveq	#$01,d2
	dbf	d0,L407
	rts

L410:	move.l	L697(PC),a0
	add.l	#$c,a0
	move.l	L374,a1
	move.l	L379,d0
	move.l	L376,d1
	bsr.s	L413
	move.l	L374,a0
	move.l	L697(PC),a1
	move.l	L376,d0
L411:	move.b	(a0)+,(a1)+
	subq.l	#1,d0
	bne.s	L411
	move.l	L697(PC),a0
	MOVE.L	A0,A1
	add.l	#$1143c,a0
	add.l	L376,a1
	sub.l	a1,a0
	move.l	a0,d0
L412:	clr.b	(a1)+
	subq.l	#1,d0
	bne.s	L412
	rts

L413:	add.l	d0,a0
	move.l	d1,a2
	add.l	a1,a2
	move.l	-(a0),d0
L414:	lsr.l	#1,d0
	bne.s	L415
	bsr.s	L427
L415:	bcs.s	L422
	moveq	#$08,d1
	moveq	#$01,d3
	lsr.l	#1,d0
	bne.w	L416
	bsr.w	L427
L416:	bcs.s	L424
	moveq	#$03,d1
	clr.w	d4
L417:	bsr.s	L428
	move.w	d2,d3
	add.w	d4,d3
L418:	moveq	#$07,d1
L419:	lsr.l	#1,d0
	bne.w	L420
	bsr.w	L427
L420:	roxl.l	#1,d2
	dbf	d1,L419
	move.b	d2,-(a2)
	dbf	d3,L418
	bra.s	L426

L421:	moveq	#$08,d1
	moveq	#$08,d4
	bra.s	L417

L422:	moveq	#$02,d1
	bsr.s	L428
	cmp.b	#$02,d2
	blt.s	L423
	cmp.b	#$03,d2
	beq.s	L421
	moveq	#$08,d1
	bsr.s	L428
	move.w	d2,d3
	move.w	#$0008,d1
	bra.s	L424

L423:	move.w	#$0009,d1
	add.w	d2,d1
	addq.w	#$2,d2
	move.w	d2,d3
L424:	bsr.s	L428
L425:	subq.w	#1,a2
	move.b	$00(a2,d2.w),(a2)
	dbf	d3,L425
L426:	cmp.l	a2,a1
	blt.s	L414
	rts

L427:	move.l	-(a0),d0
	move	#$0010,ccr
	roxr.l	#1,d0
	rts

L428:	subq.w	#1,d1
	clr.w	d2
L429:	lsr.l	#1,d0
	bne.s	L430
	move.l	-(a0),d0
	move	#$0010,ccr
	roxr.l	#1,d0
L430:	roxl.l	#1,d2
	dbf	d1,L429
	rts

L431:	bsr	L363
	bsr	L135
	BSR	CLEARTIMER
	clr.b	L647
	bsr	L301
	LEA	LJUDPERIODS,A0
	MOVEQ	#$1F,D7
C2ETULO:MOVE.W	#$18,(A0)+
	DBF	D7,C2ETULO
	move.l	L697(PC),a0
	add.l	#$43c,a0
	move.w	#$3fff,d0
L432:	clr.l	(a0)+
	dbf	d0,L432
	LEA	L82,A0	;MODULEDIR
	LEA	L585,A1	;LOADNAME
	MOVEQ	#$21,D1
L432_2:	MOVE.B	(A0)+,D0
	BEQ.S	L432_3
	MOVE.B	D0,(A1)+
	DBF	D1,L432_2

L432_3:	LEA	L691,a0
	moveq	#$1b,d0
L433:	move.b	(a0)+,(a1)+
	dbf	d0,L433
	move.l	L686,a6
	move.l	#L585,d1
	move.l	#$3ed,d2
	jsr	-$1e(a6)
	TST.L	D0
	BEQ	LOADMODERR
	move.l	d0,L689
	move.l	d0,d1
	move.l	L697(PC),d2
	move.l	#$43c,d3
	jsr	-$2a(a6)
	move.l	L697(PC),a0
	MOVE.L	$438(A0),D1
	EOR.L	#$31415926,D1
	cmp.l	#$7C6F1208,D1	;'M.K.'
	beq.s	L434
	CMP.L	#$7C671207,D1	;'M&K!'
	BNE.S	NOTRQ
	BRA.S	L434
NOTRQ:	CMP.L	#$697B746D,D1	;'X:-K'
	BNE.S	NOT2Q
	BRA.S	L434
NOT2Q:	CMP.L	#$90061407,D1	;'¡GM!'	;ALT-i = ¡
	BNE.S	NOT3Q
	BRA.S	L434
NOT3Q:
NOT4Q:	move.l	L689,d1
	moveq	#0,d2
	moveq	#-1,d3
	jsr	-$0042(a6)
	move.l	L689,d1
	move.l	L697(PC),d2
	move.l	#$258,d3
	jsr	-$002a(a6)
	bsr	L360
L434:	move.l	L697(PC),a0
	MOVE.L	#'FEST',$438(A0)
	MOVE.B	$3B7(A0),D0
	CMP.B	#$78,D0
	BNE.S	L434_2
	CLR.B	$3B7(A0)
	CLR.W	D0
L434_2:	CMP.B	$3B6(A0),D0
	BLT.S	NORESOVERLEN
	CLR.B	$3B7(A0)
NORESOVERLEN:
	add.l	#$3b8,a0
	moveQ	#$7F,d0
	moveq	#0,d3
L435:	cmp.b	(a0)+,d3
	bgt.s	L436
	move.b	-$1(a0),d3
L436:	dbf	d0,L435
	addq.w	#1,d3
	mulu	#$400,d3
	move.l	L689,d1
	move.l	L697(PC),d2
	addi.l	#$43c,d2
	jsr	-$002a(a6)
	clr.l	L637
	clr.l	L693
	bsr	L548
	bsr	L543
	clr.w	L652
	bsr	L507
	bsr	L552
	bsr	L550
	move.w	#1,L658
L437:	bsr	L552
	move.l	L697(PC),a0
	move.w	L658,d7
	mulu	#$1e,d7
	moveq	#0,d0
	move.w	$c(a0,d7.w),d0
	BEQ	L438

	LEA	-$A(A0,D7.W),A0
	MOVE.W	$1A(A0),D7
	ADD.W	$1C(A0),D7
	CMP.W	$16(A0),D7
	BLE.S	LMODREP
	LSR.W	#1,$1A(A0)
	MOVE.W	$1A(A0),D7
	ADD.W	$1C(A0),D7
	CMP.W	$16(A0),D7
	BLE.S	LMODREP
	CLR.W	$1A(A0)
	MOVE.W	#1,$1C(A0)

LMODREP:add.l	d0,d0
	move.l	$04.w,a6
	move.l	#$10002,d1
	move.l	d0,-(a7)
	jsr	-$00c6(a6)
	move.l	(a7)+,d6
	move.w	L658,d7
	lsl.w	#$2,d7
	tst.l	d0
	beq.s	L438
	LEA	L698,a0
	move.l	d0,(a0,d7.w)
	move.l	d6,$7c(a0,d7.w)
	LEA	L698,A0
	move.l	L686,a6
	move.l	L689,d1
	move.l	d0,d2
	move.l	d6,d3
	jsr	-$002a(a6)
L438:	MOVE.W	#1,PRINTFREE
	addq.w	#1,L658
	cmp.w	#$20,L658
	bne	L437
	move.l	L689,d1
	jsr	-$0024(a6)
	BSR	EMPTYLWORDS
	move.w	#$0001,L658
	move.l	#$06,L642
	BSR	CLEARNT
	LEA	L585,A0
	MOVE.L	A0,D1
	MOVEQ	#$4B,D0
L244_2:	TST.B	(A0)+
	BEQ.S	L244_3
	DBF	D0,L244_2
	BSR	L134
	BRA	L552
L244_3:	MOVE.B	#'.',-1(A0)
	MOVE.B	#'N',(A0)
	MOVE.B	#'T',1(A0)
	MOVE.B	#0,2(A0)
	move.l	L686,a6
	move.l	#$3ed,d2
	jsr	-$1e(a6)
	TST.L	D0
	BEQ.S	NONT
	move.l	d0,L689
	move.l	d0,d1
	move.l	#M_SAVEBLOCK,d2
	move.l	#M_SAVEBLOCKEND-M_SAVEBLOCK,d3
	jsr	-$2a(a6)
	move.l	L689,d1
	jsr	-$0024(a6)
NONT:	bsr	L134
	bra	L552
LOADMODERR:
	move.l	L518,a0
	move.w	#$0c00,$0002(a0)
	move.w	#$0900,$0006(a0)
	move.w	#$0700,$000a(a0)
	BSR	CLEARTUNE
	BRA	L134

L439:	rts
;	MOVE.L	L697(PC),A0
;	MOVE.L	#'M.K.',$438(A0)
;	TST.L	(A0)
;	BEQ	L139
;	bsr	L135
;	move.l	L697(PC),a0
;	add.l	#$3b8,a0
;	moveq	#0,d0
;	moveq	#0,d1
;	moveq	#0,d2
;	clr.w	L657
;L440:	move.b	(a0,d0.w),d1
;	addq.w	#1,d0
;	cmp.w	#$80,d0
;	bgt.s	L441
;	move.w	L657,d2
;	cmp.w	d2,d1
;	ble.s	L440
;	move.w	d1,L657
;	bra.s	L440

;L441:	lea	L453(pc),a0
;	moveq	#$4F,d0
;L442:	clr.b	(a0)+
;	dbf	d0,L442
;	LEA	L82,A0
;	LEA	L453,A1
;	MOVEQ	#$21,D1
;L442_2:	MOVE.B	(A0)+,D0
;	BEQ.S	L442_3
;	MOVE.B	D0,(A1)+
;	DBF	D1,L442_2

;L442_3:	MOVE.B	#'m',(A1)+
;	MOVE.B	#'o',(A1)+
;	MOVE.B	#'d',(A1)+
;	MOVE.B	#'.',(A1)+
;	move.l	L697(PC),a0
;	moveq	#$1B,d0
;L443:	move.b	(a0)+,(a1)+
;	dbf	d0,L443
;	move.l	L697(PC),L688
;	move.l	#$43c,L690
;	moveq	#0,d0
;	move.w	L657,d0
;	addq.l	#1,d0
;	lsl.l	#$8,d0
;	lsl.l	#$2,d0
;	add.l	d0,L690
;	bsr	L448
;	bne	L445
;	bsr	L450
;	bne	L445
;	moveq	#1,d6
;L444:	bsr.s	L446
;	addq.b	#1,d6
;	cmp.b	#$20,d6
;	bne.s	L444
;	bsr	L452
;	LEA	L453,A0
;L344_2:	TST.B	(A0)+
;	BNE.S	L344_2
;	MOVE.B	#'.',-1(A0)
;	MOVE.B	#'N',(A0)
;	MOVE.B	#'T',1(A0)
;	MOVE.B	#0,2(A0)
;	BSR	L448
;	BNE.S	L445	
;	MOVE.L	#M_SAVEBLOCK,L688
;	MOVE.L	#M_SAVEBLOCKEND-M_SAVEBLOCK,L690
;	BSR	L450
;	BNE.S	L445
;	BSR	L452
;	bra	L134

;L445:	bra	L139

L456:	btst	#6,$bfe001
	beq.s	L456
	clr.l	L631
	bsr	L363
	bsr	L136
L457:	clr.w	L699
	move.l	L515,a0
	move.w	#$3200,(a0)
	clr.l	L692
	move.l	#'patt',L632
	jmp	music_init

SV_INSERT:
	BSR	L124
	move.l	L697(PC),a0
	add.l	#$3b8+$7E,a0
	MOVE.W	#$7F,D7
	SUB.W	L693+2,D7
	BRA.S	SV_L2OP
SV_BLO:	MOVE.B	(A0),1(A0)
	SUBQ.L	#1,A0
SV_L2OP:DBF	D7,SV_BLO
	MOVE.L	L697(PC),A0
	MOVE.W	L693+2,D1
	MOVE.B	$3B6(A0),D0
	CMP.B	D0,D1
	BGE.S	NOLENY
	ADDQ.B	#1,$3B6(A0)
	TST.B	$3B6(A0)
	BPL.S	NOLENY
	MOVE.B	#$7F,$3B6(A0)
NOLENY:
	MOVE.B	$3B7(A0),D0
	CMP.B	D0,D1
	BGE.S	LENA
	CMP.B	#$7E,D0
	BGE.S	LENA
	ADDQ.B	#1,$3B7(A0)
LENA:
	BSR	L124
	BSR	L548
	BSR	L550
	bsr	L504
	bsr	L504
	bsr	L504
	BRA	L504

SV_DELETE:
	BSR	L124
	move.l	L697(PC),a0
	add.l	#$3b8,a0
	add.l	L693,a0
	MOVE.W	#$7F,D7
	SUB.W	L693+2,D7
	BRA.S	SV_LOOP
SV_ALO:	MOVE.B	1(A0),(A0)+
SV_LOOP:DBF	D7,SV_ALO
	CLR.B	(A0)
	MOVE.L	L697(PC),A0
	MOVE.W	L693+2,D1
	MOVE.B	$3B6(A0),D0
	SUBQ.B	#1,D0
	CMP.B	D0,D1
	BGE.S	NOLENU
	SUBQ.B	#1,$3B6(A0)
NOLENU:	TST.B	$3B6(A0)
	BNE.S	NOLEN56
	MOVE.B	#1,$3B6(A0)
NOLEN56:
	MOVE.B	$3B6(A0),D0
	MOVE.B	$3B7(A0),D0
	CMP.B	D0,D1
	BGE.S	NOLEQU
	SUBQ.B	#1,$3B7(A0)
NOLEQU:
	BSR	L124
	BSR	L548
	BSR	L550
	bsr	L504
	bsr	L504
	bsr	L504
	BRA	L504

NEWLOOP:MOVE.W	L658,D0
	CMP.W	SASND,D0
	BNE	TIM_RTS
	TST.W	SAPER
	BEQ	TIM_RTS
	TST.W	SAREP
	BEQ	TIM_RTS

	move.l	L697(PC),a0
	move.w	L658,d0
	mulu	#$1e,d0
	LEA	-10(A0,D0.W),A0

	MOVE.W	$1A(A0),SANEWREP
	MOVE.W	$1C(A0),SANEWLEN

	MOVEQ	#0,D0
	MOVE.W	$1A(A0),D0
	ASL.W	#1,D0
	ADD.L	L673,D0

	MOVE.L	SACHAMPO2,A2
	MOVE.L	D0,$A(A2)
	MOVE.W	$1C(A0),$E(A2)
	MOVE.L	SACHAMPOS,A1
	MOVE.L	D0,(A1)
	MOVE.W	$1C(A0),4(A1)
	MOVE.W	#1,SANEWGO
	RTS

SOUNDREPEAT:
	MOVE.W	L660,D1
	BNE.S	GURKE
	ADDQ.W	#1,D1
GURKE:	MOVEQ	#0,D0
	MOVE.B	5(A0),D0
	CMP.B	6(A0),D0
	BNE.S	NUBBE
	TST.W	D1
	BPL.S	NOCHANNN
NUBBE:	ADD.W	D1,D0
	BPL.S	NOCHANNN
	MOVEQ	#0,D0
NOCHANNN:
	MOVE.B	D0,5(A0)
	BRA	SHOWSOUND

L458:	move.l	L697(PC),a0
	moveq	#0,d0
	move.w	L658,d0
	beq.s	L460
	mulu	#$1e,d0
	LEA	-10(A0,D0.W),A0
	CMP.L	#'Mupp',(A0)
	BEQ.S	SOUNDREPEAT
	LEA	$16(A0),A0
	cmpi.w	#-1,L660
	beq.s	L461
	addq.w	#1,$4(a0)
	btst	#2,$dff016
	bne.s	L459
	addq.w	#$7,$4(a0)
L459:	move.w	(a0),d0
	sub.w	6(a0),d0
	cmp.w	4(a0),d0
	bgt.s	L460
	TST.W	D0
	BPL.S	NEGER
	MOVEQ	#0,D0
NEGER:	move.w	d0,4(a0)
L460:	BSR	NEWLOOP
	bra	L552

L461:	subq.w	#1,4(a0)
	btst	#2,$dff016
	bne.s	L462
	subq.w	#7,4(a0)
L462:	tst.w	4(a0)
	bpl.s	L460
	clr.w	4(a0)
	bra.s	L460

SOUNDREPEND:
	MOVE.W	L660,D1
	BNE.S	GURKI
	ADDQ.W	#1,D1
GURKI:	MOVEQ	#0,D0
	MOVE.B	6(A0),D0
	CMP.B	5(A0),D0
	BNE.S	SNUBBE
	TST.W	D1
	BMI.S	NOCHJANGE
SNUBBE:	ADD.W	D1,D0
	CMP.W	#63,D0
	BLT.S	NOCHJANGE
	MOVE.W	#63,D0
NOCHJANGE:
	MOVE.B	D0,6(A0)
	BRA	SHOWSOUND

L463:	move.l	L697(PC),a0
	moveq	#0,d0
	move.w	L658,d0
	beq.s	L465
	mulu	#$1e,d0
	LEA	-10(A0,D0.W),A0
	CMP.L	#'Mupp',(A0)
	BEQ.S	SOUNDREPEND
	LEA	$16(A0),A0
	cmp.w	#-1,L660
	beq.s	L466
	addq.w	#1,$6(a0)
	btst	#$02,$dff016
	bne.s	L464
	addq.w	#$7,$6(a0)
L464:	move.w	(a0),d0
	sub.w	$4(a0),d0
	cmp.w	$0006(a0),d0
	bgt.s	L465
	TST.W	D0
	BNE.S	SETNORM
	MOVEQ	#1,D0
SETNORM:move.w	d0,$0006(a0)
L465:	BSR	NEWLOOP
	bra	L552

L466:	subq.w	#1,$0006(a0)
	btst	#$02,$dff016
	bne.s	L467
	subq.w	#$7,$0006(a0)
L467:	cmpi.w	#$0001,$0006(a0)
	bge.s	L465
	move.w	#$0001,$0006(a0)
	bra.s	L465

L468:
	move.l	L697(PC),a0
	add.l	#$c,a0
	moveq	#$00,d0
	move.w	L658,d0
	tst.w	d0
	beq.s	L470
	mulu	#$1e,d0
	add.l	d0,a0
	cmpi.w	#-1,L660
	beq.s	L471
	addq.w	#1,(a0)
	btst	#$02,$dff016
	bne.s	L469
	addq.w	#$7,(a0)
L469:	TST.w	(a0)
	BPL.s	L470
	move.w	#$7fff,(a0)
L470:	MOVE.W	L658,D0
	ASL.W	#$2,D0
	LEA	L698,A1
	MOVE.L	$7C(A1,D0.W),D1
	LSR.L	#1,D1
	CMP.W	(A0),D1
	BCC.S	LENGDOLK
	MOVE.W	D1,(A0)
LENGDOLK:
	MOVE.B	#1,PRINTSOUND
	bra	L552

L471:	subq.w	#1,(a0)
	btst	#$02,$dff016
	bne.s	L472
	subq.w	#$7,(a0)
L472:	MOVE.W	$4(A0),D0
	ADD.W	$6(A0),D0
	CMP.W	(A0),D0
	BLE.S	L470
	TST.W	$4(A0)
	BEQ.S	GUL
NOGUL:	MOVE.W	D0,(A0)
	bra.s	L470
GUL:	CMP.W	#1,$6(A0)
	BNE.S	NOGUL
	CLR.W	(A0)
	BRA.S	L470

L473:	cmpi.w	#-1,L660
	beq.s	L476
	move.l	L697(PC),a0
	add.l	#$c,a0
	moveq	#$00,d0
	move.w	L658,d0
	tst.w	d0
	beq.s	L475
	mulu	#$1e,d0
	add.l	d0,a0
	addq.B	#1,3(a0)
	cmp.B	#$40,3(a0)
	bmi.s	L474
	move.B	#$40,3(a0)
L474:	BSR	L552
	BTST	#$2,$DFF016
	BNE.S	L475_2
L475:	rts

L475_2:	MOVE.W	#$2000,D0
L475_3:	DBF	D0,L475_3
	RTS

L476:	move.l	L697(PC),a0
	add.l	#$c,a0
	moveq	#0,d0
	move.w	L658,d0
	mulu	#$1e,d0
	add.l	d0,a0
	subq.B	#1,3(a0)
	tst.B	3(a0)
	bpl.s	L477
	clr.B	3(a0)
L477:	BSR	L552
	BTST	#$2,$DFF016
	BEQ.S	L475
	BRA.S	L475_2

L478:	tst.w	L645
	beq.s	L479
	bsr	L552
	clr.w	L645
	rts

L479:	btst	#$02,$dff016
	bne.s	L480
	clr.w	L658
	bSR	L552
	BRA	SHOWSAMPLE

L480:	cmpi.w	#-$0001,L660
	beq.s	L482
	addq.w	#1,L658
	cmp.w	#$001f,L658
	bmi.s	L481
	move.w	#$001f,L658
L481:	bsr	L504
	bsr	L504
	bSR	L552
	BRA	SHOWSAMPLE

L482:	tst.w	L658
	beq.s	L483
	subq.w	#1,L658
	cmp.w	#$0001,L658
	bpl.s	L483
	move.w	#$0001,L658
L483:	bsr	L504
	bsr	L504
	bSR	L552
	BRA	SHOWSAMPLE

L484:	cmpi.w	#-$0001,L660
	beq.s	L486
	move.l	L697(PC),a0
	add.l	#$3b6,a0
	addq.b	#1,1(a0)
	MOVE.B	1(A0),D0
	CMP.B	(A0),D0
	bmi.s	L485
	move.b	(A0),1(a0)
	SUBQ.B	#1,1(A0)
L485:	bsr	L550
	BTST	#$2,$DFF016
	BEQ	L504
	bsr	L504
	bra	L504

L486:	move.l	L697(PC),a0
	add.l	#$3b7,a0
	subq.b	#1,(a0)
	TST.B	(A0)
	bpl.s	L487
	CLR.B	(a0)
L487:	bsr	L550
	BTST	#$2,$DFF016
	BEQ	L504
	bsr	L504
	bra	L504

L492:	cmpi.w	#-1,L660
	beq.s	L494
	move.l	L697(PC),a0
	add.l	#$3b6,a0
	addq.b	#1,(a0)
	cmpi.b	#$7f,(a0)
	bmi.s	L493
	move.b	#$7f,(a0)
L493:	bsr	L550
	BTST	#$2,$DFF016
	BEQ	L504
	bsr	L504
	bra	L504

L494:	move.l	L697(PC),a0
	add.l	#$3b6,a0
	subq.b	#1,(a0)
	cmpi.b	#$01,(a0)
	bpl.s	L495
	move.b	#$01,(a0)
L495:	MOVE.B	1(A0),D0
	CMP.B	(A0),D0
	BNE.S	L495_2
	ADDQ.B	#1,(A0)
L495_2:	bsr	L550
	BTST	#$2,$DFF016
	BEQ	L504
	bsr	L504
	bra	L504

L496:	CMP.L	#'patp',L632
	BNE.S	FRISK
	bsr	L363
FRISK:	cmp.w	#-1,L660
	beq.s	L498
	move.l	L697(PC),a0
	add.l	#$3b8,a0
	add.l	L693,a0
	addq.b	#1,(a0)
	cmp.b	#$3f,(a0)
	bmi.s	L497
	move.b	#$3f,(a0)
L497:	bsr	L548
	BTST	#$2,$DFF016
	BEQ	L504
	bsr	L504
	bsr	L504
	bra	L504

L498:	move.l	L697(PC),a0
	add.l	#$3b8,a0
	add.l	L693,a0
	subq.b	#1,(a0)
	tst.b	(a0)
	bpl.s	L499
	clr.b	(a0)
L499:	bsr	L548
	BTST	#$2,$DFF016
	BEQ	L504
	bsr.s	L504
	bsr.s	L504
	bra.s	L504

L500:	cmp.w	#-$0001,L660
	beq.s	L502
	addq.l	#1,L693
	cmp.l	#$7f,L693
	bmi.s	L501
	move.l	#$7f,L693
L501:	bsr	L548
	BTST	#$2,$DFF016
	BEQ.S	L504
	bsr.s	L504
	bsr.s	L504
	bra.s	L504

L502:	subq.l	#1,L693
	tst.l	L693
	bpl.s	L503
	clr.l	L693
L503:	bsr	L548
	BTST	#$2,$DFF016
	BEQ.S	L504
	bsr.s	L504
	bsr	L504
L504:	move.w	#$4600,d0
L505:	dbf	d0,L505
	rts

TIM1:	DC.B	$0	;FRAMES
TIM5:	DC.B	$30	;SECONDS
TIM4:	DC.B	$30	;10 SECONDS
	DC.B	':'
TIM3:	DC.B	$30	;MINUTES
TIM2:	DC.B	$30	;10 MINUTES
	DC.B	$0
TIMGO:	DC.B	$1
TIMDC:	DC.W	$0

TIMER:	ADDQ.W	#1,TIMDC
	CMP.W	#596,TIMDC
	BNE.S	TIME6
	BSR.S	TIME6
	CLR.W	TIMDC

TIME6:	ADDQ.B	#1,TIM1
NTSC1:	CMP.B	#50,TIM1
	BLT.S	TIM_RTS

	SUB.B	#50,TIM1
	ADDQ.B	#1,TIM2
	CMP.B	#$3A,TIM2
	BNE.S	TIM_PRT

	MOVE.B	#$30,TIM2
	ADDQ.B	#1,TIM3
	CMP.B	#$36,TIM3
	BNE.S	TIM_PRT

	MOVE.B	#$30,TIM3
	ADDQ.B	#1,TIM4
	CMP.B	#$3A,TIM4
	BNE.S	TIM_PRT

	MOVE.B	#$30,TIM4
	ADDQ.B	#1,TIM5
	CMP.B	#$3A,TIM5
	BNE.S	TIM_PRT

	MOVE.B	#$30,TIM5

TIM_PRT:MOVE.B	#1,TIMGO
TIM_RTS:RTS


L505_2:	MOVEM.L	D0-D7/A0-A6,-(A7)
	CMP.L	#'patp',L632
	BNE.S	NOTIM
	BSR	TIMER
NOTIM:	MOVE.L	L697(PC),A0
	MOVE.B	$3B6(A0),L588
	TST.L	L632
	BEQ	NoPlayMode	;(sedan till L505_U)

	ADDQ.L	#1,L695
	MOVE.L	L695,D0
	CMP.L	L642,D0
	BLT.S	L505_4
	CLR.L	L695
	BRA	L505_F

L505_4:
INGETAVSTANG:
;	LEA	L592,A6
	 LEA	INGETAVSTANG(PC),A6
	 ADD.L	#L592-INGETAVSTANG,A6
	LEA	$DFF0A0,A5
	BSR	L577_2
	bsr	ProgHandler
	LEA	L593,A6
	LEA	$DFF0B0,A5
	BSR	L577_2
	bsr	ProgHandler
	LEA	L594,A6
	LEA	$DFF0C0,A5
	BSR	L577_2
	bsr	ProgHandler

	lea	ca0(pc),a6
	bsr	ca577_2
	bsr	caPerCalc
	lea	ca1(pc),a6
	bsr	ca577_2
	bsr	caPerCalc
	lea	ca2(pc),a6
	bsr	ca577_2
	bsr	caPerCalc
	lea	ca3(pc),a6
	bsr	ca577_2
	bsr	caPerCalc
	BRA	L505_U

NoPlayMode:		;handle all prog
	LEA	L592,A6
	LEA	$DFF0A0,A5
	bsr	ProgHandler
	LEA	L593,A6
	LEA	$DFF0B0,A5
	bsr	ProgHandler
	LEA	L594,A6
	LEA	$DFF0C0,A5
	bsr	ProgHandler
	BRA	L505_U

L505_8:	move.l	A0,-(A7)
	MOVE.L	L695,D0
	DIVS	#3,D0
	SWAP	D0
	TST.W	D0
	BEQ.S	L505_B
	CMP.W	#2,D0
	BEQ.S	L505_A

L505_9:	MOVEQ	#0,D0
	MOVE.B	$3(A6),D0
	LSR.B	#$4,D0
	BRA.S	L505_C
L505_A:	MOVEQ	#0,D0
	MOVE.B	$3(A6),D0
	AND.B	#$F,D0
	BRA.S	L505_C
L505_B:	MOVE.W	$10(A6),D2
	BRA.S	L505E3
L505_C:	ASL.W	#1,D0
	MOVEQ	#0,D2
	MOVE.W	$10(A6),D2
	AND.W	#$FFF,D2

	LEA	L602,A0
	MOVEQ	#[L603-L602]/2,D7
L505_D:	CMP.W	(A0)+,D2
	BGE.S	L505_E
	DBF	D7,L505_D
	MOVE.L	(A7)+,A0
	RTS
L505_E:	MOVE.W	-2(A0,D0.W),D2
L505E3:	MOVE.W	D2,D0
	BSR	PERCALC
	move.l	(A7)+,A0
	RTS

L505_F:	MOVE.L	L697(PC),A0
L505_G:	MOVE.L	A0,A3
	MOVE.L	A0,A2
	ADD.L	#$C,A3
	ADD.L	#$3B8,A2
	ADD.L	#$43C,A0
	CMP.L	#'patp',L632
	BEQ.S	L505_H
	MOVE.L	L637,D1
	BRA.S	L505_I
SONGREC1:
	MOVEQ	#0,D1
	MOVE.L	L693,D0
	MOVE.B	(A2,D0.L),D1
	MOVE.L	D1,L637
	BRA.S	L505_I
L505_H:	CMP.L	#'edit',L631
	BEQ.S	SONGREC1
	MOVEQ	#0,D1
	MOVE.L	L693,D0
	MOVE.B	(A2,D0.L),D1
L505_I:	LSL.L	#8,D1
	LSL.L	#2,D1
	ADD.L	L692,D1
	MOVE.L	D1,L696

	and.l	#$fffffbf0,d1	;bara jamna patts

	move.l	d1,d0		;kolla om patt=progljud -> stop play
	AND.L	#$FFFFFC00,D0
	add.l	#$3C0,d0
	tst.b	(a0,d0.l)
	bpl.s	nosyncing
	bsr	l134
	clr.l	L631
	clr.l	L632
	MOVE.W	#$F,$DFF096
	CLR.W	SAPER
	BRA	L505_U

NOSYNCING:
	CLR.W	L701
NOP0:	LEA	$DFF0A0,	A5
	LEA	L592,		A6
	LEA	L49_2(PC),	A2
	MOVE.W	L50,D0
	AND.W	#1,D0
	BEQ.S	NOP01
	BSR.W	L505_J
	BRA.S	NOP1
NOP01:	CLR.W	2(A6)
NOP1:	ADDQ.L	#4,D1
	LEA	$DFF0B0,	A5
	LEA	L593,		A6
	LEA	L49_3(PC),	A2
	MOVE.W	L50,D0
	AND.W	#2,D0
	BEQ.S	NOP02
	BSR.S	L505_J
	BRA.S	NOP2
NOP02:	CLR.W	2(A6)
NOP2:	ADDQ.L	#4,D1
	LEA	$DFF0C0,	A5
	LEA	L594,		A6
	LEA	L49_4(PC),	A2
	MOVE.W	L50,D0
	AND.W	#4,D0
	BEQ.S	NOP03
	BSR.S	L505_J
	BRA.S	NOP3
NOP03:	CLR.W	2(A6)
NOP3:
	add.l	#$400-$8,d1
	lea	ca0(pc),a6
	bsr	ca_rut
	addq.l	#$4,d1
	lea	ca1(pc),a6
	bsr	ca_rut
	addq.l	#$4,d1
	lea	ca2(pc),a6
	bsr	ca_rut
	addq.l	#$4,d1
	lea	ca3(pc),a6
	bsr	ca_rut
	BRA	L505_M

L505_J:	MOVE.L	(A0,D1.L),(A6)
	MOVEQ	#0,D2
	MOVE.B	2(A6),D2
	LSR.B	#4,D2
	MOVE.B	(A6),D0
	AND.B	#$F0,D0
	OR.B	D0,D2
	TST.B	D2
	BEQ	L505_L
	MOVEQ	#0,D3
	MOVE.L	D2,D4
	LEA	L698,A1
	LSL.L	#2,D2
	MULU	#$1E,D4
	MOVE.L	$0(A1,D2.L),$04(A6)	;instrmemstart
	MOVE.B	-$16+$18(A3,D4.L),$1E(A6)	;CURRSTAMM

	clr.b	$1c(a6)	;prog on/off
	CMP.L	#'Mupp',-$16(a3,d4.l)
	bne.s	noprgo
	move.l	a0,-(a7)
	move.b	#1,$1c(a6)	;prog on
	move.l	l697,a0
	lea	$43c(a0),a0
	moveq	#0,d2
	move.b	-$16+$4(a3,d4.l),d2	;pattno
	mulu	#$400,d2
	lea	(a0,d2.l),a0
	move.l	a0,4(a6)	;proginstr data-start
	moveq	#0,d2
	MOVE.B	$3C0(A0),$12(A6)
	AND.B	#$7F,$12(A6)
	move.b	$380(a0),d2
	mulu	#$20,d2
	lea	(a0,d2.w),a0
	move.l	a0,$a(a6)	;loopstartmempoi = startmempoi
	move.B	$3(a3,d4.l),$13(a6)	;volume
	move.b	-$16+$5(a3,d4.l),8(a6)	;dataloopstart
	move.b	-$16+$6(a3,d4.l),9(a6)	;dataloopend
	move.w	#$10,$e(a6)	;looplen
	move.l	(a7)+,a0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CLR.B	$1B(A6)
	clr.b	$1d(a6)	;proglj-datacou

	tst.b	$1c(a6)	;prog on/off
	beq.s	normalljudstart
	move.l	$a(a6),(a5)	;loopstartpoi
	move.w	$e(a6),$4(a5)
	bra.s	onormalljudstart
normalljudstart:
	MOVE.L	$4(A6),(A5)
	MOVE.W	$8(A6),$4(A5)
onormalljudstart:
	MOVE.W	$10(A6),D0
	AND.W	#$FFF,D0
	BSR	PERCALC
	BSR	L19_2

	MOVE.W	$14(A6),D0	;DMASET
	OR.W	D0,L701

EFTERSTOPSUND:
	CMP.W	SACHA,D0
	BNE	L577_F
	CLR.W	SAPER
L505_L2:BRA	L577_F


ProgHandler:	;a6=L592
		;a5=$dff0a0
	tst.b	$1c(a6)		;on/off
	beq.s	norvolum
	movem.l	d0-d1/a0-a1,-(a7)
	moveq	#0,d0
	move.b	$1d(a6),d0	;datacou
	move.l	$4(a6),a0	;datastart
	lea	$380(a0),a1
	move.b	$40(a1,d0.w),d1
	and.w	#$7f,d1
	move.b	d1,$12(a6)	;progvolume
	move.b	(a1,d0.w),d1
	mulu	#$20,d1
	lea	(a0,d1.w),a1
	move.l	a1,$a(a6)	;loopstartmempoi

	move.b	$1d(a6),d0
	addq.b	#1,d0
	cmp.b	$9(a6),d0	;dataloopend
	ble.s	norestartofdata
	move.b	$8(a6),d0	;dataloopstart
norestartofdata:
	move.b	d0,$1d(a6)
	movem.l	(a7)+,d0-d1/a0-a1
norvolum:
	MOVEQ	#0,D0
	MOVE.B	$13(A6),D0
	MOVEQ	#0,D3
	MOVE.B	$12(A6),D3
	MULU	D3,D0
	LSR.W	#$6,D0
	MOVE.W	D0,$8(A5)	;VOLUME
	MOVE.L	$A(A6),(A5)	;POI
	MOVE.W	$E(A6),4(A5)	;REPLEN
	rts



L505_M:	MOVE.W	#$12C,D0	;$1F4
L505_N:	DBF	D0,L505_N
	MOVE.W	L701,D0
	AND.W	L50,D0
	OR.W	#$8000,D0
	MOVE.W	D0,$DFF096
	MOVE.W	#$12C,D0
L505_N2:DBF	D0,L505_N2
	LEA	L594,A6
	LEA	$DFF0c0,A5
	BSR	ProgHandler
	LEA	L593,A6
	LEA	$DFF0b0,A5
	BSR	ProgHandler
	LEA	L592,A6
	LEA	$DFF0a0,A5
	BSR	ProgHandler

L505_R:	CMP.L	#'patp',L632
	BNE.S	L505_S
	BSR	L506
L505_S:	CMP.L	#'patt',L632
	BNE.S	L505_T
	BSR	L506
L505_T:	CMP.L	#'edit',L631
	BNE.S	L505_HA
	MOVE.L	L692,D0
	LSR.L	#$4,D0
	MOVE.W	D0,L652

L505_HA:ADD.L	#$10,L692
	CMP.L	#$400,L692
	BNE.S	L505_U
HAHA:	CLR.L	L692
	CLR.W	L681
	CMP.L	#'patp',L632
	BNE.S	L505_U
	ADDQ.L	#1,L693
	AND.L	#$7F,L693
	MOVEQ	#0,D0
	MOVE.W	L587,D0
	MOVE.L	L693,D1
	CMP.L	D0,D1
	BNE.S	L505_U
	MOVEQ	#0,D0
	MOVE.L	L697(PC),A0
	MOVE.B	$3B7(A0),D0
	MOVE.L	D0,L693
L505_U:	TST.W	L681
	BNE.S	HAHA
L505_V:	MOVEM.L	(A7)+,D0-D7/A0-A6
	RTS





Ca_rut:	MOVE.L	(A0,D1.L),(A6)
	MOVEQ	#0,D2
	MOVE.B	2(A6),D2
	LSR.B	#4,D2
	MOVE.B	(A6),D0
	AND.B	#$F0,D0
	OR.B	D0,D2

	TST.B	D2
	BEQ	Caoldinstr
	MOVEQ	#0,D3
	MOVE.L	D2,D4
	LEA	L698,A1
	LSL.L	#2,D2
	MULU	#$1E,D4
	MOVE.L	(A1,D2.L),d0	;instr startmempos

	MOVE.W	$4(A3,D4.L),D3
	TST.W	D3
	beq.s	caNotLooped

	moveq	#0,d2
	move.w	6(a3,d4.l),d2
	add.w	d2,d2
	move.w	d2,$8(a6)	;looplength i bytes
	add.l	d2,d0
	move.w	4(a3,d4.l),d2
	add.w	d2,d2		;bytes to skip at start
	add.l	d2,d0		;d0=loop and instrmemend

	move.l	d0,4(a6)	;instrmemend
	move.l	d0,$a(a6)	;loopendmem

	move.l	d2,d0
	moveq	#0,d0
	move.w	6(a3,d4.l),d0
	add.w	d0,d0
	add.l	d0,d2
	neg.l	d2
	move.l	d2,$2c(a6)	;instrstartcou

	MOVE.B	-$16+$18(A3,D4.L),$1E(A6)	;CURRSTAMM
	MOVE.W	$2(A3,D4.L),$12(A6)	;volume
	move.b	#$40,$12(a6)
	BRA.s	caOldinstr

caNotLooped:
	moveq	#0,d2
	move.w	0(a3,d4.l),d2
	add.w	d2,d2
	add.l	d2,d0
	move.l	d0,4(a6)	;instrmemend
	neg.l	d2
	move.l	d2,$2c(a6)	;instrstartcou

	move.L	#DUMMYSOUNDend,$a(a6)	;loopendmem
	move.w	#dummysoundend-dummysound,$8(a6)	;looplength i bytes

	MOVE.B	-$16+$18(A3,D4.L),$1E(A6)	;CURRSTAMM
	MOVE.W	$2(A3,D4.L),$12(A6)	;volume
	move.b	#$40,$12(a6)


CaOldinstr:
	MOVE.W	(A6),D0
	AND.W	#$FFF,D0
	BEQ	ca505_L2
	MOVE.b	2(A6),D0
	AND.w	#$F,D0
	 CMP.b	#5,D0
	 BEQ.S	caMYPI
	CMP.b	#$3,D0
	BNE.S	caJUP
caMYPI:	BSR	SETMYPORT

ca505_l2:
	BRA	ca577_F

caJUP:	MOVE.W	(A6),$10(A6)
	AND.W	#$FFF,$10(A6)
	move.w	$10(a6),$e(a6)	;thisper
	CLR.B	$1B(A6)
	clr.b	$1d(a6)	;proglj-datacou
	move.l	$2c(a6),$20(a6)		;instrstartcou

	Bsr	ca577_F


caPERCALC:
	moveq	#0,d0
	move.w	$e(a6),d2
	MOVE.B	$1E(A6),D0
	EXT.W	D0
	MULS	D0,D2
	asr.l	#$8,d2
	move.w	$e(a6),d0
	ADD.W	D2,D0

	ext.l	d0
	moveq	#0,d2
	move.w	caperiod(pc),d2
	asl.l	#8,d2
	tst.l	d0
	beq.s	nono
	divu	d0,d2
nono:	ext.l	d2
	asl.l	#8,d2
	swap	d2
	move.l	d2,$24(a6)	;currcalcperiod

	moveq	#0,d0
	move.b	$13(a6),d0
	asl.w	#$8,d0
	add.l	#voldata,d0
	move.l	d0,$28(a6)
	rts

caperiod:	dc.w	$e0

caSETMYPORT:
	MOVE.W	(A6),D2
	AND.W	#$FFF,D2
	MOVE.W	D2,$18(A6)
	MOVE.W	$10(A6),D0
	CLR.B	$16(A6)
	CMP.W	D0,D2
	BEQ.S	caCLRPORT
	BGE	M_RTS
	MOVE.B	#1,$16(A6)
	RTS

caCLRPORT:CLR.W	$18(A6)
	RTS

caMYPORT:
	MOVE.B	$3(A6),D0
	BEQ.S	caMYSLIDE
	MOVE.B	D0,$17(A6)
	CLR.B	$3(A6)
caMYSLIDE:TST.W	$18(A6)
	BEQ	M_RTS
	MOVEQ	#0,D0
	MOVE.B	$17(A6),D0
	TST.B	$16(A6)
	BNE.S	caMYSUB
	ADD.W	D0,$10(A6)
	add.w	d0,$e(a6)
	MOVE.W	$18(A6),D0
	CMP.W	$10(A6),D0
	BGT.S	caMYOK
	MOVE.W	$18(A6),$10(A6)
	move.w	$18(a6),$e(a6)
	CLR.W	$18(A6)
caMYOK:	RTS

caMYSUB:SUB.W	D0,$10(A6)
	sub.w	d0,$e(a6)
	MOVE.W	$18(A6),D0
	CMP.W	$10(A6),D0
	BLT.S	caMYOK
	MOVE.W	$18(A6),$10(A6)
	move.w	$18(a6),$e(a6)
	CLR.W	$18(A6)
	RTS

caVIB:	MOVE.B	$3(A6),D0
	BEQ.S	caVIBRATO
	MOVE.B	D0,$1A(A6)

caVIBRATO:
	MOVE.B	$1B(A6),D0
	LEA	SIN(PC),A4
	LSR.W	#$2,D0
	AND.W	#$1F,D0
	MOVEQ	#0,D2
	MOVE.B	(A4,D0.W),D2
	MOVE.B	$1A(A6),D0
	AND.W	#$F,D0
	MULU	D0,D2
	 LSR.W	#$7,D2
	MOVE.W	$10(A6),D0
	TST.B	$1B(A6)
	BMI.S	caVIBMIN
	ADD.W	D2,D0
	BRA.S	caVIB2
caVIBMIN:SUB.W	D2,D0
caVIB2:	move.w	d0,$e(a6)	;this period
	MOVE.B	$1A(A6),D0
	LSR.W	#$2,D0
	AND.W	#$3C,D0
	ADD.B	D0,$1B(A6)
	RTS


caMegaArp:
	move.l	a0,-(a7)
	MOVEQ	#0,D0
	MOVE.B	$1b(A6),D0
	addq.b	#1,$1b(a6)
	AND.B	#$F,D0
	moveq	#0,d2
	lea	MegaArps(pc),a0
	move.b	3(a6),d2
	and.w	#$f,d2	;16 olika MegaArps
	asl.w	#$4,d2	;mulu	#$10
	add.w	d0,d2
	moveq	#0,d0
	move.b	(a0,d2.w),d0
	add.w	d0,d0

	MOVEQ	#0,D2
	MOVE.W	$10(A6),D2
	AND.W	#$FFF,D2
	LEA	L602,A0
	MOVEQ	#[L603-L602]/2,D7
caMegaAlo:CMP.W	(A0)+,D2
	BGE.S	caMegaFo
	DBF	D7,caMegaAlo
	RTS
caMegaFo:	lea	-2(a0,d0.w),a0
caMegaAgain:
	cmp.l	#PeriodSlutt,a0
	blt.s	caMegaOk
	sub.l	#12*2,a0
	bra.s	caMegaAgain
caMegaOk:
	move.w	(a0),D0
	move.w	d0,$e(a6)	;thisper
	move.l	(a7)+,a0
	RTS


caNEJDU:MOVE.W	$10(A6),$e(a6)
	RTS

ca577_2:MOVE.W	$2(A6),D0
	AND.W	#$FFF,D0
	BEQ	caNEJDU
	MOVE.B	$2(A6),D0
	AND.B	#$F,D0
	BEQ	ca505_8
	CMP.B	#1,D0
	BEQ	ca577_7
	CMP.B	#2,D0
	BEQ	ca577_9
	CMP.B	#3,D0
	BEQ	caMYPORT
	CMP.B	#4,D0
	BEQ	caVIB
	CMP.B	#5,D0
	BEQ	caMYPORTVOLSLIDE
	CMP.B	#6,D0
	BEQ	caVIBVOLSLIDE
	cmp.b	#7,d0
	beq	caMegaArp
	move.w	$10(A6),$e(a6)	;thisper
	CMP.B	#$A,D0
	BNE	M_RTS

ca577_3:MOVEQ	#0,D0
	MOVE.B	$3(A6),D0
	LSR.B	#$4,D0
	TST.B	D0
	BEQ.S	ca577_5
	ADD.B	D0,$13(A6)
	CMP.B	#$40,$13(A6)
	BMI.S	ca577_4
	MOVE.B	#$40,$13(A6)
ca577_4:RTS

ca577_5:MOVEQ	#0,D0
	MOVE.B	$3(A6),D0
	AND.B	#$F,D0
	SUB.B	D0,$13(A6)
	BPL.S	ca577_6
	CLR.B	$13(A6)
ca577_6:RTS

caVIBVOLSLIDE:
	BSR	caVIBRATO
	BRA.S	ca577_3
caMYPORTVOLSLIDE:
	BSR	caMYSLIDE
	BRA.S	ca577_3

ca577_7:MOVEQ	#0,D0
	MOVE.B	$3(A6),D0
	SUB.W	D0,$10(A6)
;	MOVE.W	$10(A6),D0
;	CMP.W	#$71,D0
;	BPL.S	ca577_8
;	MOVE.W	#$71,$10(A6)
ca577_8:MOVE.W	$10(A6),$e(a6)
	RTS

ca577_9:moveq	#0,D0
	MOVE.B	$3(A6),D0
	ADD.W	D0,$10(A6)
;	MOVE.W	$10(A6),D0
;	CMP.W	#$358,D0
;	BMI.S	ca577_A
;	MOVE.W	#$358,$10(A6)
ca577_A:MOVE.W	$10(A6),$e(a6)	;thisper
	RTS

ca577_F:MOVE.B	$2(A6),D0
	AND.B	#$F,D0
	CMP.B	#$D,D0
	BEQ.S	ca577_I
	CMP.B	#$C,D0
	BEQ.S	ca577_K
	MOVE.W	(A6),D2
	AND.W	#$FFF,D2
	BEQ	ca577_2
	RTS

ca577_I:MOVE.W	#1,L681
	RTS

ca577_K:CMP.B	#$40,$3(A6)
	BLS.S	ca577_L
	MOVE.B	#$40,$3(A6)
ca577_L:MOVE.B	$3(A6),$13(A6)
	RTS

ca505_8:move.l	A0,-(A7)
	MOVE.L	L695,D0
	DIVS	#3,D0
	SWAP	D0
	TST.W	D0
	BEQ.S	ca505_B
	CMP.W	#2,D0
	BEQ.S	ca505_A

ca505_9:MOVEQ	#0,D0
	MOVE.B	$3(A6),D0
	LSR.B	#$4,D0
	BRA.S	ca505_C
ca505_A:MOVEQ	#0,D0
	MOVE.B	$3(A6),D0
	AND.B	#$F,D0
	BRA.S	ca505_C
ca505_B:MOVE.W	$10(A6),D2
	BRA.S	ca505E3
ca505_C:ASL.W	#1,D0
	MOVEQ	#0,D2
	MOVE.W	$10(A6),D2
	AND.W	#$FFF,D2

	LEA	L602,A0
	MOVEQ	#[L603-L602]/2,D7
ca505_D:CMP.W	(A0)+,D2
	BGE.S	ca505_E
	DBF	D7,ca505_D
	MOVE.L	(A7)+,A0
	RTS
ca505_E:MOVE.W	-2(A0,D0.W),D2
ca505E3:MOVE.W	D2,D0
	move.w	d0,$e(a6)	;thisper
	move.l	(A7)+,A0
	RTS

Ca0:	blk.b	20,0
	dc.W	0
	BLK.B	26,0
Ca1:	blk.b	20,0
	dc.W	0
	BLK.B	26,0
Ca2:	blk.b	20,0
	dc.W	0
	BLK.B	26,0
Ca3:	blk.b	20,0
	dc.W	0
	BLK.B	26,0








L506:	move.l	L692,d0
	lsr.l	#$4,d0
	bra.s	L508

L507:	move.w	L652,d0
L508:	mulu	#$118,d0
	move.l	L628,a0
	add.l	#$15b8,a0
	add.l	a0,d0
	move.l	L513,a1
	move.w	d0,$6(a1)
	swap	d0
	move.w	d0,$2(a1)
	rts

L508_2:	MOVE.W	$DFF00A,D0
	MOVE.W	D0,D2
	AND.W	#$FF,D0
	MOVE.W	D0,D1
	SUB.W	L661,D0
	MOVE.W	D1,L661
	EXT.W	D0
	CMP.W	#$007F,D0
	BMI.S	L508_3
	MOVE.W	#$FF,D1
	SUB.W	D0,D1
	MOVE.W	D1,D0
	BRA.S	L508_4
L508_3:	CMP.W	#$FF81,D0
	BPL.S	L508_4
	ADD.W	#$FF,D0
L508_4:	ADD.W	D0,L663
	MOVE.W	D2,D0
	LSR.W	#$8,D0
	MOVE.W	D0,D1
	SUB.W	L662,D0
	MOVE.W	D1,L662
	EXT.W	D0
	CMP.W	#$7F,D0
	BMI.S	L508_5
	MOVE.W	#$FF,D1
	SUB.W	D0,D1
	MOVE.W	D1,D0
	BRA.S	L508_6
L508_5:	CMP.W	#$FF81,D0
	BPL.S	L508_6
	ADD.W	#$FF,D0
L508_6:	ADD.W	D0,L664

	TST.W	L663
	BPL.S	L508_7
	CLR.W	L663
L508_7:	CMP.W	#1,L664
	BPL.S	L508_8
	MOVE.W	#1,L664
L508_8:	CMP.W	#$27F,L663
	BMI.S	L508_9
	MOVE.W	#$27F,L663
L508_9:	CMP.W	#$1FF,L664
	BMI.S	L508_A
	MOVE.W	#$1FF,L664
L508_A:	MOVEQ	#0,D0
	MOVE.W	L663,D0
	LSR.W	#1,D0
	MOVE.W	D0,L665
	MOVEQ	#0,D0
	MOVE.W	L664,D0
	LSR.W	#1,D0
	MOVE.W	D0,L666
	RTS

L509:	MOVEM.L	D0/D1/A0/A1/A5/A6,-(A7)
	LEA	$DFF000,A0
	MOVE.L	$04.W,A6
	MOVE.W	$1C(A0),D1
	BTST	#$E,D1
	BEQ.S	L509_4
	AND.W	$1E(A0),D1
	BTST	#$6,D1
	BEQ.S	L509_2
	MOVEM.L	$9C(A6),A1/A5
	PEA	-$24(A6)
	JMP	(A5)

L509_2:	BTST	#$5,D1
	BEQ.S	L509_3
	MOVEM.L	D0-D7/A0-A6,-(A7)
	BSR	L508_2
	BSR	L177
	BSR	L41_2
	BSR	SAMPLEDOT
;	BSR	L505_2
	BSR	L227
	BSR	L18_2
	BSR.S	REPEATRUT
	MOVEM.L	(A7)+,D0-D7/A0-A6
	MOVEM.L	$90(A6),A1/A5
	PEA	-$24(A6)
	JMP	(A5)
L509_3:	BTST	#$4,D1
	BEQ.S	L509_4
	MOVEM.L	$84(A6),A1/A5
	PEA	-$24(A6)
	JMP	(A5)
L509_4:	MOVEM.L	(A7)+,D0/D1/A0/A1/A5/A6
	RTE

REPEATRUT:
	TST.B	REPCON
	BEQ.S	RERTS
	CMP.W	#5,L713
	BEQ.S	RERTS
	ADDQ.B	#1,REPCOU
	CMP.B	#$3,REPCOU
	BNE.S	RERTS
	CLR.B	REPCOU
	MOVE.B	OLDKEY,L647
RERTS:	RTS



MYHARD:	TST.B	NOKEYB
	BNE	OLD682
	MOVEM.L	D0-D7/A0-A6,-(A7)
	MOVE.B	$BFEC01,D0
	NOT.B	D0
	ROR.B	#1,D0
	MOVE.B	#$80,$BFEC01
	CMP.B	OLDHARDK,D0
	BEQ	HAL510_4
	MOVE.B	D0,OLDHARDK

	CMP.B	#$62,D0
	BEQ	HASETREPEAT
	CMP.B	#$E2,D0
	BEQ	HACLRREPEAT
	CMP.B	#$60,D0
	BEQ	HAL510_5
	CMP.B	#$64,D0
	BEQ	HAL511_2
	CMP.B	#$E4,D0
	BEQ	HAL511_3
	CMP.B	#$E0,D0
	BEQ	HAL510_6
	CMP.B	#$43,D0
	BNE.S	HANOPRE
	MOVE.W	#1,ENTERPRESSED
HANOPRE:CMP.B	#$C3,D0
	BNE.S	HANOPRD
	CLR.W	ENTERPRESSED
HANOPRD:CMP.B	#$61,D0
	BNE.S	HAL510_15
	MOVE.W	#1,L511
	CMP.W	#4,L713
	BEQ.S	HAL510_4
	CMP.W	#5,L713
	BEQ.S	HAL510_4
HAL510_15:CMP.B	#$E1,D0
	BNE.S	HANOM
	CLR.W	L511
	CMP.W	#4,L713
	BEQ.S	HAL510_4
	CMP.W	#5,L713
	BEQ.S	HAL510_4
HANOM:	TST.B	D0
	BNE.S	HAHIJ
	MOVE.B	#$70,D0
HAHIJ:	MOVE.B	D0,L647
	MOVE.B	D0,OLDKEY
	CLR.B	REPCOU
HAL510_4:
	MOVEM.L	(A7)+,D0-D7/A0-A6
OLD682:	JMP	$120000
OLD68=OLD682+2
HASETREPEAT:
	MOVE.B	#1,REPCON
	BRA.S	HAL510_4
HACLRREPEAT:
	CLR.B	REPCON
	BRA.S	HAL510_4
HAL510_5:
	MOVE.W	#1,L511
	BRA.S	HAL510_4
HAL510_6:
	CLR.W	L511
	BRA.S	HAL510_4
HAL511_2:
	MOVE.W	#1,L512
	BRA.S	HAL510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
L510_5:	MOVE.W	#1,L511
	BRA.S	L510_4
L510_6:	CLR.W	L511
	BRA.S	L510_4
L511_2:	MOVE.W	#1,L512
	BRA.S	L510_4
L511_3:	CLR.W	L512
	BRA.S	L510_4
NOKEYT:	JMP	$120000
L703=NOKEYT+2

HEXBLIPP:	DC.B	'0123456789ABCDEF'

L519:	LEA	L605,A0
;	LEA	HEXBLIPP,A1
	 LEA	L5,A1
	 ADD.L	#HEXBLIPP-L5,A1
	MOVEQ	#0,D0
	MOVE.W	#$FF,D7
HEXLOP:	MOVE.W	D0,D1
	LSR.W	#$4,D1
	MOVE.B	(A1,D1.W),(A0)+
	MOVE.W	D0,D1
	AND.W	#$F,D1
	MOVE.B	(A1,D1.W),(A0)+
	ADDQ.B	#1,D0
	DBF	D7,HEXLOP

	lea	L589,a1
	jsr	-$0198(a6)
	move.l	d0,L686
	move.l	$04.w,a6
	move.l	#CrunchShitLen,d0
	move.l	#$10000,d1
	jsr	-$c6(a6)
	move.l	d0,CrunchShitPoi
	move.l	$04.w,a6
	move.l	#$6c70,d0
	move.l	#$10002,d1
	jsr	-$00c6(a6)
	move.l	d0,L628
	LEA	L744,A1
	move.w	d0,4(A1)
	swap	d0
	move.w	d0,(A1)
	SWAP	D0
	ADD.L	#[60*40]+16,D0
	MOVE.L	D0,SCRPOI
	JSR	PATTPRINTONCE

	;BSR	LOPLST

	move.w	$dff00a,d0
	move.w	d0,d1
	andi.w	#$00ff,d0
	move.w	d0,L661
	lsr.w	#$8,d1
	move.w	d1,L662
	move.l	#$1143c,d0
	move.l	#$10002,d1	;songdata till chipmem (progljud DMA!!)
	move.l	$04.w,a6
	jsr	-$00c6(a6)
	move.l	d0,L697
	move.l	d0,a0
	add.l	#$14,a0
	moveq	#$1e,d0
L522:	move.w	#1,$1c(a0)
	add.l	#$1e,a0
	dbf	d0,L522
	move.l	L697(PC),a0
	move.w	#$100,$03b6(a0)
	move.l	#'FEST',$0438(a0)
	clr.w	$dff0a8
	clr.w	$dff0b8
	clr.w	$dff0c8
	clr.w	$dff0d8
	LEA	L620,A0
	move.w	#1,L659-L620(A0)
	clr.l	L693
	clr.l	L692
	clr.l	L696
	clr.l	L632
	clr.l	L631
	moveq	#$06,d0
	move.l	d0,L642
	LEA	L742,A1
	move.l	A1,L514
	move.l	A1,L516
	LEA	L743,A1
	move.l	A1,L517
	LEA	L746,A1
	move.l	A1,L518
	LEA	L749,A1
	move.l	A1,L513
	LEA	L750,A1
	move.l	A1,L515
	move.l	#L600,L643
	move.l	#L601,L644
	LEA	L752,A1
	move.l	A1,L572
	move.l	L572,L620
	LEA	L754,A1
	move.l	A1,L621
	LEA	L753,A1
	move.l	A1,L622
	LEA	SPX_1,A1
	move.l	A1,L623
	LEA	SPX_2,A1
	move.l	A1,L624
	LEA	SPX_3,A1
	move.l	A1,L625
	LEA	SPX_4,A1
	move.l	A1,L626
	LEA	L742,A1
	lea	L620,a0
	moveq	#$0f,d2
L523:	move.w	(a0)+,$0002(a1)
	addq.l	#$4,a1
	dbf	d2,L523
	bsr	L245
	clr.l	L637
	bsr	L543
	bsr	L548
	bsr	L550
	move.w	#$0001,L658
	bsr	L552
	move.l	#L509,$6c.w
	LEA	L759,A2
	move.l	A2,d0
	lea	L743,a1
	move.w	d0,6(a1)
	swap	d0
	move.w	d0,2(a1)
	swap	d0
	addi.l	#$2800,d0
	move.w	d0,$e(a1)
	swap	d0
	move.w	d0,$a(a1)
	move.l	$04.w,a6
	lea	L590,a1
	jsr	-$0198(a6)
	move.l	d0,L723
	move.l	d0,a0
	move.l	$26(a0),L627
	lea	L538,a1
	jsr	-$0198(a6)
	move.l	d0,L724
	move.l	d0,a0
	move.l	-$015a(a0),L540
	move.l	#L539,-$015a(a0)
	BSR.S	DOSPRCOLS
	BRA	L530

SPRCOLPOI:	DC.L	L529_2
ANACOLPOI:	DC.L	L536_2

DOSPRCOLS:
	LEA	L751,A0
	MOVE.L	SPRCOLPOI,a5
	move.l	#$B807FFFE,d0
	moveq	#$2f,d7
L525:	move.l	d0,(a0)+
	lea	L528(pc),a1
	moveq	#$01,d5
L526:	moveq	#$02,d6
L527:	move.w	(a1)+,(a0)+
	move.w	(a5)+,(a0)+
	dbf	d6,L527
	lea	-$0006(a5),a5
	dbf	d5,L526
	lea	$0006(A5),a5
	add.l	#$1000000,d0
	dbf	d7,L525
	RTS

L528:	DC.W	$01b2,$01b4,$01b6,$01ba,$01bc,$01be

L529_2:	dc.W	$0f00,$0b00,$0700,$0f00,$0b00,$0700
	dc.W	$0f10,$0b10,$0710,$0f10,$0b10,$0710
	dc.W	$0f20,$0b20,$0720,$0f20,$0b20,$0720
	dc.W	$0f30,$0b30,$0730,$0f30,$0b30,$0730
	dc.W	$0f40,$0b40,$0740,$0f50,$0b50,$0750
	dc.W	$0f60,$0b60,$0760,$0f70,$0b70,$0770
	dc.W	$0f80,$0b80,$0780,$0f90,$0b90,$0790
	dc.W	$0fa0,$0ba0,$07a0,$0fb0,$0bb0,$07b0
	dc.W	$0fc0,$0bc0,$07c0,$0fd0,$0bd0,$07d0
	dc.W	$0fe0,$0be0,$07e0,$0ff0,$0bf0,$07f0
	dc.W	$0ff0,$0bf0,$07f0,$0ef0,$0af0,$06f0
	dc.W	$0ef0,$0af0,$06f0,$0df0,$09f0,$05f0
	dc.W	$0df0,$09f0,$05f0,$0cf0,$08f0,$04f0
	dc.W	$0cf0,$08f0,$04f0,$0bf0,$07f0,$03f0
	dc.W	$0bf0,$07f0,$03f0,$0af0,$06f0,$02f0
	dc.W	$09f0,$05f0,$01f0,$09f0,$05f0,$01f0
	dc.W	$08f0,$04f0,$00f0,$08f0,$04f0,$00f0
	dc.W	$07f0,$03f0,$00e0,$07f0,$03f0,$00e0
	dc.W	$06f0,$02f0,$00d0,$06f0,$02f0,$00d0
	dc.W	$05f0,$01f0,$00c0,$05f0,$01f0,$00c0
	dc.W	$04f0,$00f0,$00b0,$04f0,$00f0,$00b0
	dc.W	$03f0,$00e0,$00a0,$03f0,$00e0,$00a0
	dc.W	$02f0,$00d0,$0090,$01f0,$00c0,$0080
	dc.W	$00f0,$00b0,$0070,$00e0,$00a0,$0060

L529:	DC.W	$00E,$00C,$008,$00E,$00C,$009,$00E,$00C,$009
	dc.W	$00F,$00D,$009,$00F,$00D,$00A,$01F,$00D,$00A
	dc.W	$01F,$01D,$00A,$01F,$01D,$00B,$02F,$01D,$00B
	dc.W	$02F,$02D,$00B,$03F,$02D,$01B,$03F,$02D,$01B
	dc.W	$03F,$03D,$01B,$04F,$03D,$02B,$04F,$03D,$02B
	dc.W	$05F,$04D,$02B,$05F,$04D,$03B,$05F,$04D,$03B
	dc.W	$06F,$05D,$03B,$06F,$05D,$04B,$07F,$05D,$04B
	dc.W	$07F,$06D,$04B,$07F,$06D,$05B,$08F,$06D,$05B
	dc.W	$08F,$07D,$05B,$09F,$07D,$06B,$09F,$07D,$06B
	dc.W	$09F,$08D,$06B,$0AF,$08D,$07B,$0AF,$08D,$07B
	dc.W	$0BF,$09D,$07B,$0BF,$09D,$08B,$0BF,$09D,$08B
	dc.W	$0CF,$0AD,$08B,$0CF,$0AD,$09B,$0DF,$0AD,$09B
	dc.W	$0DF,$0BD,$09B,$0DF,$0BD,$0AB,$0EF,$0BD,$0AB
	dc.W	$0EF,$0CD,$0AB,$0FF,$0CD,$0BB,$0FF,$0CD,$0BB
	dc.W	$1FF,$0DD,$0BB,$1FF,$0DD,$0BB,$2FF,$1DD,$1BB
	dc.W	$2FF,$1DD,$1BB,$3FF,$2DD,$1BB,$3FF,$2DD,$1BB

L530:	CMP.W	#$5,L713
	BGE	RRTS
	LEA	L747,A5
	MOVE.L	ANACOLPOI,a4
	moveq	#$27,d0
	move.l	#$687dfffe,d1
L531:	move.l	d1,(a5)+
	move.w	#$018c,(a5)+
	move.w	(a4)+,(a5)+
	addi.l	#$00600000,d1
	move.l	d1,(a5)+
	move.l	#$018c0000,(a5)+
	addi.l	#$01000000,d1
	subi.l	#$00600000,d1
	dbf	d0,L531
	rts

L532:	CMP.W	#5,L713
	BGE	RRTS
	LEA	L748,A1
	MOVE.L	ANACOLPOI,A0
	moveq	#$27,d0
L533:	move.w	(a0)+,(a1)
	add.l	#$10,a1
	dbf	d0,L533
	rts

L534:	LEA	L748,A0
	moveq	#$27,d0
L535:	clr.w	(a0)
	add.l	#$10,a0
	dbf	d0,L535
	rts

L536:	DC.W $01F,$02F,$02F,$02F,$03F,$03F,$03F,$04F,$04F
	DC.W $04F,$05F,$05F,$05F,$06F,$06F,$06F,$07F,$07F
	DC.W $07F,$08F,$08F,$08F,$09F,$09F,$09F,$0AF,$0AF
	DC.W $0AF,$0BF,$0BF,$0BF,$0CF,$0CF,$0CF,$0DF,$0DF,$0DF

L536_2:	DC.W $F00,$F10,$F20,$F30,$F40,$F50,$F60,$F70,$F80
	DC.W $F90,$FA0,$FB0,$FC0,$FD0,$FE0,$FF0,$EF0,$DF0
	DC.W $CF0,$BF0,$AF0,$9F0,$8F0,$7F0,$6F0,$5F0,$4F0
	DC.W $3F0,$2F0,$1F0,$0F0,$0E0,$0D0,$0C0,$0B0,$0A0,$090

L538:	dc.b	'intuition.library',$00

PATTDATA:	BLK.W	$360/2,0
PATTCHARS:	BLK.W	$200/2,0

L543:	clr.w	L678
	CMP.L	#'patp',L632
	BEQ.S	NOPLAT
	move.l	L515,a0
	move.w	#$2200,(a0)
NOPLAT:	move.l	L637,d1
	lea	L558(PC),a0
	divu	#$a,d1
	add.w	#$30,d1
	move.b	d1,(a0)
	clr.w	d1
	swap	d1
	add.w	#$30,d1
	move.b	d1,1(a0)
	MOVE.L	L628(PC),A6
	LEA	$1401(A6),A6
	lea	PATTCHARS-$100(PC),a1

	moveq	#0,d1
	move.b	(a0)+,d1
	lsl.w	#3,d1
	LEA	(A1,D1.W),A2
	move.b	(a2)+,(a6)+
	move.b	(a2)+,$27(a6)
	move.b	(a2)+,$4F(a6)
	move.b	(a2)+,$77(a6)
	move.b	(a2),$9F(a6)
	moveq	#0,d1
	move.b	(a0),d1
	lsl.w	#3,d1
	LEA	(A1,D1.W),A2
	move.b	(a2)+,(a6)
	move.b	(a2)+,$28(a6)
	move.b	(a2)+,$50(a6)
	move.b	(a2)+,$78(a6)
	move.b	(a2),$a0(a6)

CONTY:	clr.l	L558
	move.l	L697(PC),a6
	LEA	$43C(A6),A6
	move.l	L637,d6
	lsl.l	#8,d6
	lsl.l	#2,d6
	add.l	d6,a6
	moveq	#$3F,d6

	MOVE.L	L628(PC),A4
	ADD.L	#$1D64,A4

	MOVE.B	$3C0(A6),D0
	BMI	PRINTWAVEPATTLIST

	LEA	PATTDATA(PC),A3
	LEA	L605,A5
	MOVE.W	#$FFF,D5
	MOVE.L	#$F4,D4
	MOVEQ	#$30,D3

L544:	moveq	#3,d7
L545:	move.w	(a6)+,d1
	and.w	D5,d1	;#$FFF
	BEQ	PPNONOT
	moveq	#0,d0
	MOVE.B	(A3,D1.W),D0	;PATTDATA

	LEA	L603,A0
	ADD.W	D0,D0
	moveq	#0,d1
	move.b	(a0,D0.W),d1
	Asl.w	#3,d1
	LEA	(A1,D1.W),A2
	move.b	(a2)+,(a4)+
	move.b	(a2)+,$27(a4)
	move.b	(a2)+,$4F(a4)
	move.b	(a2)+,$77(a4)
	move.b	(a2),$9F(a4)
	moveq	#0,d1
	move.b	1(a0,D0.W),d1
	Asl.w	#3,d1
	LEA	(A1,D1.W),A2
	move.b	(a2)+,(a4)+
	move.b	(a2)+,$27(a4)
	move.b	(a2)+,$4F(a4)
	move.b	(a2)+,$77(a4)
	move.b	(a2),$9F(a4)
	moveq	#0,d1
	move.b	2(a0,D0.W),d1
	Asl.w	#3,d1
	LEA	(A1,D1.W),A2
	move.b	(a2)+,(a4)+
	move.b	(a2)+,$27(a4)
	move.b	(a2)+,$4F(a4)
	move.b	(a2)+,$77(a4)
	move.b	(a2),$9F(a4)

GONORT:	moveq	#0,d1
	MOVE.B	-2(A6),D1
	LSR.B	#4,D1
	ADD.B	D3,D1	;#$30.B
	Asl.w	#3,d1
	LEA	(A1,D1.W),A2
	move.b	(a2)+,(a4)+
	move.b	(a2)+,$27(a4)
	move.b	(a2)+,$4F(a4)
	move.b	(a2)+,$77(a4)
	move.b	(a2),$9F(a4)

	MOVEQ	#0,D0
	MOVE.B	(A6)+,D0
	ADD.W	D0,D0
	moveq	#0,d1
	MOVE.B	(A5,D0.W),D1
	Asl.w	#3,d1
	LEA	(A1,D1.W),A2
	move.b	(a2)+,(a4)+
	move.b	(a2)+,$27(a4)
	move.b	(a2)+,$4F(a4)
	move.b	(a2)+,$77(a4)
	move.b	(a2),$9F(a4)
	moveq	#0,d1
	MOVE.B	1(A5,D0.W),D1
	Asl.w	#3,d1
	LEA	(A1,D1.W),A2
	move.b	(a2)+,(a4)+
	move.b	(a2)+,$27(a4)
	move.b	(a2)+,$4F(a4)
	move.b	(a2)+,$77(a4)
	move.b	(a2),$9F(a4)

	MOVEQ	#0,D0
	MOVE.B	(A6)+,D0
	ADD.W	D0,D0
	moveq	#0,d1
	MOVE.B	(A5,D0.W),D1
	Asl.w	#3,d1
	LEA	(A1,D1.W),A2
	move.b	(a2)+,(a4)+
	move.b	(a2)+,$27(a4)
	move.b	(a2)+,$4F(a4)
	move.b	(a2)+,$77(a4)
	move.b	(a2),$9F(a4)
	moveq	#0,d1
	MOVE.B	1(A5,D0.W),D1
	Asl.w	#3,d1
	LEA	(A1,D1.W),A2
	move.b	(a2)+,(a4)+
	move.b	(a2)+,$27(a4)
	move.b	(a2)+,$4F(a4)
	move.b	(a2)+,$77(a4)
	move.b	(a2),$9F(a4)

	ADDQ.L	#1,A4
	DBF	D7,L545
	add.l	D4,A4	;#$F4.L
	DBF	D6,L544
	move.l	L515,a0
	move.w	#$3200,(a0)
RRTS:	rts

PPNONOT:LEA	$2D*8(A1),A2	;'-'*8
	move.b	(a2),(a4)+
	move.b	(a2),(a4)+
	move.b	(a2)+,(a4)+
	move.b	(a2),$25(a4)
	move.b	(a2),$26(a4)
	move.b	(a2)+,$27(a4)
	move.b	(a2),$4D(a4)
	move.b	(a2),$4E(a4)
	move.b	(a2)+,$4F(a4)
	move.b	(a2),$75(a4)
	move.b	(a2),$76(a4)
	move.b	(a2)+,$77(a4)
	move.b	(a2),$9D(a4)
	move.b	(a2),$9E(a4)
	move.b	(a2),$9F(a4)
	BRA	GONORT

L558:	dc.W	0,0,0
L628:	DC.L	0
L629:	DC.L	0

PRINTWAVEPATTLIST:
	MOVEQ	#$3F,D7
	MOVE.L	#$1D64,A4
PWPL:	MOVE.L	A4,L629
	MOVE.L	#PWPLTEXT,L635
	MOVE.L	#36,L636
	BSR	L566
	LEA	$118(A4),A4
	DBF	D7,PWPL
	move.l	L515,a0
	move.w	#$3200,(a0)
	RTS

PWPLTEXT:;	DC.B 'C-300000 C-300000 C-300000 C-300000'
	;	DC.B ' DETTA E EN JETTE FIN WAVE FORM!!!!'
		dc.b 'JAG VILL HELST HA EN GET I JULKLAPP'
	EVEN

L548:	move.l	L697(PC),a0
	add.l	#$3b8,a0
	add.l	L693,a0
	move.b	(a0),L656
	move.b	(a0),L683
	moveq	#0,d1
	move.b	(a0),d1
	cmp.b	L680,d1
	beq.s	L549
	move.w	#1,L678
L549:	move.b	(a0),L680
	CMP.W	#$5,L713
	BEQ	RRTS
	move.l	#$260,L629
	BSR	L556
	move.w	L693+2,L655
	move.l	#$a8,L629
	BRA	L556

L550:	CMP.W	#$5,L713
	BEQ.S	L551
	move.l	L697(PC),a0
	add.l	#$3b6,a0
	move.l	a0,L633
	move.b	(a0),L656	;SONGLEN
	move.l	#$418,L629
	bsr	L556
	move.l	L633,a0
	MOVE.B	1(A0),L656	;RESTART
	MOVE.L	#$5d0,L629
	bsr	L556
L551:	move.l	L697(PC),L635
	move.l	#$1025+5,L629
	move.l	#$14,L636
	bra	L562

L552:	moveq	#0,d0
	move.w	L658,d0
	beq.L	PRINTOLDVAL
	asl.l	#$2,d0
	lea	L698,a0
	move.l	(a0,d0.l),L673

	move.w	L658,d0
	LEA	M_LS,A0
	mulu	#$1e,d0
	move.l	L697(PC),a0
	sub.l	#$a,a0
	add.l	d0,a0
	move.l	a0,L633
	move.w	$16(a0),L669
	move.w	$18(a0),L670
	AND.W	#$FF,L670
	move.w	$1a(a0),L671
	move.w	$1c(a0),L672
	MOVE.B	$18(A0),CURRstamm

	clr.b	pattwaveno
	clr.b	currsoundrepeat
	clr.b	currsoundrepend
	clr.b	currsoundonoff
	CMP.L	#'Mupp',(a0)
	bne.s	printoldval
	move.b	4(a0),pattwaveno
	move.b	5(a0),currsoundrepeat
	move.b	6(a0),currsoundrepend
	move.b	#1,currsoundonoff
PRINTOLDVAL:
	move.w	L670,L655
	move.l	#$940,L629
	bsr	L561
	move.w	L669,d0
	add.w	d0,d0
	move.w	d0,L655
	move.l	#$af8,L629
	bsr	L561
	move.w	L671,d0
	add.w	d0,d0
	move.w	d0,L655
	move.l	#$cb0,L629
	bsr	L561
	move.w	L672,d0
	add.w	d0,d0
	move.w	d0,L655
	move.l	#$e68,L629
	bsr	L561
	move.w	L658,L655
	move.l	#$788,L629
	bsr	L561

	move.l	l628,a0
	lea	[$78*40]+3(a0),a0
	clr.b	(a0)
	clr.l	1(a0)
	move.b	currstamm,d0
	ext.w	d0
	add.w	#$10,d0
	move.w	d0,d1
	and.b	#$7,d0
	eor.b	#$7,d0
	lsr.w	#$3,d1
	bset	d0,(a0,d1.w)

	TST.W	L658
	BEQ	RRTS
	move.l	L633,L635
	move.l	#$11dd,L629
	move.l	#$16,L636
	BSR	L562
	lea	dummytext,a1
	move.l	l633,a0
	cmp.w	#'El',(a0)
	bne.s	nonx

	moveq	#0,d0
	move.b	2(a0),d0
	BEQ.S	GODUM
	subq.w	#1,d0
	mulu	#$1e,d0
	move.l	#PLST,a1
	add.l	d0,a1
	addq.l	#$6,a1
nonx:	move.l	a1,l635
	move.l	#$11d0+1,l629
	move.l	#11,l636
	bsr	l562
	jmp	SHOWLOOP

GODUM:	LEA	DUMMYTEXT,A1
	BRA.S	NONX

L556:	moveq	#0,d1
	move.w	L655,d1
	lea	L558,a0
	divu	#$3e8,d1
	bsr.s	L557
	divu	#$64,d1
	bsr.s	L557
	divu	#$a,d1
	bsr.s	L557
	bsr.s	L557
	move.l	#$4,L636
	move.l	#L558,L635
	bsr	L562
	clr.l	L558
	clr.w	L655
	rts

L557:	add.w	#$30,d1
	move.b	d1,(a0)+
	clr.w	d1
	swap	d1
	rts

L559:	moveq	#$00,d0
	tst.w	L648
	beq.s	L560
	move.w	L658,d0
L560:	lsl.l	#1,d0
	lea	L605,a0
	add.l	d0,a0
	move.l	a0,L635
	move.l	#1,L636
	bsr.s	L562
	clr.w	L655
	rts

L561:	lea	L655,a0
	moveq	#$00,d0
	move.b	(a0),d0
	lsl.l	#1,d0
	lea	L605,a0
	add.l	d0,a0
	move.l	a0,L635
	move.l	#$2,L636
	bsr.s	L562
	lea	L655,a0
	moveq	#$00,d0
	move.b	$0001(a0),d0
	lsl.l	#1,d0
	move.l	#L605,a0
	add.l	d0,a0
	move.l	a0,L635
	move.l	#$2,L636
	bsr.s	L562
	clr.w	L655
	rts

L562:	clr.l	L634
	move.l	L636(PC),d3
L563:	move.l	L635(PC),a0
	add.l	L634(PC),a0
	moveq	#0,d1
	move.b	(a0),d1
	bne.s	L564
	move.b	L567,d1
L564:	cmp.b	#$60,d1
	blt.s	L565
	sub.b	#$20,d1
L565:	sub.b	#$20,d1
	lsl.w	#$4,d1
;	lea	L610,a0
	 LEA	L400,A0
	 ADD.L	#L610-L400,A0
	add.l	d1,a0
	move.l	L628,a1
	add.l	L629,a1
	move.b	(a0),(a1)
	move.b	2(a0),$28(a1)
	move.b	4(a0),$50(a1)
	move.b	6(a0),$78(a1)
	move.b	8(a0),$a0(a1)
	addq.l	#1,L634
	addq.l	#1,L629
	cmp.l	L634,d3
	bne.s	L563
	rts

L634:	DC.L	0
L635:	DC.L	0
L636:	DC.L	0

L566:	move.w	L567,-(a7)
	move.b	#$20,L567
	bsr	L562
	move.w	(a7)+,L567
	rts

L567:	dc.W	$7f00

L568:	add.w	#$2c,d1
	add.w	d1,d2
	rol.w	#7,d2
	asl.w	#1,d2
	bcc.s	L569
	or.w	#2,d2
L569:	rol.w	#7,d1
	asl.w	#1,d1
	bcc.s	L570
	or.w	#4,d2
L570:	add.w	#$7d,d0
	asr.w	#1,d0
	bcc.s	L571
	or.w	#1,d2
L571:	or.w	d0,d1
	move.w	d1,(a0)
	move.w	d2,2(a0)
	rts

L573:	tst.l	L690
	beq.s	L575
	bsr	L135
	move.l	L686,a6
	move.l	L687,d1
	move.l	#$3ed,d2
	jsr	-$001e(a6)
	move.l	d0,L689
	bne.s	L574
	BSR	L139
	MOVEQ	#0,D0
	RTS

L574:	move.l	L689,d1
	move.l	L688,d2
	move.l	L690,d3
	jsr	-$002a(a6)
	move.l	L689,d1
	jsr	-$0024(a6)
L575:	clr.l	L689
	bra	L134

L576:	bsr	L135
	move.l	L686,a6
	move.l	L687,d1
	move.l	#$3ee,d2
	jsr	-$001e(a6)
	move.l	d0,L689
	bne.s	L577
	bra	L139

L577:	move.l	L689,d1
	move.l	L688,d2
	move.l	L690,d3
	jsr	-$0030(a6)
	move.l	L689,d1
	jsr	-$0024(a6)
	clr.l	L689
	bra	L134

SETMYPORT:
	MOVE.W	(A6),D2
	AND.W	#$FFF,D2
	MOVE.W	D2,$18(A6)
	MOVE.W	$10(A6),D0
	CLR.B	$16(A6)
	CMP.W	D0,D2
	BEQ.S	CLRPORT
	BGE.S	M_RTS
	MOVE.B	#1,$16(A6)
M_RTS:	RTS

CLRPORT:CLR.W	$18(A6)
	RTS

MYPORT:	MOVE.B	$3(A6),D0
	BEQ.S	MYSLIDE
	MOVE.B	D0,$17(A6)
	CLR.B	$3(A6)
MYSLIDE:TST.W	$18(A6)
	BEQ.S	RTS
	MOVEQ	#0,D0
	MOVE.B	$17(A6),D0
	TST.B	$16(A6)
	BNE.S	MYSUB
	ADD.W	D0,$10(A6)
	MOVE.W	$18(A6),D0
	CMP.W	$10(A6),D0
	BGT.S	MYOK
	MOVE.W	$18(A6),$10(A6)
	CLR.W	$18(A6)
MYOK:	MOVE.W	$10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,7,3,7,3
	dc.b 0,4,7,4,7,12,7,12,16,12,7,12,7,4,7,4
	dc.b 31,27,24,19,15,12,7,3,0,3,7,12,15,19,24,27
	dc.b 31,28,24,19,16,12,7,4,0,4,7,12,16,19,24,28
	dc.b 0,12,0,12,0,12,0,12,0,12,0,12,0,12,0,12
	dc.b 0,12,24,12,0,12,24,12,0,12,24,12,0,12,24,12
	dc.b 0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3
	dc.b 0,4,0,4,0,4,0,4,0,4,0,4,0,4,0,4

MegaArp:
	move.l	a0,-(a7)
	MOVEQ	#0,D0
	MOVE.B	$1b(A6),D0
	addq.b	#1,$1b(a6)
	AND.B	#$F,D0
	moveq	#0,d2
	lea	MegaArps(pc),a0
	move.b	3(a6),d2
	and.w	#$f,d2	;16 olika MegaArps
	asl.w	#$4,d2	;mulu	#$10
	add.w	d0,d2
	moveq	#0,d0
	move.b	(a0,d2.w),d0
	add.w	d0,d0

	MOVEQ	#0,D2
	MOVE.W	$10(A6),D2
	AND.W	#$FFF,D2
	LEA	L602,A0
	MOVEQ	#[L603-L602]/2,D7
MegaAlo:CMP.W	(A0)+,D2
	BGE.S	MegaFo
	DBF	D7,MegaAlo
	RTS
MegaFo:	lea	-2(a0,d0.w),a0
MegaAgain:
	cmp.l	#PeriodSlutt,a0
	blt.s	MegaOk
	sub.l	#12*2,a0
	bra.s	MegaAgain
MegaOk:
	move.w	(a0),D0
	BSR	PERCALC
	move.l	(a7)+,a0
	RTS

PERCALC:
	MOVEM.L	D1-D2,-(A7)
	MOVE.W	D0,D2
	MOVE.B	$1E(A6),D1
	EXT.W	D1
	MULS	D1,D2
	asr.w	#$8,d2
	ADD.W	D2,D0
	MOVE.W	D0,6(A5)	;SETPERIOD
	MOVEM.L	(A7)+,D1-D2
	RTS
PERCALCA4:
	MOVEM.L	D1-D2,-(A7)
	MOVE.W	D0,D2
	MOVE.B	$1E(A4),D1
	EXT.W	D1
	MULS	D1,D2
	asr.w	#$8,d2
	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MOVE.W	SANEWLEN,D1
	MOVE.W	D1,SAREP

	MOVE.W	SANEWREP,D0
	ADD.W	D1,D0
	MOVE.W	D0,SALEN
	CLR.W	SANEWGO
	BRA.S	SADNOEND

SADEND:	CLR.W	SAPER
SADNOEND:
	MOVE.W	SASND,D0
	CMP.W	L658,D0
	BNE	SAMDCLR
	CMP.W	#6,L713
	BNE	SAMDRTS

	MOVE.L	SCRPOI(PC),A1
	CLR.L	(A1)
	CLR.L	4(A1)
	CLR.L	8(A1)
	CLR.L	12(A1)
	CLR.L	16(A1)
	CLR.L	20(A1)

	MOVE.W	SAPOI,D1
	ASL.W	#1,D1
	MULU	SADIV,D1
	SWAP	D1

	MOVE.W	D1,D2
	LSR.W	#$3,D1
	AND.W	#$7,D2
	EOR.W	#$7,D2
	CMP.W	#23,D1
	BGE.S	.NOPLOT
	bset	d2,(a1,d1.w)
.NOPLOT:RTS


L539:	MOVE.B	#1,NOKEYB
	MOVE.L	L627,$DFF080
	ADDQ.W	#1,INTUCOUNTER
	DC.W	$4EB9	;JSR
L540:	DC.L	$0
	SUBQ.W	#1,INTUCOUNTER
	BNE.S	.TWOINTUNOW
	MOVE.L	L514,$DFF080
	CLR.B	NOKEYB
.TWOINTUNOW:
	RTS
INTUCOUNTER:	DC.W	0


oldena:	dc.w	0
oldirq:	dc.l	0

soundbuf1:	dc.l	snd1
soundbuf2:	dc.l	snd2

myirq:	movem.l	d0-d7/a0-a6,-(a7)

	move.l	soundbuf1(pc),d0
	move.l	soundbuf2(pc),soundbuf1
	move.l	d0,soundbuf2
	move.l	d0,$dff0d0
	move.w	dmalen(pc),$dff0d4


	move.w	#$000,$dff180
	bsr	L505_2
	move.w	#$000,$dff180

	move.l	ca0+$28(pc),d0
	sub.l	#Vol00+2,d0
	move.w	d0,Vol00+2
	move.l	ca1+$28(pc),d0
	sub.l	#Vol01+2,d0
	move.w	d0,Vol01+2
	move.l	ca2+$28(pc),d0
	sub.l	#Vol02+2,d0
	move.w	d0,Vol02+2
	move.l	ca3+$28(pc),d0
	sub.l	#Vol03+2,d0
	move.w	d0,Vol03+2

	move.w	sr,d0
	move.w	d0,oldsr
	move.l	ca0+$20(pc),d0
	move.l	ca1+$20(pc),d1
	move.l	ca2+$20(pc),d2
	move.l	ca3+$20(pc),d3
	moveq	#0,d4
	moveq	#0,d5
	move.w	dbflen(pc),d5
	move.l	ca0+$24(pc),d6
	move.l	ca1+$24(pc),d7
	move.l	ca0+$4(pc),a0
	move.l	ca1+$4(pc),a1
	move.l	ca2+$4(pc),a2
	move.l	ca3+$4(pc),a3
	move.l	soundbuf2(pc),a4
	move.l	ca2+$24(pc),a5
	move.l	ca3+$24(pc),a6

	move.w	#$2700,sr
	move.l	a7,oldstack

	bra	CalcBuffer
EndCalc:
	move.l	oldstack(pc),a7
	move.w	oldsr(pc),sr

	move.l	d0,ca0+$20
	move.l	d1,ca1+$20
	move.l	d2,ca2+$20
	move.l	d3,ca3+$20
	move.l	a0,ca0+$4
	move.l	a1,ca1+$4
	move.l	a2,ca2+$4
	move.l	a3,ca3+$4

	move.w	#$020,$dff180
	movem.l	(a7)+,d0-d7/a0-a6
	move.w	#$0780,$dff09c
	rte

oldsr:	dc.w	0
oldstack:dc.l	0

dmalen:	dc.w	0
dbflen:	dc.w	0

Lengthdat:
	dc.w $dFC,$dFC,$6FE,$4A9,$37F,$2CC,$255,$1FF,$1BF,$18E,$166,$145
	dc.w $12A,$113,$100,$0EF,$0E0,$0D3,$0C7,$0BC,$0B3,$0AA,$0A3,$09C

Music_init:
	move.l	L697,a0
	moveq	#0,d0
	move.b	$43c+$e(a0),d0
	beq	L363
	CMP.W	#$0016,D0
	BLE.S	.L
	MOVEQ.L	#$16,D0
.L:	MOVE.W	D0,D1
	MULU	#$64,D1
	DIVU	#5,D1
	MOVEQ.L	#$64,D3
	ADD.b	$43c+$f(a0),D3
	MULU	D3,D1
	DIVU	#$64,D1
	ADDQ.L	#1,D1
	AND.B	#$FE,D1
	MOVE.W	D1,D2
	LSR.W	#1,D2
	MOVE.W	D2,dmalen	;curr length till dmalen
	SUBQ.W	#1,D1
	MOVE.W	D1,dbflen	;curr length till dbf

	LEA	LengthDat(PC),A0
	ADD.W	D0,D0
	MOVEQ.L	#0,D1
	MOVE.W	0(A0,D0.W),D1
	MOVE.W	D1,caperiod

	move.L	#DUMMYSOUNDend,D2
	lea	ca0(pc),a6
	move.l	d2,$4(a6)
	move.l	d2,$a(a6)
	clr.b	$13(a6)
	move.w	#dummysoundend-dummysound,$8(a6)
	move.w	#$300,$10(a6)
	bsr	caPerCalc
	lea	ca1(pc),a6
	move.l	d2,$4(a6)
	move.l	d2,$a(a6)
	clr.b	$13(a6)
	move.w	#dummysoundend-dummysound,$8(a6)
	move.w	#$300,$10(a6)
	bsr	caPerCalc
	lea	ca2(pc),a6
	move.l	d2,$4(a6)
	move.l	d2,$a(a6)
	clr.b	$13(a6)
	move.w	#dummysoundend-dummysound,$8(a6)
	move.w	#$300,$10(a6)
	bsr	caPerCalc
	lea	ca3(pc),a6
	move.l	d2,$4(a6)
	move.l	d2,$a(a6)
	clr.b	$13(a6)
	move.w	#dummysoundend-dummysound,$8(a6)
	move.w	#$300,$10(a6)
	bsr	caPerCalc

	or.b	#2,$bfe001

	clr.w	$dff0a8
	clr.w	$dff0b8
	clr.w	$dff0c8

	move.w	caperiod(pc),$dff0d6	;per
	move.w	$dff01c,oldena
	move.w	#$0780,$dff09a	;clr irq
	move.w	#$0780,$dff09c	;clr req

	move.w	#$f,$dff096
	move.l	#snd1,$dff0d0
	move.w	dmalen(pc),$dff0d4	;len
	move.w	#$40,$dff0d8
	MOVE.W	#$00FF,$00DFF09E

	move.w	#$400,d0
.h:	dbf	d0,.h

	move.l	#myirq,$70.w

	move.w	#$8008,$dff096
	move.w	#$8400,$dff09a
	rts

mt_end:	move.w	#$0780,$dff09a
	rts


init_datas:
	lea	Totvalue(pc),a0
	move.w	#$017f,d7
.l:	move.b	#$7f,$0280(a0)
	move.b	#$80,(a0)+
	dbf	d7,.l
	;lea	Totvalue+$180(pc),a0
	move.w	#$00ff,d7
	move.b	#$80,d1
.o:	move.b	d1,(a0)+
	addq.b	#1,d1
	dbf	d7,.o

	moveq	#0,d4
	moveq	#$40,d7
	lea	voldata(pc),a0
.p:	moveq	#0,d5
	move.w	#$00ff,d6
.k:	move.w	d5,d3
	ext.w	d3
	muls	d4,d3
	lsr.w	#6,d3
		;eor.b	#$80,d3
	add.b	#$80,d3
	move.b	d3,(a0)+
	addq.w	#1,d5
	dbf	d6,.k
	addq.w	#1,d4
	dbf	d7,.p
	rts	

 
Loop00:	MOVE.L	ca0+$a(pc),A0
	SUB.W	ca0+$8(pc),D0
	BRA.S	Back00

Loop01:	MOVE.L	ca1+$a(pc),A1
	SUB.W	ca1+$8,D1
	BRA.S	Back01

Loop02:	MOVE.L	ca2+$a(pc),A2
	SUB.W	ca2+$8(pc),D2
	BRA.S	Back02

;d0-cou1
;d1-cou2
;d2-cou3
;d3-cou4
;d4 workreg
;d5 dbflen+workreg
;d6+period1
;d7+period2
;a0=poi1
;a1=poi2
;a2=poi3
;a3=poi4
;a4 bufpoi
;a5+period3
;a6+period4
;a7 volumework

CalcBuffer:
	SWAP	D5
	MOVE.B	(A0,D0.W),D5
Vol00:	LEA	VolData(PC),a7
	MOVE.B	(a7,D5.W),D4
	MOVE.B	(A1,D1.W),D5
Vol01:	LEA	VolData(PC),a7
	MOVE.B	(a7,D5.W),D5
	ADD.W	D5,D4
	MOVE.B	(A2,D2.W),D5
Vol02:	LEA	Voldata(PC),a7
	MOVE.B	(a7,D5.W),D5
	ADD.W	D5,D4
	MOVE.B	(A3,D3.W),D5
Vol03:	LEA	Voldata(PC),a7
	MOVE.B	(a7,D5.W),D5
	ADD.W	D5,D4

	MOVE.B	TotValue(PC,D4.W),(A4)+
	SWAP	D5
	MOVEQ	#0,D4
	ADD.L	D6,D0
	ADDX.W	D4,D0
	BPL.S	Loop00
Back00:	ADD.L	D7,D1
	ADDX.W	D4,D1
	BPL.S	Loop01
Back01:	ADD.L	A5,D2
	ADDX.W	D4,D2
	BPL.S	Loop02
Back02:	ADD.L	A6,D3
	ADDX.W	D4,D3
	DBPL	d5,Calcbuffer	;d5>=0 & bmi -> Calcbuffer
	bmi	EndCalc		;ej bmi => d5<0 -> EndCalc

	MOVE.L	ca3+$a(pc),A3
	SUB.W	ca3+$8(pc),D3

	tst.w	d5		;d5>0 -> CalcBuffer
	bpl	CalcBuffer
	bra	EndCalc

;	BPL.S	Loop03
;	DBF	D5,Calcbuffer
;	BRA	EndCalc
;Loop03:MOVE.L	ca3+$a(pc),A3
;	SUB.W	ca3+$8(pc),D3
;	DBF	D5,CalcBuffer
;	BRA	EndCalc
 
Totvalue:	blk.b	$400,0
Voldata:	blk.b	$4100,0



L580:	DC.B	'Music:'
L581:	blk.b	32,0
L582:	DC.B	'st-00:'
L583:	blk.b	5,0
L584:	blk.b	23,0
	EVEN
L585:	BLK.B	74,0
L587:	DC.B	0
L588:	dc.b	$01
L589:	dc.b	'dos.library',$00
L590:	dc.b	'graphics.library',$00,$00
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
L592:	blk.b	20,0
	dc.W	1
	blk.b	6,0
	DC.B	0,0,0,0
L593:	blk.b	20,0
	dc.W	2
	blk.b	6,0
	DC.B	0,0,0,0
L594:	blk.b	20,0
	dc.W	4
	blk.b	6,0
	DC.B	0,0,0,0
L595:	blk.b	20,0
	dc.W	8
	BLK.B	6,0
	DC.B	0,0,0,0
L596:	dc.b	$0a,$01,$02,$03,$04,$05
	dc.b	$06,$07,$08,$09,$20,$35
	dc.b	$33,$22,$12,$23
L597:	dc.b	$31,$21,$32,$22,$33,$34
	dc.b	$24,$35,$25,$36,$26,$37
	dc.b	$38,$28,$39,$29,$3a,$10
	dc.b	$02,$11,$03,$12,$13,$05
	dc.b	$14,$06,$15,$07,$16,$17
	dc.b	$09,$18,$0a,$19,$1a,$0c
	dc.b	$1b,$0d,$46,$00
L598:	dc.W	$0358,$0328,$02fa,$02d0,$02a6,$0280
	dc.W	$025c,$023a,$021a,$01fc,$01e0,$01c5
	dc.W	$01ac,$0194,$017d,$0168,$0153,$01ac
	dc.W	$0194,$017d,$0168,$0153,$0140,$012e
	dc.W	$011d,$010d,$00fe,$00f0,$00e2,$00d6
	dc.W	$00ca,$00be,$00b4,$00aa,$00a0,$0097
	dc.W	$008f,$0087,0,0,0

L599:	dc.b	$63,$2d,$31,$20,$63,$23
	dc.b	$31,$20,$64,$2d,$31,$20
	dc.b	$64,$23,$31,$20,$65,$2d
	dc.b	$31,$20,$66,$2d,$31,$20
	dc.b	$66,$23,$31,$20,$67,$2d
	dc.b	$31,$20,$67,$23,$31,$20
	dc.b	$61,$2d,$31,$20,$61,$23
	dc.b	$31,$20,$62,$2d,$31,$20
	dc.b	$63,$2d,$32,$20,$63,$23
	dc.b	$32,$20,$64,$2d,$32,$20
	dc.b	$64,$23,$32,$20,$65,$2d
	dc.b	$32,$20,$63,$2d,$32,$20
	dc.b	$63,$23,$32,$20,$64,$2d
	dc.b	$32,$20,$64,$23,$32,$20
	dc.b	$65,$2d,$32,$20,$66,$2d
	dc.b	$32,$20,$66,$23,$32,$20
	dc.b	$67,$2d,$32,$20,$67,$23
	dc.b	$32,$20,$61,$2d,$32,$20
	dc.b	$61,$23,$32,$20,$62,$2d
	dc.b	$32,$20,$63,$2d,$33,$20
	dc.b	$63,$23,$33,$20,$64,$2d
	dc.b	$33,$20,$64,$23,$33,$20
	dc.b	$65,$2d,$33,$20,$66,$2d
	dc.b	$33,$20,$66,$23,$33,$20
	dc.b	$67,$2d,$33,$20,$67,$23
	dc.b	$33,$20,$2d,$2d,$2d,$20

L600:	dc.W	$01ac,$0194,$017d,$0168,$0153,$0140
	dc.W	$012e,$011d,$010d,$00fe,$00f0,$00e2
	dc.W	$00d6,$00ca,$00be,$00b4,$00aa,$00d6
	dc.W	$00ca,$00be,$00b4,$00aa,$00a0,$0097
	dc.W	$008f,$0087,$007f,$0078,$0071
	blk.b	24,$00

L601:	dc.b $63,$2d,$32,$20,$63,$23,$32,$20,$64,$2d,$32,$20
	dc.b $64,$23,$32,$20,$65,$2d,$32,$20,$66,$2d,$32,$20
	dc.b $66,$23,$32,$20,$67,$2d,$32,$20,$67,$23,$32,$20
	dc.b $61,$2d,$32,$20,$61,$23,$32,$20,$62,$2d,$32,$20
	dc.b $63,$2d,$33,$20,$63,$23,$33,$20,$64,$2d,$33,$20
	dc.b $64,$23,$33,$20,$65,$2d,$33,$20,$63,$2d,$33,$20
	dc.b $63,$23,$33,$20,$64,$2d,$33,$20,$64,$23,$33,$20
	dc.b $65,$2d,$33,$20,$66,$2d,$33,$20,$66,$23,$33,$20
	dc.b $67,$2d,$33,$20,$67,$23,$33,$20,$61,$2d,$33,$20
	dc.b $61,$23,$33,$20,$62,$2d,$33,$20,$2d,$2d,$2d,$20
	dc.b $2d,$2d,$2d,$20,$2d,$2d,$2d,$20,$2d,$2d,$2d,$20
	dc.b $2d,$2d,$2d,$20,$2d,$2d,$2d,$20,$2d,$2d,$2d,$20
	dc.b $2d,$2d,$2d,$20,$2d,$2d,$2d,$20,$2d,$2d,$2d,$20

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

	DC.B	$20,$20
L603:	dc.b	$43,$2d,$31,$20,$43,$23,$31,$20,$44,$2d,$31,$20
	dc.b	$44,$23,$31,$20,$45,$2d,$31,$20,$46,$2d,$31,$20
	dc.b	$46,$23,$31,$20,$47,$2d,$31,$20,$47,$23,$31,$20
	dc.b	$41,$2d,$31,$20,$41,$23,$31,$20,$42,$2d,$31,$20
	dc.b	$43,$2d,$32,$20,$43,$23,$32,$20,$44,$2d,$32,$20
	dc.b	$44,$23,$32,$20,$45,$2d,$32,$20,$46,$2d,$32,$20
	dc.b	$46,$23,$32,$20,$47,$2d,$32,$20,$47,$23,$32,$20
	dc.b	$41,$2d,$32,$20,$41,$23,$32,$20,$42,$2d,$32,$20
	dc.b	$43,$2d,$33,$20,$43,$23,$33,$20,$44,$2d,$33,$20
	dc.b	$44,$23,$33,$20,$45,$2d,$33,$20,$46,$2d,$33,$20
	dc.b	$46,$23,$33,$20,$47,$2d,$33,$20,$47,$23,$33,$20
	dc.b	$41,$2d,$33,$20,$41,$23,$33,$20,$42,$2d,$33,$20
	dc.b	$2d,$2d,$2d,$20

L604:	dc.b	$40,$20,$35,$33,$22,$12
	dc.b	$23,$24,$25,$17,$26,$27
	dc.b	$28,$37,$36,$18,$19,$10
	dc.b	$13,$21,$14,$16,$34,$11
	dc.b	$32,$15,$31,$0a,$01,$02
	dc.b	$03,$04,$05,$06,$07,$08
	dc.b	$09,$88,$89,$39,$0b,$2a
	dc.b	$aa,$a9,$87,$8b,$00,$54
	dc.b	$00,$59,$00,$5e,$00,$63
	dc.b	$00,$6a,$00,$70,$00,$76
	dc.b	$00,$7e,$00,$85,$00,$8c
	dc.b	$00,$95,$00,$9e,$00,$a7
	dc.b	$00,$b1,$00,$bc,$00,$c6
	dc.b	$00,$d3,$00,$df,$00,$ed
	dc.b	$00,$fb,$01,$0a,$01,$1a
	dc.b	$01,$2a,$01,$3d,$01,$4f
	dc.b	$01,$62,$01,$79,$01,$8e
	dc.b	$01,$a5,$01,$c0,$01,$da
	dc.b	$01,$f4,$02,$12,$02,$34
	dc.b	$02,$5a,$02,$84
L607:	dc.b	$03,$06,$07,$08,$09,$0a
	dc.b	$0c,$0f,$10,$11,$12,$13
	dc.b	$15,$18,$19,$1a,$1b,$1c
	dc.b	$1e,$21,$22,$23,$24,$25
L608:	dc.b	' abcdefghijklmnopqrst'
	dc.b	"uvwxyz0123456789().-'"
	dc.b	'#:/',$00
L610:	blk.l	1024/4,0
L613:	dc.b	$1e,$66,$01,$00,$3f,$77
	dc.b	$01,$00,$3b,$ff,$01,$00
	dc.b	$3b,$ff,$01,$00,$1f,$f7
	dc.b	$01,$00,$0f,$33,$01,$00
L614:	dc.b	$79,$fb,$f1,$00,$fd,$ff
	dc.b	$f9,$00,$ef,$f3,$e1,$00
	dc.b	$ef,$fb,$f1,$00,$7f,$c3
	dc.b	$81,$00,$3c,$c1,$81,$00
	dc.b	$ff,$ff,$fe,$00,$f3,$fe
	dc.b	$fe,$00,$f7,$7e,$fe,$00
	dc.b	$f7,$6e,$fe,$00,$fe,$6e
	dc.b	$fe,$00,$f0,$cc,$fe,$00
	dc.b	$ff,$ff,$fe,$00,$cf,$83
	dc.b	$06,$00,$dd,$ff,$fe,$00
	dc.b	$dd,$87,$0e,$00,$f9,$bf
	dc.b	$7e,$00,$c3,$3e,$7e,$00
	dc.b	$00,$00,$05,$55,$0a,$aa
	dc.b	$0f
	blk.b	1,$ff

LENGTHPRT:
	dc.b	$09
	dc.b	'Length: '
PL1:	dc.b	'0'
PL2:	dc.b	'0  Restart: '
PL3:	dc.b	'0'
PL4:	dc.b	'0'
	dc.b	$d,$a,$d,$a
	EVEN

L611:	BLK.W	$8F0/2,0
NYSAM:	BLK.W	$141C/2,0
TOMRUT:	BLK.W	352/2,0
MDR:	BLK.W	$141C/2,0
L615:	BLK.W	$444/2,0
L617:	BLK.W	$141C/2,0
PLR=L617
CLRR:	BLK.W	800/2,0
SER:	BLK.W	680/2,0

SCHoffsetTable:
	dc.w 16,16,16,16,17,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18
	dc.w 19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20
	dc.w 21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22
	dc.w 23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24
	dc.w 25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26
	dc.w 27,27,27,27,27,27,27,27,28,28,28,28,28,28,28,28
	dc.w 29,29,29,29,29,29,29,29,30,30,30,30,30,30,30,30
	dc.w 31,31,31,31,31,31,31,31,32,32,32,32,0,0,0,0
	dc.w 1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3
	dc.w 4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6
	dc.w 7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9
	dc.w 10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11
	dc.w 12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13
	dc.w 14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,16,16,16,16

muspekare2:
	dc.w %0000000000000000,%0100000000000000
	dc.w %0100000000000000,%1010000000000000
	dc.w %0000000000000000,%0100000000000000
	dc.w %0000000000000000,%0000000000000000
	dc.w %0000000000000000,%0000000000000000
	dc.w %0000000000000000,%0000000000000000
	dc.w %0000000000000000,%0000000000000000
	dc.l 0
	dc.l 0
	dc.l 0
	dc.l 0
	dc.l 0
	dc.l 0
	dc.l 0
	dc.l 0
	dc.l 0
mupp2:	dc.w	$0001,$0001
muspekoffset:	dc.l	0


;TimeDecruncher - av Mahoney Juni -90
CrunchShitPoi:	dc.l	$0
TimeDest:	dc.l	$0

Decrunch:
	move.l	CrunchShitPoi(pc),a0
	moveq	#0,d1
	moveq	#0,d0
	move.w	(a0)+,d0
	move.w	(a0)+,d1
	eor.w	#"El",d0
	eor.w	#"in",d1
	lea	(a0,d0.w),a0
	lea	(a0,d1.w),a0
	move.l	TimeDest(pc),a1
	move.l	-(a0),a2
	add.l	a1,a2
	tst.l	-(a0)
	move.l	-(a0),d0
	moveq	#$10,d4
	moveq	#2,d5
	moveq	#3,d6
	moveq	#1,d7
	lea	7.w,a4

.3a:	move.w	d0,$dff1a4
	moveq	#3,d1
	bsr	.132
	tst.w	d2
	beq.s	.a2
	cmp.w	a4,d2	;a4=#7
	bne.s	.78
	lsr.l	#1,d0
	bne.s	.5c
	 move.l	-(a0),d0
	 move	d4,ccr
	 roxr.l	#1,d0
.5c:	bcc.s	.70
	moveq	#10,d1
	bsr	.132
	tst.w	d2
	bne.s	.78
	moveq	#$12,d1
	bsr	.132
	bra.s	.78

.70:	moveq	#4,d1
	bsr	.132
	addq.w	#7,d2
.78:	subq.w	#1,d2
.7a:	moveq	#7,d1
.7c:	lsr.l	#1,d0
	beq.s	.8e
	roxl.l	#1,d3
	dbra	d1,.7c
	move.b	d3,-(a2)
	dbra	d2,.7a
	bra.s	.a2

.8e:	move.l	-(a0),d0
	move	d4,ccr
	roxr.l	#1,d0
	roxl.l	#1,d3
	dbra	d1,.7c
	move.b	d3,-(a2)
	dbra	d2,.7a
.a2:	cmp.l	a2,a1
	bge.s	.122
	moveq	#2,d1
	bsr.s	.132
	moveq	#2,d3
	moveq	#8,d1
	tst.w	d2
	beq.s	.110
	moveq	#4,d3
	cmp.w	d5,d2	;d5=#2
	beq.s	.fa
	moveq	#3,d3
	cmp.w	d7,d2	;d7=#1
	beq.s	.ec
	moveq	#2,d1
	bsr.s	.132
	cmp.w	d6,d2	;d6=#3
	beq.s	.e4
	cmp.w	d5,d2	;d5=#2
	beq.s	.da
	addq.w	#5,d2
	move.w	d2,d3
	bra.s	.fa

.da:	moveq	#2,d1
	bsr.s	.132
	addq.w	#7,d2
	move.w	d2,d3
	bra.s	.fa

.e4:	moveq	#8,d1
	bsr.s	.132
	move.w	d2,d3
	bra.s	.fa

.ec:	moveq	#8,d1
	lsr.l	#1,d0
	bne.s	.f4
	 move.l	-(a0),d0
	 move	d4,ccr
	 roxr.l	#1,d0
.f4:	bcs.s	.110
	moveq	#14,d1
	bra.s	.110

.fa:	moveq	#$10,d1
	lsr.l	#1,d0
	bne.s	.102
	 move.l	-(a0),d0
	 move	d4,ccr
	 roxr.l	#1,d0
.102:	bcc.s	.110
	moveq	#8,d1
	lsr.l	#1,d0
	bne.s	.10c
	 move.l	-(a0),d0
	 move	d4,ccr
	 roxr.l	#1,d0
.10c:	bcs.s	.110
	moveq	#12,d1
.110:	bsr.s	.132
	subq.w	#1,d3
.114:	move.b	-1(a2,d2.l),-(a2)
	dbra	d3,.114
	cmp.l	a2,a1
	blt	.3a
.122:	rts

.132:	subq.w	#1,d1
	moveq	#0,d2
.Z:	lsr.l	#1,d0
	beq.s	.L
	roxl.l	#1,d2
	dbra	d1,.Z
	rts
.L:	move.l	-(a0),d0
	move	d4,ccr
	roxr.l	#1,d0
	roxl.l	#1,d2
	dbra	d1,.Z
	rts


	section	chipdata,data_c
L742:	DC.W	$0120,0,$0122,0,$0124,0
	DC.W	$0126,0,$0128,0,$012a,0
	DC.W	$012c,0,$012e,0,$0130,0
	DC.W	$0132,0,$0134,0,$0136,0
	DC.W	$0138,0,$013a,0,$013c,0
	DC.W	$013e,0

L743:	dc.W	$00e0,0,$00e2,0,$00e4,0
	dc.W	$00e6,0,$00e8
L744:	dc.W	0,$00ea,0

L746:	dc.W	$01a2,$E00,$01a4,$B00,$01a6,$800	;MUPEKCOL
	dc.W	$01a0,0,$0180,0

COL1:	DC.W	$0182,$0733
	dc.W	$0184,$0A66
	DC.W	$0186,$0C99
	DC.W	$0188,$0AFB
	dc.W	$01aa,$0900
	DC.W	$01ac,$0600
	DC.W	$01ae,$0E00
	dc.W	$008e,$2c81,$0090,$2cc1,$0092,$0038
	dc.W	$0094,$00d0,$0102,$0000,$0104,$0024
	dc.W	$2c07,$fffe,$0100,$3200

	DC.W $01B2,$0,$01B4,$DDD,$01B6,$666
	DC.W $01BA,$0,$01BC,$DDD,$01BE,$666

	;DC.W	$6607,$FFFE,$01B2,0,$01BA,0	;TRAINCOLS

L747:	blk.b	6,0
L748:	blk.W	634/2,0

	DC.W	$b807,$fffe,$0100,$2200

L749:	DC.W	$00e8,$0000,$00ea,$0000
COL8:	DC.W	$0188,$990
	DC.W	$b907,$fffe,$0100
L750:	DC.W	$3200

L751:	blk.b	1344,$00
	dc.W	$e907,$fffe,$010a,$ffd8,$0108,$ffd8
	dc.W	$ea07,$fffe,$0104,$0010,$010a,$0000
	dc.W	$0108,$0000,$eb07,$fffe,$010a,$ffd8
	dc.W	$0108,$ffd8,$ec07,$fffe,$010a,$0000
	dc.W	$0108,$0000,$ed07,$fffe,$010a,$ffd8
	dc.W	$0108,$ffd8,$ee07,$fffe,$010a,$0000
	dc.W	$0108,$0000,$ef07,$fffe,$010a,$ffd8
	dc.W	$0108,$ffd8,$f007,$fffe,$010a,$0000
	dc.W	$0108,$0000,$f107,$fffe,$010a,$ffd8
	dc.W	$0108,$ffd8,$f207,$fffe,$010a,$0000
	dc.W	$0108,$0000,$f307,$fffe,$010a,$ffd8
	dc.W	$0108,$ffd8,$f407,$fffe,$010a,$0000
	dc.W	$0108,$0000,$f507,$fffe,$010a,$ffd8
	dc.W	$0108,$ffd8,$f607,$fffe,$010a,$0000

	dc.W	$0108,$0000,$01b2,$0000,$01b4,$0000
	dc.W	$01b6,$0000,$01ba,$0000,$01bc,$0000
	dc.W	$01be,$0000

	DC.W	$ffdf,$fffe,$2907,$fffe
	dc.W	$0100,$2200,$2c07,$fffe,$0100,$0200
	DC.L	$FFFFFFFE

L752:	;BLK.B	80,0
	dc.W	$0000,$0000,$ffff,$ffff,$8002,$fffe
	dc.W	$bff4,$c00c,$bfe8,$c018,$bfd0,$c030
	dc.W	$bfe8,$c018,$bff4,$c00c,$bffa,$c006
	dc.W	$bffd,$c003,$bffa,$c006,$b7f4,$c80c
	dc.W	$abe8,$dc18,$95d0,$f630,$a2a0,$e360
	dc.W	$c140,$c1c0,$8080,$8080,0,0,0
	dc.l	0,0,0,0

snd1:	blk.l	$800/4,0
snd2:	blk.l	$800/4,0

L753:	blk.b	4,$00
	dc.W	$ffe0,$ffe0,$ffe0,$ffe0,$8020,$0000
	dc.W	$8020,$0000,$8020,$0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,$3fc0,$c0c0,$3fc0
	dc.W $c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$0000,$0000

SPX_4:
L758:	dc.W $e9c7,$ea01,$c0c0,$3FC0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0
	dc.W $3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0
	dc.W $c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0
	dc.W $3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0
	dc.W $c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0
	dc.W $3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0
	dc.W $c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0
	dc.W $3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0
	dc.W $c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0
	dc.W $3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0
	dc.W $c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$c0c0,$3fc0,$0000,$0000

DummySound:
	blk.w	$80,0
dummysoundend:

L759:	BLK.W	20480/2,0
L760=L759+55
L761=L759+1815+[11*40]
L763=L759+2100
PICR=L759


	Section hej,bss
L709:	ds.b	4
L710:	ds.b	8
L711:	ds.b	24
	CNOP	0,4
DISKSPSHIT:
L712:	ds.b	224
L713:	ds.b	2
L714:	ds.b	2
L715:	ds.b	2
L716:	ds.b	3
L717:	ds.b	1
L718:	ds.b	2
L719:	ds.b	124
L723:	ds.b	4
L724:	ds.b	4
L725:	ds.b	4
L726:	ds.b	2

DRUMMERON:	Ds.B	1
HARD:		Ds.B	1
L618:	ds.b	256
L619:	ds.b	1024
MOVEDISKLIST:	Ds.W	1
MOVEPLSTCON:	Ds.W	1
L620:	ds.b	4
L621:	ds.b	8
L622:	ds.b	4
L623:	ds.b	4
L624:	ds.b	4
L625:	ds.b	4
L626:	ds.b	4
L627:	ds.b	4
L630:	ds.b	4
L631:	ds.b	4
L632:	ds.b	4
L633:	ds.b	4
L637:	ds.b	3
L638:	ds.b	1
L642:	ds.b	4
L643:	ds.b	4
L644:	ds.b	4
L645:	ds.b	2
L646:	ds.b	2
L659:	ds.b	2
L660:	ds.b	2
L661:	ds.b	2
L662:	ds.b	2
L663:	ds.b	2
L664:	ds.b	2
L665:	ds.b	2
L666:	ds.b	2
L667:	ds.b	2
L668:	ds.b	2
L669:	ds.b	2
L670:	ds.b	2
L671:	ds.b	2
L672:	ds.b	2
L673:	ds.b	4
L678:	ds.b	2
L679:	ds.b	3
L680:	ds.b	1
L681:	ds.b	2
L682:	ds.b	3
L683:	ds.b	1
L684:	ds.b	2
L685:	ds.b	4
L686:	ds.b	4
L687:	ds.b	4
L688:	ds.b	4
L689:	ds.b	4
L690:	ds.b	4
L691:	ds.b	30
L692:	ds.b	4
L693:	ds.b	3
L694:	ds.b	1
L695:	ds.b	4
L696:	ds.b	4
L698:	ds.b	2
L699:	ds.b	2
L700:	ds.b	248
L701:	ds.b	2
L702:	ds.b	4
L704:	ds.b	4
L705:	ds.b	12
L706:	ds.b	46
L707:	ds.b	46
L708:	ds.b	6
DISKBLOCKSFREE:	Ds.W	1
OLDVOL:	Ds.W	1
IFFSHIT:	ds.L	$20
LOADSAMDISKNAME:ds.B	$10
LOADSAMPLENAMEPOI:Ds.L	1
OLDDIRNAM:	Ds.L	1
DELETENO:	Ds.W	1
ENTERPRESSED:	Ds.W	1
OLDFREEMEM:	Ds.L	1
OLDTUNELEN:	Ds.L	1
CHECKMOD:	Ds.W	1
DIRLISTCHECK:	Ds.W	1
FOUNDPLST:	Ds.W	1
FOUNDPOS:	Ds.W	1
FOUNDPLSTL:	Ds.L	1
PRINTPLSTSOUND1:Ds.L	1
PRINTPLSTSOUNDS:ds.L	14
L225:		ds.W	1
L226:		ds.W	1
PATSODIR:	Ds.L	1
PATSOGO:	Ds.W	1
MYEDIT:		Ds.W	1
NTREMOVED:	Ds.W	1
L511:		Ds.W	1
L572:		ds.L	1
L374:	Ds.L	1
L375:	Ds.L	1
L376:	Ds.L	1
L377:	Ds.L	1
L378:	Ds.L	1
L379:	Ds.L	1
L398:	ds.b	4
L399:	ds.b	2
L401:	ds.b	2
L402:	ds.b	2
L512:		Ds.W	1
L513:	ds.b	4
L514:	ds.b	4
L515:	ds.b	4
L516:	ds.b	4
L517:	ds.b	4
L518:	ds.b	4
L605:	ds.b	1
L606:	ds.B	511
DUMMYTEXT:	ds.B	34
FILTEROLD:	Ds.B	1
		Ds.B	1
P1035:	Ds.W	1
P1036:	Ds.L	1

END:	END

