org	$30000
load	$30000
s:
lea	$55000,a0
lea	$5a000,a1
loesch:
clr.l	(a0)+
cmp.l	a0,a1
bne	loesch
bsr	mt_init

lea	$71000,a0
lea	$50000,a1
bsr	unpack
lea	$74000,a0	; Beginning of Compacted - Picture
lea	$40000,a1	; Entpackted Picture
bsr	unpack		; Entpacken
bsr	setupcol	; Farben setzen
lea	$78000,a0
lea	$47000,a1
bsr	unpack

move.l	#$2a11fffe,d0
move.l	#$01800000,d1
move.l	#$01080078,d2
move.l	#$010a0078,d3
move.w	#160,d4
lea	coppar,a0
setcop:
move.l	d0,(a0)+
move.l	d1,(a0)+
move.l	d2,(a0)+
move.l	d3,(a0)+
add.l	#$01000000,d0
move.w	d0,$dff180
sub.w	#1,d4
bne	setcop
move.l	d0,(a0)+
move.l	#$01800f0f,(a0)+
move.l	#$01080038,(a0)+
move.l	#$010a0038,(a0)+
move.l	#$cb11fffe,(a0)+
move.l	#$018000ff,(a0)+
move.l	#$00e00005,(a0)+
move.l	#$00e27004,(a0)+
move.l	#$cc11fffe,(a0)+
move.l	#$01800ff0,(a0)+
move.l	#$00e40005,(a0)+
move.l	#$00e67094,(a0)+
move.l	#$cd11fffe,(a0)+
move.l	#$01800f00,(a0)+
move.l	#$01002200,(a0)+
move.l	#$01860aaa,(a0)+
move.l	#$ce11fffe,d1
move.l	#$01800000,d2
move.w	#100,d0
nextcop:
move.l	d1,(a0)+
move.l	d2,(a0)+
move.l	#$01820eee,(a0)+
move.l	#$01840ccc,(a0)+
add.l	#$01000000,d1
add.l	#$00000002,d2
sub.w	#$1,d0
cmp.l	#$0011fffe,d1
bne	nextcop
sub.w	#1,d0
move.l	#$ffe1fffe,(a0)+
move.l	#$01b00000,(a0)+
move.l	#$01b00000,(a0)+
move.l	#$01b00000,(a0)+
contcop:
move.l	d1,(a0)+
move.l	d2,(a0)+
move.l	#$01820eee,(a0)+
move.l	#$01840ccc,(a0)+
add.l	#$01000000,d1
add.l	#$00000002,d2
sub.w	#1,d0
bne	contcop

move.l	$04,a6
jsr	-132(a6)
lea	gfxname,a1
jsr	-408(a6)
move.l	d0,gfxbase
move.l	d0,a0
move.l	50(a0),oldclist
move.l	#newclist,50(a0)
move.l	$6c,oldirq+2
move.l	#newirq,$6c
wait:
btst	#6,$bfe001
bne.s	wait
move.l	oldirq+2,$6c
move.l	gfxbase,a0
move.l	oldclist,50(a0)
move.l	$04,a6
move.l	gfxbase,a1
jsr	-414(a6)
jsr	-138(a6)
bsr	mt_end
rts

newirq:
movem.l	d0-d7/a0-a6,-(sp)

bsr	copyscroll
bsr	scrolldat
bsr	calcnewmod
bsr	writes1
bsr	scrollc1
bsr	turnit
bsr	check

bsr	scroll
sub.w	#1,shift
bne	notget
bsr	getchar
move.w	#16,shift
notget:

exit:
movem.l	(sp)+,d0-d7/a0-a6
oldirq:
jmp	$00000000

