org	$40000
load	$40000
*****************************
***   BTC of SARGON !!!   ***
***      Call Germany     ***
***      02202/36903      ***
*****************************
***     GFX to $76000     ***
***    Module to $42000   ***
*****************************
*** This Intro is useful  ***
*** for the Bootintro !!! ***
*****************************
***  Sound shouldn`t be   ***
***  longer than $52000   ***
*****************************
s:
bset	#1,$bfe001
bsr	mt_init
lea	$52000,a0
lea	$61000,a1
l1:
clr.l	(a0)+
cmp.l	a0,a1
bne	l1
lea	$70000,a0
lea	$71000,a1
l2:
clr.l	(a0)+
cmp.l	a0,a1
bne	l2

lea	coppar,a0
move.l	#$7811fffe,d0
move.w	#$0182,d1
lea	color,a1
move.w	#6,d3
nt:
move.w	#16,d2
makec1:
move.l	d0,(a0)+
move.w	d1,(a0)+
move.w	(a1)+,(a0)+
add.l	#$01000000,d0
sub.w	#1,d2
bne	makec1
add.l	#$02000000,d0
sub.w	#1,d3
bne	nt

lea	$76000,a0
lea	$50000,a1
bsr	unpack
bsr	setupcol
bsr	mb

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	makeall
bsr	blittall
bsr	makescrolly
bsr	stars
bsr	scroll
bsr	blittotti
sub.w	#1,w2
bne	exit
move.w	#4,w2
sub.l	#8,wert
cmp.l	#$51ef0,wert
bpl	exit
move.l	#$51f10,wert
exit:
movem.l	(sp)+,d0-d7/a0-a6
oldirq:
jmp	$00000000

newclist:
dc.w	$008e,$2c81,$0090,$30c1,$0092,$0038,$0094,$00d0
dc.w	$0102,$0000,$0104,$0000,$0108,40,$010a,0
dc.w	$0100,$3400
dc.w	$00e0,$0005,$00e2,$3000,$00e4,$0006,$00e6,$0000
dc.w	$00e8,$0005,$00ea,$3028
copcol:
blk.l	4,0
dc.w	$120,0,$122,0,$124,0,$126,0,$128,0,$12a,0,$12c,0,$12e,0
dc.w	$130,0,$132,0,$134,0,$136,0,$138,0,$13a,0,$13c,0,$13e,0
dc.w	$1011,$fffe,$180,1
dc.w	$7611,$fffe,$0100,$2200
dc.w	$e0,$5,$e2,$3000+[74*80],$e4,$5,$e6,$3028+[74*80],$10a,40
dc.w	$192,$fff
coppar:
blk.w	6*16*4,0
dc.w	$e511,$fffe,$180,1
dc.w	$e611,$fffe,$180,2
dc.w	$e711,$fffe,$180,3
dc.w	$e811,$fffe,$180,4
dc.w	$e911,$fffe,$e2,$8000,$e6,$8028,$180,5,$182,$fff,$184,$0
dc.w	$186,$e4e
dc.w	$ffe1,$fffe,$190,0
dc.w	$1a11,$fffe,$00e0,$0007,$00e4,$0007,$00e2,$0002
dc.w	$00e6,$002e,$182,$999,$108,48,$010a,48

dc.w	$1c11,$fffe,$180,$400
dc.w	$1d11,$fffe,$180,$600
dc.w	$1e11,$fffe,$180,$800
dc.w	$1f11,$fffe,$180,$600
dc.w	$2011,$fffe,$180,$400
dc.w	$2111,$fffe,$180,$4

dc.w	$2411,$fffe,$180,$400
dc.w	$2511,$fffe,$180,$600
dc.w	$2611,$fffe,$180,$800
dc.w	$2711,$fffe,$180,$600
dc.w	$2811,$fffe,$180,$400
dc.w	$2911,$fffe,$180,$4

dc.w	$2c11,$fffe,$180,4
dc.w	$2d11,$fffe,$180,3
dc.w	$2e11,$fffe,$180,2
dc.w	$2f11,$fffe,$180,1
dc.w	$3011,$fffe,$180,0
dc.w	$ffff,$fffe

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	#8,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	8,0

setupcol:		; Set Colors
lea	color1,a0
lea	copcol,a1
move.l	#$01800000,d0
move.l	#4,d1

suc1:
move.w	(a0)+,d0
move.l	d0,(a1)+
add.l	#$00020000,d0
sub.w	#1,d1
bne	suc1
rts
adr:
dc.l	$500f8,$500fc,$50100,$50104,$50108,$5010c
badr:
dc.l	$53008,$5300c,$53010+160,$53014+320,$53018+480
dc.l	$5301c+640
blittall:
move.w	#6,d2
lea	adr,a0
lea	badr,a1
notblittet:
move.l	(a0)+,d0
move.l	(a1)+,d1
bsr	blittp
sub.w	#1,d2
bne	notblittet
rts

blittp:
move.l	d0,$dff050
move.l	d1,$dff054
move.w	#36,$dff064
move.w	#36,$dff066
move.w	#$ffff,$dff044
move.w	#$ffff,$dff046
move.l	#$09f00000,$dff040
move.w	#$1702,$dff058
waitp:
btst	#6,$dff002
bne	waitp
rts

makeall:
lea	badr,a1
move.l	sz1,a0
bsr	getsinus
move.l	a0,sz1

move.l	sz2,a0
bsr	getsinus
move.l	a0,sz2

move.l	sz3,a0
bsr	getsinus
move.l	a0,sz3

move.l	sz4,a0
bsr	getsinus
move.l	a0,sz4

move.l	sz5,a0
bsr	getsinus
move.l	a0,sz5

move.l	sz6,a0
bsr	getsinus
move.l	a0,sz6
rts

getsinus:
move.l	(a0)+,d0
cmp.l	#$ffff,d0
bne	notf
lea	sd,a0
move.l	(a0)+,d0
notf:
add.l	d0,(a1)+
rts
sd:
dc.l	0,0,0,80,80,80,80,80,80,160,160,160,160,240,240,320,320
dc.l	-320,-320,-240,-240,-160,-160,-160,-160,-80,-80,-80,-80
dc.l	-80,-80
dc.l	$ffff
sz1:	dc.l	sd
sz2:	dc.l	sd+[2*4]
sz3:	dc.l	sd+[4*4]
sz4:	dc.l	sd+[6*4]
sz5:	dc.l	sd+[8*4]
sz6:	dc.l	sd+[10*4]

mb:
lea	board,a3
move.l	#$546d0+[3*80],d3
move.w	#6,d5
nnar:
move.w	#20,d4
notall:
move.b	(a3)+,d0
bsr	makesen
add.l	#2,d3
sub.w	#1,d4
bne	notall
add.l	#[35*40],d3
sub.w	#1,d5
bne	nnar
rts

makesen:
move.l	#45,d1
lea	ascii,a0
nrc:
cmp.b	(a0,d1.l),d0
beq	printit
sub.l	#1,d1
bpl	nrc
printit:
lsl.l	#2,d1
add.l	#atab,d1
move.l	d1,a2
move.l	(a2),d0
move.l	d3,d1
bsr	getchar
rts

getchar:
move.l	d0,$dff050
move.l	d1,$dff054
move.w	#38,$dff064
move.w	#38,$dff066
move.w	#$ffff,$dff044
move.w	#$ffff,$dff046
move.l	#$09f00000,$dff040
move.w	#$0801,$dff058
waitforchar:
btst	#6,$dff002
bne	waitforchar
rts
b = $50ff0
c = $514f0
d = $519f0
atab:
dc.l	b,b+2,b+4,b+6,b+8,b+10,b+12,b+14,b+16,b+18,b+20,b+22
dc.l	b+24,b+26,b+28,b+30,b+32,b+34,b+36,b+38
dc.l	c,c+2,c+4,c+6,c+8,c+10,c+12,c+14,c+16,c+18,c+20,c+22
dc.l	c+24,c+26,c+28,c+30,c+32,c+34,c+36,c+38
dc.l	d,d+2,d+4,d+6,d+8,d+10,d+12,d+14,d+16,d+18,d+20,d+22
dc.l	d+24,d+26,d+28,d+30,d+32
ascii:
dc.b	"abcdefghijklmnopqrst"
dc.b	"uvwxyz0123456789,-./"
dc.b	":! (*)"
board:
dc.b	"      presents:     "
dc.b	"utealeeteas disk 001"
dc.b	" intro,muzak by btc "
dc.b	" contact us under : "
dc.b	"    plk 073908 c    "
dc.b	"5060 berg.gladbach 2"
text:
dc.b	"sargon ...  there*s a new mighty place on earth ... "
dc.b	"hey there ... what a lousy intro , but i planed to put "
dc.b	"it into the bootblock (as you can see (i hope so !!!)"
dc.b	"...    credits for this intro : coding ... btc        "
dc.b	"chars and gfx ... wow-phalanx-thrust    muzak ... "
dc.b	"btc and danny (both sargon and not alpha flight)    "
dc.b	"we send our handshakes to mighty guys like       "
dc.b	"red sector (thanks for sending),phalanx (great work cable)"
dc.b	",vortex 42 (hi bonfire !!!),nemesis (only one disk ...)"
dc.b	",deathstar,thrust,alpha flight (mighty ...(only megatron))"
dc.b	",tjc,vision factory and beyonders (what about cracking for"
dc.b	" you ...),wow,acid and to all our contacs around this "
dc.b	"little world !!!   thanks must go to some italian and "
dc.b	"australian software houses for some originals     "
dc.b	"we are looking for new members ... contact us under :"
dc.b	"plk 073908 c    5060 berg.gladbach 2       we were the "
dc.b	"best alpha flighters ....    watch out for our demos and "
dc.b	"cracks ...   "
dc.b	"a message to all you there !!! don*t greet us under "
dc.b	"alpha flight      it*s sargon time !!!      "
dc.b	"there*s a good chance to get famous .... it*s called sargon"
dc.b	" ....          "
dc.b	0
even
textzeiger:	dc.l	text

makescrolly:
sub.w	#1,shift
bne	return
move.w	#4,shift
move.l	textzeiger,a0
move.b	(a0)+,d0
bne	notff
lea	text,a0
move.b	(a0)+,d0
notff:
move.l	#$7002a,d3
move.l	a0,textzeiger
bsr	searchchar
return:
rts

searchchar:
move.l	#45,d1
lea	ascii,a0
nrc2:
cmp.b	(a0,d1.l),d0
beq	printit2
sub.l	#1,d1
bpl	nrc2
printit2:
lsl.l	#2,d1
add.l	#atab,d1
move.l	d1,a2
move.l	(a2),d0
move.l	d3,d1
bsr	getchar2
rts

getchar2:
move.l	d0,$dff050
move.l	d1,$dff054
move.w	#38,$dff064
move.w	#42,$dff066
move.w	#$ffff,$dff044
move.w	#$ffff,$dff046
move.l	#$09f00000,$dff040
move.w	#$0801,$dff058
waitforchar2:
btst	#6,$dff002
bne	waitforchar2
rts
scroll:
move.l	#$70002,$dff050
move.l	#$70000,$dff054
move.w	#40,$dff064
move.w	#40,$dff066
move.w	#$ffff,$dff044
move.w	#$0,$dff046
move.l	#$c9f00000,$dff040
move.w	#$0818,$dff058
wait2getchar:
btst	#6,$dff002
bne	wait2getchar
rts
shift:	dc.w	8
color:
dc.w	$404,$505,$606,$707,$808,$909,$a0a,$b0b,$b0b,$a0a,$909,$808
dc.w	$707,$606,$505,$404
dc.w	4,5,6,7,8,9,10,11,11,10,9,8,7,6,5,4
dc.w	$440,$550,$660,$770,$880,$990,$aa0,$bb0,$bb0,$aa0,$990,$880
dc.w	$770,$660,$550,$440
dc.w	$444,$555,$666,$777,$888,$999,$aaa,$bbb,$bbb,$aaa,$999,$888
dc.w	$777,$666,$555,$444
dc.w	$400,$500,$600,$700,$800,$900,$a00,$b00,$b00,$a00,$900,$800
dc.w	$700,$600,$500,$400
dc.w	$40,$50,$60,$70,$80,$90,$a0,$b0,$b0,$a0,$90,$80,$70,$60,$50
dc.w	$40
blittotti:
move.l	wert,$dff050
move.l	#$58010,$dff054
move.w	#32,$dff064
move.w	#32,$dff066
move.w	#$ffff,$dff044
move.w	#$ffff,$dff046
move.l	#$09f00000,$dff040
move.w	#$1804,$dff058
bsr	mt_music
waitforotti:
btst	#6,$dff002
bne	waitforotti
rts
wert:	dc.l	$51f10
w2:	dc.w	3
stars:
lea	startab,a5
move.w	#138,d5

lea	$60000,a0
clr.l	d7
clr.l	d0
sub.w	#1,d5

nextstar:
move.w	(a5),d0
move.w	2(a5),d1
move.w	4(a5),d3
add.w	d3,(a5)

mulu	#40,d1
move.w	d1,d7
move.w	d0,d2
lsr	#3,d0
add.w	d0,d7
and.w	#7,d2
moveq	#7,d0
sub.w	d2,d0
bclr	d0,(a0,d7.w)
cmp.w	#320,(a5)
bcs	contsp
sub.w	#320,(a5)

contsp:
move.w	(a5),d0
move.w	d0,d2
lsr.w	#3,d0
add.w	d0,d1
and.w	#7,d0
moveq	#7,d0
sub.w	d2,d0
bset	d0,(a0,d1.w)
add.w	#6,a5
dbf	d5,nextstar
rts

startab:
dc.w	182,0,10
dc.w	89,0,8
dc.w	120,1,7
dc.w	262,1,1
dc.w	165,2,7
dc.w	171,2,9
dc.w	251,3,6
dc.w	54,3,10
dc.w	143,4,9
dc.w	103,4,6
dc.w	85,5,8
dc.w	240,5,7
dc.w	2,6,9
dc.w	46,6,1
dc.w	119,7,10
dc.w	9,7,4
dc.w	177,8,9
dc.w	191,8,8
dc.w	121,9,6
dc.w	33,9,10
dc.w	94,10,2
dc.w	287,10,1
dc.w	247,11,8
dc.w	124,11,10
dc.w	204,12,3
dc.w	279,12,8
dc.w	180,13,8
dc.w	237,13,7
dc.w	221,14,7
dc.w	163,14,6
dc.w	44,15,4
dc.w	238,15,9
dc.w	273,16,4
dc.w	226,16,1
dc.w	20,17,5
dc.w	135,17,5
dc.w	101,18,3
dc.w	139,18,10
dc.w	258,19,1
dc.w	127,19,3
dc.w	167,20,10
dc.w	135,20,4
dc.w	101,21,8
dc.w	123,21,4
dc.w	131,22,9
dc.w	153,22,4
dc.w	177,23,1
dc.w	8,23,5
dc.w	34,24,8
dc.w	219,24,4
dc.w	146,25,4
dc.w	26,25,3
dc.w	273,26,4
dc.w	232,26,7
dc.w	159,27,8
dc.w	260,27,4
dc.w	286,28,2
dc.w	122,28,9
dc.w	251,29,5
dc.w	252,29,7
dc.w	130,30,9
dc.w	118,30,9
dc.w	272,31,8
dc.w	181,31,2
dc.w	64,32,2
dc.w	122,32,8
dc.w	74,33,2
dc.w	68,33,7
dc.w	43,34,9
dc.w	314,34,6
dc.w	256,35,3
dc.w	102,35,2
dc.w	205,36,3
dc.w	109,36,4
dc.w	277,37,9
dc.w	48,37,8
dc.w	264,38,5
dc.w	45,38,9
dc.w	238,39,6
dc.w	249,39,1
dc.w	182,40,1
dc.w	89,40,3
dc.w	120,41,5
dc.w	262,41,1
dc.w	165,42,7
dc.w	171,42,3
dc.w	251,43,6
dc.w	54,43,2
dc.w	143,44,5
dc.w	103,44,6
dc.w	85,45,3
dc.w	240,45,7
dc.w	2,46,4
dc.w	46,46,1
dc.w	119,47,4
dc.w	9,47,5
dc.w	177,48,8
dc.w	191,48,2
dc.w	121,49,6
dc.w	33,49,1
dc.w	68,50,5
dc.w	43,50,1
dc.w	314,51,3
dc.w	256,51,5
dc.w	102,52,6
dc.w	205,52,3
dc.w	109,53,3
dc.w	277,53,2
dc.w	48,54,6
dc.w	264,54,1
dc.w	45,55,5
dc.w	238,55,2
dc.w	249,56,6
dc.w	182,56,8
dc.w	89,57,1
dc.w	120,57,5
dc.w	262,58,2
dc.w	165,58,6
dc.w	171,59,4
dc.w	251,59,3
dc.w	130,60,1
dc.w	118,60,7
dc.w	272,61,8
dc.w	181,61,2
dc.w	64,62,1
dc.w	122,62,8
dc.w	74,63,2
dc.w	68,63,7
dc.w	43,64,3
dc.w	314,64,6
dc.w	256,65,5
dc.w	102,65,2
dc.w	205,66,3
dc.w	109,66,4
dc.w	277,67,7
dc.w	48,67,8
dc.w	264,68,5
dc.w	45,68,3
dc.w	238,69,2
dc.w	249,69,1

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,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,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,a6
	tst.b	3(a6)
	beq.s	mt_arp1
	lea	$dff0a0,a5		
	bsr.s	mt_arprout
mt_arp1:lea	mt_aud2temp,a6
	tst.b	3(a6)
	beq.s	mt_arp2
	lea	$dff0b0,a5
	bsr.s	mt_arprout
mt_arp2:lea	mt_aud3temp,a6
	tst.b	3(a6)
	beq.s	mt_arp3
	lea	$dff0c0,a5
	bsr.s	mt_arprout
mt_arp3:lea	mt_aud4temp,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,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,a6
	bsr	mt_playit
	lea	$dff0b0,a5
	lea	mt_aud2temp,a6
	bsr	mt_playit
	lea	$dff0c0,a5
	lea	mt_aud3temp,a6
	bsr	mt_playit
	lea	$dff0d0,a5
	lea	mt_aud4temp,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,a6
	cmp.w	#1,14(a6)
	bne.s	mt_voice3
	move.l	10(a6),$dff0d0
	move.w	#1,$dff0d4
mt_voice3:
	lea	mt_aud3temp,a6
	cmp.w	#1,14(a6)
	bne.s	mt_voice2
	move.l	10(a6),$dff0c0
	move.w	#1,$dff0c4
mt_voice2:
	lea	mt_aud2temp,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 = $42000