newclist:
dc.w	$008e,$2c81,$0090,$2cc1,$0092,$0038,$0094,$00d0
dc.w	$0102,$0000,$0104,$0000,$0108,120,$010a,120
dc.w	$0100,$4200,$0180,$0000
adresses:
dc.w	$00e0,$0004,$00e2,$0000,$00e4,$0004,$00e6,$0028
dc.w	$00e8,$0004,$00ea,$0050,$00ec,$0004,$00ee,$0078
copcol:
blk.l	16,0
dc.w	$120,0,$122,0,$124,0,$126,0,$128,$12a,$12c,0,$12e,0
dc.w	$130,0,$132,0,$134,0,$136,0,$138,$13a,$13c,0,$13e,0
coppar:
blk.w	160*8,0
blk.w	32,0
blk.w	100*8,0
dc.w	$180,0
dc.w	$ffff,$fffe

even
oldclist:
dc.l	0
gfxbase:
dc.l	0
gfxname:
dc.b	"graphics.library",0
even
unpack:
	add.l	#12,a0
	move.l	4(a0),d0
	add.l	d0,a0
	add.l	#8,a0
	move.l	a0,cmapchunk

iff1:	cmp.l	#$424f4459,(a0)
	beq	iff0
	add.l	#2,a0
	bra	iff1

iff0:	move.l	4(a0),d0	; Anzahl Bytes
	add.l	#1,d0
	and.l	#$fffffffe,d0

	add.l	#8,a0		; Pointer to first Byte

iff4:	clr.l	d2
	move.b	(a0)+,d2
	bmi	iff6

iff5:	move.b	(a0)+,(a1)+
	subi.l	#1,d0
	subi.b	#1,d2
	bpl	iff5
	bra	iff7
	
iff6:	neg.b	d2
	beq	iff7

iff61:	move.b	(a0),(a1)+
	subi.b	#1,d2
	bpl	iff61
	subi.l	#1,d0
	add.l	#1,a0

iff7:	subi.l	#1,d0
	bmi	iff8
	beq	iff8
	bra	iff4

iff8:	move.l	cmapchunk,a0
	move.l	cmap,a1
	add.l	#8,a0
	move.l	#16,d0

cmaploop:
	clr.l	d1
	move.b	(a0),d1
	lsl.w	#4,d1
	move.b	2(a0),d1
	lsr.b	#4,d1
	or.b	1(a0),d1
	move.w	d1,(a1)+
	add.l	#3,a0
	sub.w	#1,d0
	bne	cmaploop
	rts

cmapchunk:
	dc.l	0

cmap:	dc.l	color1

color1:	blk.w	16,0

setupcol:
lea	color1,a0
lea	copcol,a1
move.l	#$01800000,d0
move.l	#16,d1

suc1:
move.w	(a0)+,d0
move.l	d0,(a1)+
add.l	#$00020000,d0
sub.w	#1,d1
bne	suc1
rts

Turn72 = $3b000

copywerte:
lea	turn72+[48*160],a0
move.l	a0,a1

copyturn:
move.b	-(a0),(a1)+
cmp.l	#turn72,a0
bne	copyturn
rts

calcnewmod:
lea	$40000,a6
lea	adresses,a5
lea	mod1table,a0	; Order of rasters
move.l	#160,d7		; 72 lines
lea	coppar,a2
move.w	#$28,d4

move.w	(a0)+,d0	; Get Line No
mulu	#40*4,d0	; multiply by 5 Bitplanes Width 80
add.l	a6,d0		; add Startadress
move.l	d0,d6		; Save Adress

move.l	d0,d1		; Copy Adress
swap	d1
move.w	d1,2(a5)	; High
move.w	d0,6(a5)	; Low
add.w	d4,d0		; Next Line

move.l	d0,d1
swap	d1
move.w	d1,10(a5)
move.w	d0,14(a5)
add.w	d4,d0

move.l	d0,d1
swap	d1
move.w	d1,18(a5)
move.w	d0,22(a5)
add.w	d4,d0

move.l	d0,d1
swap	d1
move.w	d1,26(a5)
move.w	d0,30(a5)

clr.l	d0
move.l	#160,d4

cnmloop:
move.w	(a0)+,d1	; Get next

gtnxt:
mulu	d4,d1
add.l	a6,d1
move.l	d1,d2
sub.l	#40,d1
sub.l	d6,d1
move.w	d1,14(a2)
move.w	d1,10(a2)
move.l	d2,d6

add.l	#16,a2
sub.w	#1,d7
bne	cnmloop
rts

mod1table:
dc.w	0,1,2,3,4,5,6,7,8,9
dc.w	10,11,12,13,14,15,16,17,18,19
dc.w	20,21,22,23,24,25,26,27,28,29
dc.w	30,31,32,33,34,35,36,37,38,39
dc.w	40,41,42,43,44,45,46,47,48,49
dc.w	50,51,52,53,54,55,56,57,58,59
dc.w	60,61,62,63,64,65,66,67,68,69
dc.w	70,71,72,73,74,75,76,77,78,79
dc.w	80,81,82,83,84,85,86,87,88,89
dc.w	90,91,92,93,94,95,96,97,98,99
dc.w	100,101,102,103,104,105,106,107,108,109
dc.w	110,111,112,113,114,115,116,117,118,119
dc.w	120,121,122,123,124,125,126,127,128,129
dc.w	130,131,132,133,134,135,136,137,138,139
dc.w	140,141,142,143,144,145,146,147,148,149
dc.w	150,151,152,153,154,155,156,157,158,159
dc.w	160,161,162,163,164,165,166,167,168,169
dc.w	170,171,172,173,174,175,176,177,178,179
dc.w	180,181,182,183,184,185,186,187,188,189
dc.w	190,191,192,193,194,195,196,197,198,199

ti_adr:	dc.l	turn72
ti_mo:	dc.w	0
ti_no:	dc.w	0

turnit:
lea	mod1table,a0
move.l	ti_adr,a1
clr.l	d0
move.l	#159,d6
move.w	ti_mo,d5
bmi	tunit

turnit2:
move.b	(a1)+,d0
move.w	d0,(a0)+
dbf	d6,turnit2
add.w	#1,ti_no
cmp.w	#48,ti_no
bne	turnit3
sub.l	#160,a1
move.w	#$ffff,ti_mo

turnit3:
move.l	a1,ti_adr
move.w	#1,d0
rts

tunit:

tunit2:
move.b	(a1)+,d0
move.w	d0,(a0)+
dbf	d6,tunit2
sub.l	#160*2,a1
sub.w	#1,ti_no
bne	tunit3
add.l	#160,a1
move.w	#1,ti_mo
move.l	a1,ti_adr
add.w	#1,ti_count
cmp.w	#3,ti_count
bne	tunit3
clr.l	d0
rts

tunit3:
move.l	a1,ti_adr
move.w	#1,d0
rts

ti_count:	dc.w	0

check:
move.l	adrzeiger,a0
jump:
move.b	(a0)+,d0
cmp.b	#1,d0
bne	check2
move.l	#$40000,calcnewmod+2
check2:
cmp.b	#2,d0
bne	checkff
move.l	#$47000,calcnewmod+2
checkff:
cmp.b	#$ff,d0
bne	exitcheck
lea	adrd,a0
bra	jump
exitcheck:
move.l	a0,adrzeiger
rts
adrd:
blk.b	48,1
blk.b	48,2
blk.b	48,2
blk.b	48,1
dc.b	$ff
even
adrzeiger:	dc.l	adrd
scroll:
bsr	bltwait
move.l	#$dff000,a4
move.l	#$55182,$50(a4)
move.l	#$55180,$54(a4)
move.w	#0,$64(a4)
move.w	#0,$66(a4)
move.w	#$ffff,$44(a4)
move.w	#0,$46(a4)
move.l	#$e9f00000,$40(a4)
move.w	#$1818,$58(a4)
bsr	mt_music
wartemal:
btst	#6,$dff002
bne	wartemal
rts
getchar:
move.l	textzeiger,a0
move.b	(a0)+,d0
bne	contchar
lea	text,a0
move.b	(a0)+,d0
contchar:
move.l	a0,textzeiger
lea	ascii,a0
move.l	a0,a1
notrchar:
cmp.b	(a0)+,d0
bne	notrchar
sub.l	#1,a0
sub.l	a1,a0
clr.l	d1
move.l	a0,d1
cmp.l	#10,d1
bcs	mi10
cmp.l	#20,d1
bcs	mi20
cmp.l	#30,d1
bcs	mi30
cmp.l	#40,d1
bcs	mi40
cmp.l	#50,d1
bcs	mi50
bra	return
mi50:
sub.l	#40,d1
add.l	#$a00,d1
bra	mi10
mi40:
sub.l	#30,d1
add.l	#$780,d1
bra	mi10
mi30:
sub.l	#20,d1
add.l	#$500,d1
bra	mi10
mi20:
sub.l	#10,d1
add.l	#$280,d1
mi10:
mulu	#4,d1
move.l	#$50000,d2
add.l	d1,d2

move.l	d2,$dff050
move.l	#$55180+$2c,$dff054
move.w	#36,$dff064
move.w	#44,$dff066
move.l	#$ffffffff,$dff044
move.l	#$09f00000,$dff040
move.w	#$1002,$dff058
ratemal:
btst	#6,$dff002
bne	ratemal
return:
rts
shift:	dc.w	16
ascii:;  123456789012345678901234567890123456789
dc.b	"abcdefghijklmnopqrstuvwxyz0123456789.:,^*!? "
text:
dc.b	"sargon proudly presents !sounddisk no.24! ...   "
dc.b	"instruments ripped by btc ....   for our own samples look "
dc.b	"at sounddisk no.22 and no.23 ...      "
dc.b	"btc sends greetings only to his top contacts :  "
dc.b	"smithson of deathstar ...   tmf of dueco ent.      "
dc.b	"  jilsoft of it        crome of phenomena      "
dc.b	"   number one of bboys! i will call you soon !     "
dc.b	"and to fulcrum and cable of phalanx ...    "
dc.b	"wanted ....    we are looking for the group acid !!!   "
dc.b	"please contact us soon !!!       "
dc.b	"   sargon is looking for new members ....     "
dc.b	"signed off : btc       "
dc.b	0
even
textzeiger:
dc.l	text

adres:	dc.l	$57182
copyscroll:
move.l	#$ffffffff,$dff044
;move.w	#$2e,$dff066
;move.w	#$2e,$dff064
;move.w	#$2e,$dff062
move.w	#$2e,d0
move.w	d0,$dff066
move.w	d0,$dff064
move.w	d0,$dff062

move.l	adres,a0
move.l	#$55184,a1
lea	sinusdat,a3
move.w	(a3),d0
add.w	d0,adres+2
moveq	#19,d1
move.w	#$1001,d4
move.w	#$180,d3
move.l	#$dff000,a4

cloop2:
sub.w	d3,a0
sub.w	d3,a1
bsr	bltwait
move.l	a0,$54(a4)
move.l	a1,$50(a4)
move.w	#$f000,$44(a4)
move.l	#$09f00000,$40(a4)
move.w	#$1401,$58(a4)
add.w	d3,a0
add.w	d3,a1
add.w	(a3)+,a0

bsr	bltwait
move.l	a0,$54(a4)
move.l	a1,$50(a4)
move.l	a0,$4c(a4)
move.w	#$0f00,$44(a4)
move.l	#$0dfc0000,$40(a4)
move.w	d4,$58(a4)
add.w	(a3)+,a0

bsr	bltwait
move.l	a0,$54(a4)
move.l	a1,$50(a4)
move.l	a0,$4c(a4)
move.w	#$00f0,$44(a4)
move.w	d4,$58(a4)
add.w	(a3)+,a0

bsr	bltwait
move.l	a0,$54(a4)
move.l	a1,$50(a4)
move.l	a0,$4c(a4)
move.w	#$000f,$44(a4)
move.w	d4,$58(a4)
add.w	(a3)+,a0

add.w	#2,a0
add.w	#2,a1
dbf	d1,cloop2
rts

bltwait:
btst	#6,$dff002
bne	bltwait
rts

sinusdat:
blk.w	4,0
dc.w	96,0,0,96,0,0,96,0,96,0,96,0,96,0,96,96,0,96,96,0,96,96,96
dc.w	0,96,96,96,96,96,0,96,96,96,96,96,96,96,96,96,96,96
dc.w	96,0,96,96,96,96,96,96,96,96,96,96,96,0,96,96,96,96
dc.w	96,0,96,96,96,0,96,96,0,96,96,0,96,0,96,0,96,0,96,0,0
dc.w	96,0,0,96,0,0,0,0,0,0,0,0,96,-96
dc.w	0,0,0,0,0,0,0,0,-96,0,0,-96,0,0,-96,0,-96,0,-96,0,-96
dc.w	0,-96,-96,0,-96,-96,0,-96,-96,-96,0,-96,-96,-96,-96,-96,0
dc.w	-96,-96,-96,-96,-96,-96,-96,-96,-96,-96,-96,0,-96
dc.w	-96,-96,-96,-96,-96,-96,-96,-96,-96,-96,-96,0,-96,-96
dc.w	-96,-96,-96,0,-96,-96,-96,0,-96,-96,0,-96,-96,0,-96
dc.w	0,-96,0,-96,0,-96,0,0,-96,0,0,-96
blk.w	4,0
lsinus:

scrolldat:
lea	sinusdat,a0
lea	lsinus-2,a1
move.w	(a0),d0
scrollweiter:
move.w	2(a0),(a0)
addq.l	#2,a0
cmp.l	a0,a1
bne.s	scrollweiter
move.w	d0,(a1)
rts

writes1:
;add.l	#10*16*16,a0
moveq	#13,d4
lea	c1,a1
lea	coppar+[10*16*16],a0
not14:
moveq	#8,d0
contc1:
move.w	(a1)+,6(a0)
add.l	#16,a0
subq.w	#1,d0
bne	contc1
sub.l	#14,a1
subq.w	#1,d4
bne	not14
rts
c1:
dc.w	0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,13,12,11,10
dc.w	9,8,7,6,5,4,3,2,1
dc.w	0,0,0,0,0,0,0,0,0,0
dc.w	$100,$200,$300,$400,$500,$600,$700,$800,$900,$a00
dc.w	$b00,$c00,$d00,$e00,$f00,$e00,$d00,$c00,$b00,$a00,$900
dc.w	$800,$700,$600,$500,$400,$300,$200,$100
dc.w	0,0,0,0,0,0,0,0,0
lc1:
dc.w	0

blk.w	10,0

scrollc1:
lea	c1,a0
lea	lc1,a1
move.w	(a0),d0
scrollagain1:
move.w	2(a0),(a0)
addq.l	#2,a0
cmp.l	a0,a1
bne	scrollagain1
move.w	d0,(a1)
rts

mt_init:lea	mt_data,a0
	add.l	#$01d8,a0
	move.l	#$0080,d0
	moveq	#$00,d1
mt_init1:
	move.l	d1,d2
	subq.w	#1,d0
mt_init2:
	move.b	(a0)+,d1
	cmp.b	d2,d1
	bgt.s	mt_init1
	dbf	d0,mt_init2
	addq.b	#1,d2

mt_init3:
	lea	mt_data,a0
	lea	mt_sample1(pc),a1
	asl.l	#$08,d2
	asl.l	#$02,d2
	add.l	#$0258,d2
	add.l	a0,d2
	moveq	#$0e,d0
mt_init4:
	move.l	d2,(a1)+
	moveq	#$00,d1
	move.w	42(a0),d1
	asl.l	#1,d1
	add.l	d1,d2
	add.l	#$1e,a0
	dbf	d0,mt_init4

	lea	mt_sample1(pc),a0
	moveq	#$00,d0
mt_clear:
	move.l	(a0,d0),a1
	clr.l	(a1)
	addq.l	#4,d0
	cmp.l	#$3c,d0
	bne.s	mt_clear

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

	move.b	mt_data+$1d6,mt_maxpart+1
	rts

mt_end:	clr.w	$dff0a8
	clr.w	$dff0b8
	clr.w	$dff0c8
	clr.w	$dff0d8
	move.w	#$000f,$dff096
	rts

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

mt_break:
	not.w	mt_status
	rts

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

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

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

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

mt_data = $5a000

