;**************************************************
;*
;*	GIRL_INTRO by HAEGAR of THRUST
;*
;*	GRAFIX by BAT of THRUST
;*					>ri
;*	startdate:	07/26/88	>datcrm
;*					>crunch
;*	enddate:	08/05/88        
;*
;*	name:		THE MODEL
;*
;**************************************************

copperrama = $7e000
copperramb = $7f000
pic = $60000	
sound = pic- 44000
scrollfield = pic+112640
dat = sound - 24192	;fontram
fontram = dat
textplayarea = pic + 35222
trap:
	move.l #start,$80
	trap #0
	rts

start:
	move.w #$2700,sr
	movem.l d0-d7/a0-a6,-(sp)

;-------floppystop-------

	ori.b #$80,$bfd100
	ori.b #$8,$bfd100
	andi.b #$f7,$bfd100
	ori.b #$10,$bfd100
	andi.b #$ef,$bfd100
	bsr	s
	bsr	fill_cop1
	bsr copy_copper
	
;	fins addd incopperlist

	move.l	#bitplanes,a0
	move.l	#copperrama,a1
	move.l	#newcopper,a2
	sub.l	a2,a0
	add.l	a0,a1
	move.l	a1,bitplanesa_ram
	add.l	#$1000,a1
	move.l	a1,bitplanesb_ram


	move.l	#bitplanes_scroll,a0
	move.l	#copperrama,a1
	move.l	#newcopper,a2
	sub.l	a2,a0
	add.l	a0,a1
	move.l	a1,bitplanescrolla_ram
	add.l	#$1000,a1
	move.l	a1,bitplanescrollb_ram

	move.l	#copper_pointer,a0
	move.l	#copperrama,a1
	move.l	#newcopper,a2
	sub.l	a2,a0
	add.l	a0,a1
	move.l	a1,copperpointera_ram
	add.l	#$1000,a1
	move.l	a1,copperpointerb_ram

;	init	copperlist for interlace

	move.l	copperpointera_ram,a0
	move.l	#copperramb,d0
	swap	d0
	move.w	d0,2(a0)
	swap	d0
	move.w	d0,6(a0)

	move.l	copperpointerb_ram,a0
	move.l	#copperrama,d0
	swap	d0
	move.w	d0,2(a0)
	swap	d0
	move.w	d0,6(a0)

;--------init bitplanes
	move.l	bitplanesb_ram,a0	;init second line for lace
	move.w	#3,d0
bitpl_loop:
	move.w	6(a0),d1
	add.w	#320,d1
	move.w	d1,6(a0)	
	add.l	#8,a0
	dbra	d0,bitpl_loop

	move.l	bitplanescrollb_ram,a0	;init second line for lace
	move.w	#2,d0
bitpl_loop_:
	move.w	6(a0),d1
	add.w	#252,d1
	move.w	d1,6(a0)	
	add.l	#8,a0
	dbra	d0,bitpl_loop_

	bsr	textplay
	
	clr.w	$dff02a ;first pic is longframe
wait_cop:
	cmp.b	#00,$dff006
	bne	wait_cop
	move.w #$80,$dff096
	move.l #copperrama,$dff080
	clr.w $dff088
	move.w #$8080,$dff096

	bsr	mt_init
wait:
	cmp.b #$40,$dff006
	bne wait
	bsr	mt_newirq
	bsr	scroll_rout
	btst #6,$bfe001
	bne wait
	btst #10,$dff016
	beq wait


end:
	move.w #15,$dff096	;sound aus
copperinit:
	move.l	4,a6
	move.l	#gfxname,a1
	jsr	-408(a6)
	move.l	d0,a1
	move.w #$80,$dff096
	move.l	38(a1),$dff080
	clr.w $dff088
	move.w #$8080,$dff096
	
	jsr	-414(a6)

	move.w #$8020,$dff096	;mouse an
	movem.l (a7)+,d0-d7/a0-a6
	move.w #$2000,sr
	rte

gfxname:	dc.b	"graphics.library",0
even

;*********************************************
;*	textplay
;*********************************************
textplay:
	move.l	#textplayarea,a0
	move.l	#text,a1
move.w	#3,d5
yeah:
	move.w	#8,d6
text_loop:
	moveq	#0,d0
	move.b	(a1)+,d0	
	move.l	a0,text_sign
	bsr	text_blit
	bsr blitpixel_text
	add.l	#4,a0
	dbra	d6,text_loop
	add.l	#12764,a0
	dbra	d5,yeah
	move.l	#fontram,sign_scroll
rts
text:	;	 012345678
	dc.b	" PRESENT "
	dc.b	"         "
	dc.b	"  N E W  "
	dc.b	"S T U F F"
even
text_blit:
move.l #fontram,zeichensatz
move.l	zeichensatz,d7
cmp.b #$40,d0
ble weiter_ii
add.l #12094+252,d7
move.l d7,zeichensatz
weiter_ii:
sub.b #$20,d0
asl #2,d0
add.l zeichensatz,d0
move.l d0,sign_scroll
rts
blitpixel_text:
move.l	sign_scroll,a3
move.l	a0,a2
move.w	#30,d3
loop_d3:
move.w	#2,d2
loop_d2:
move.l	(a3)+,(a2)+
add.l	#$7a,a3
add.l	#$4c,a2
dbra	d2,loop_d2
add.l	#$50,a2
dbra	d3,loop_d3
rts
text_sign:	dc.l	0
;------copy_copper---------------------
copy_copper:
move.l #copperrama,a0
move.l #newcopper,a1
move.l #copper_end,a2
copper_schleife:
move.l (a1)+,(a0)+
cmp.l a1,a2
bge copper_schleife
move.l #copperramb,a0
move.l #newcopper,a1
move.l #copper_end,a2
copper_schleifeb:
move.l (a1)+,(a0)+
cmp.l a1,a2
bge copper_schleifeb
rts
newcopper:
	dc.l $008e2c89
	dc.l $00902cd9
	dc.l $0092003c
	dc.l $009400d4
	dc.l $01080230
	dc.l $00960020
	dc.l $010a0230
	dc.l $01020000

bitplanes:
	dc.l $00e00006
	dc.l $00e20000
	dc.l $00e40006
	dc.l $00e60050
	dc.l $00e80006
	dc.l $00ea00a0
	dc.l $00ec0006
	dc.l $00ee00f0
color:
	dc.l $01800004
	dc.l $01820732
	dc.l $01840842
	dc.l $01860a52
	dc.l $01880b92
	dc.l $018a0c91
	dc.l $018c0ec1
	dc.l $018e0ff0

	dc.l $01900169
	dc.l $019206ac
	dc.l $019407bc
	dc.l $01960add
	dc.l $01980ddd
	dc.l $019a0009
	dc.l $019c0007
	dc.l $019e000d
	
	dc.l $0100c204

	dc.l	$db07fffe
	dc.l	$01000200

	dc.l	$010801a8
	dc.l	$010a01a8
waitab:	blk.l	14,0
	dc.l	$e507fffe
bitplanes_scroll:
	dc.l $00e00007
	dc.l $00e2b800
	dc.l $00e40007
	dc.l $00e6b854
	dc.l $00e80007
	dc.l $00eab8a8

	dc.l	$0100b204	
dc.l	$f407fffe
	dc.l	$01000200
waitab1:	blk.l	14,0
dc.l	$01000204
copper_pointer:
	dc.l $00800000
	dc.l $00820000
dc.l $fffffffe
copper_end:


;************************
;* val
;************************
wavea_ram:	dc.l	0
waveb_ram:	dc.l	0
bitplanesa_ram:	dc.l	0	;zeiger auf bitpl in copperl
bitplanesb_ram:	dc.l 	0	;
copperpointera_ram:	dc.l	0
copperpointerb_ram:	dc.l	0
bitplanescrolla_ram:	dc.l	0
bitplanescrollb_ram:	dc.l	0
scroll_rout:


;-------time_scroll---------
tst.w scroll_time
beq scroll_sign_l
move.w scroll_time,d0
sub.w #1,d0
move.w d0,scroll_time
cmp.w #0,d0
bne ende
scroll_sign_l:
move.l #fontram,zeichensatz
bsr blit
sub.b	#$01,pixel
bne.L	ende
bsr blitpixel_scroll
move.b	#$2,pixel
get_sign:
move.l #scrolltext,a0
add.l zeiger,a0
clr.l d0
move.b (a0),d0
tst.b d0
bne weiter_o
add.l #1,a0
move.b (a0),d5
ext.w d5
move.w d5,scroll_time

add.l #2,zeiger
bra get_sign
weiter_o:
cmp.b #$40,d0
ble weiter_i
move.l zeichensatz,d7
add.l #12094+252,d7
move.l d7,zeichensatz
weiter_i:
sub.b #$20,d0
asl #2,d0
add.l zeichensatz,d0
move.l d0,sign_scroll
addq.l	#$01,zeiger
cmp.l	#endtext-1,a0
blt.L	ende
move.l	#0,zeiger
ende:
rts
sign_blit: dc.l 0
sign_ziel: dc.l 0
zeichensatz:	dc.l	0
blit:

bsr blitwait
move.l 		#scrollfield,$dff050	;A 
move.l		#scrollfield-2,$dff054 ;D
clr.w 		$dff064	;modulus
clr.w 		$dff066
clr.w 		$dff042
move.l		#$ffffffff,$dff044
move.w		#$9f0,$dff040	;bltcon1
move.w		#%0001100000101000,$dff058	;high&bright
;	          hhhhhhhhhhwwwwww		;10bit=1024lines
						;6bit =64*16bit=1024br
rts
blitpixel_scroll:
bsr blitwait
move.l		sign_scroll,$dff050
move.l		#scrollfield+80,$dff054
move.w		#$7a,$dff064
move.w		#$50,$dff066
move.w		#$0,$dff042
move.l		#$ffffffff,$dff044
move.w		#$9f0,$dff040
move.w		#%0001100000000010,$dff058
rts
pixel: dc.b 8
even
zeiger: dc.l 0
even
scrolltext:
DC.B "                 THRUST PRESENT          NEW  STUFF     ",0,100
DC.B "     CALL OUR BBS IN CANADA ...      416-481-9455    ",0,110
DC.B "24 H  ONLINE ...   300 / 1200 / 2400 AND 9600  BAUD !"
DC.B "              "
DC.B "IF YOU WANT TO CONTACT US WRITE TO:        PLK 007553 D"
DC.B "   8510 FUERTH            WEST-GERMANY         "
DC.B "        "
R > GREETS > to this place !
endtext:
even
sign_scroll: dc.l fontram

scroll_time: dc.w 0

blitwait:
btst #14,$dff002
bne blitwait
rts



fill_cop1:
lea	ctab1,a1
lea		waitab,a0		; CopperListe um WAIT erganzen
move.l		#$dc07,d1		; ab Zeile $df spalte $09
move.l		#6,d0			; 14 WAIT's
coloop2:
move.w		d1,(a0)+		; WAIT in Copperliste schreibe
move.w		#$fffe,(a0)+		; Alle Bits Von WAIT Beachten
move.w		#$0180,(a0)+		; Vordergrundfarbe
move.w		(a1)+,(a0)+		; Default-Wert
add.w		#$100,d1   ; WAIT-Wert um eine Zeile erhoehen
dbra 		d0,coloop2		; schon 14 mal durchlaufen ???
; --------------------------------------
lea		waitab1,a0		; CopperListe um WAIT erganzen
lea	ctab2,a1
move.l		#$f907,d1		; ab Zeile $df spalte $09
move.l		#6,d0			; 14 WAIT's
coloop21:
move.w		d1,(a0)+		; WAIT in Copperliste schreibe
move.w		#$fffe,(a0)+		; Alle Bits Von WAIT Beachten
move.w		#$0180,(a0)+		; Vordergrundfarbe
move.w		(a1)+,(a0)+		; Default-Wert
add.w		#$0100,d1   ; WAIT-Wert um eine Zeile erhoehen
dbra 		d0,coloop21		; schon 14 mal durchlaufen ???
; --------------------------------------

rts
ctab1:	dc.w $6,$8,$a,$c,$e,$f,$2f
ctab2:	dc.w $f,$e,$c,$a,$8,$6,$4


mt_speed=$0f4


mt_init:

move.l	#sound,a0
move.l	#mt_sample1,a1
move.w	#14,d0
move.l	a0,d1
add.l	#64,d1
mt_loop:
move.l	d1,(a1)+
add.l	(a0)+,d1
dbra	d0,mt_loop
move.l	d1,mt_sampleinfo	


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

move.w		#0,$dff0a8
move.w		#0,$dff0b8
move.w		#0,$dff0c8
move.w		#0,$dff0d8
eor.w		#$c000,mt_voice0+12
clr.l		mt_partnrplay
clr.l		mt_partnote
clr.l		mt_partpoint

move.l		mt_sampleinfo,a0
move.b		$1d6(a0),mt_maxpart+1
move.b		$1d7(a0),mt_kn1+1
rts


mt_newirq:
movem.l		d0-d7/a0-a6,-(a7)
bsr		mt_music
movem.l		(a7)+,d0-d7/a0-a6

rts

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

mt_notsix:
lea		mt_aud1temp,a6
tst.b		3(a6)
beq.s		mt_arp1
move.l		#$dff0a0,a5		
bsr.s		mt_arprout

mt_arp1:
lea		mt_aud2temp,a6
tst.b		3(a6)
beq.s		mt_arp2
move.l		#$dff0b0,a5
bsr.s		mt_arprout

mt_arp2:
lea		mt_aud3temp,a6
tst.b		3(a6)
beq.s		mt_arp3
move.l		#$dff0c0,a5
bsr.s		mt_arprout

mt_arp3:
lea		mt_aud4temp,a6
tst.b		3(a6)
beq.s		mt_arp4
move.l		#$dff0d0,a5
bsr.s		mt_arprout
mt_arp4:
bra.L		mt_stop


mt_arprout:
tst.w	24(a6)
beq.s	mt_noslide

clr.w	d0
move.b	25(a6),d0
lsr.b	#4,d0
tst.b	d0
beq.s	mt_voldwn2
bsr.L	mt_pushvol1
bra.s	mt_noslide

mt_voldwn2:
clr.w	d0
move.b	25(a6),d0
bsr.L	mt_pushvol2

mt_noslide:
move.b	2(a6),d0
and.b	#$0f,d0
tst.b	d0
beq.L	mt_arpegrt
cmp.b	#3,d0
beq.L	mt_arpegrt
cmp.b	#4,d0
beq.L	mt_arpegrt
cmp.b	#5,d0
beq.L	mt_arpegrt
cmp.b	#1,d0
beq.s	mt_portup
cmp.b	#6,d0
beq.s	mt_portup
cmp.b	#7,d0
beq.s	mt_portup
cmp.b	#8,d0
beq.s	mt_portup
cmp.b	#2,d0
beq.s	mt_portdwn
cmp.b	#9,d0
beq.s	mt_portdwn
cmp.b	#10,d0
beq.s	mt_portdwn
cmp.b	#11,d0
beq.s	mt_portdwn
cmp.b	#13,d0
beq.s	mt_volup
rts

mt_portup:
clr.w	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:
clr.w	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_volup:
clr.w	d0
move.b	3(a6),d0
lsr.b	#4,d0
tst.b	d0
beq.s	mt_voldwn
mt_pushvol1:
add.w	d0,$12(a6)
cmp.w	#$40,$12(a6)
bmi.s	mt_ok3
move.w	#$40,$12(a6)
mt_ok3:
move.w	$12(a6),8(a5)
rts

mt_voldwn:
clr.w	d0
move.b	3(a6),d0
mt_pushvol2:
and.b	#$0f,d0
sub.w	d0,$12(a6)
bpl.s	mt_ok4
clr.w	$12(a6)
mt_ok4:
move.w	$12(a6),8(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:
clr.l		d0
move.b		3(a6),d0
lsr.b		#4,d0
bra.s		mt_cont

mt_loop3:
clr.l		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:
lsl.w		#1,d0
clr.l		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:
move.l		mt_sampleinfo,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
clr.l		d1
move.b		(a2,d0),d1
mulu		#$0400,d1
add.l		mt_partnote,d1
move.l		d1,mt_partpoint
clr.w		mt_dmacon

move.l		#$dff0a0,a5
lea		mt_aud1temp,a6
bsr.L		mt_playit

move.l		#$dff0b0,a5
lea		mt_aud2temp,a6
bsr.L		mt_playit

move.l		#$dff0c0,a5
lea		mt_aud3temp,a6
bsr.L		mt_playit

move.l		#$dff0d0,a5
lea		mt_aud4temp,a6
bsr.L		mt_playit

move.l		#mt_speed,d0
mt_rls:
dbf		d0,mt_rls

move.l		#$8000,d0
add.w		mt_dmacon,d0
move.w		d0,$dff096

move.l		#mt_aud4temp,a6
cmp.w		#1,14(a6)
bne.s		mt_voice3
move.l		10(a6),$dff0d0
move.w		#1,$dff0d4
mt_voice3:
move.l		#mt_aud3temp,a6
cmp.w		#1,14(a6)
bne.s		mt_voice2
move.l		10(a6),$dff0c0
move.w		#1,$dff0c4
mt_voice2:
move.l		#mt_aud2temp,a6
cmp.w		#1,14(a6)
bne.s		mt_voice1
move.l		10(a6),$dff0b0
move.w		#1,$dff0b4
mt_voice1:
move.l		#mt_aud1temp,a6
cmp.w		#1,14(a6)
bne.s		mt_voice0
move.l		10(a6),$dff0a0
move.w		#1,$dff0a4

mt_voice0:
lea		mt_modulate,a0
move.l		mt_partnote,d0
lsl.b		#7,d0
add.l		#$10,d0
move.l		d0,mt_partnote
cmp.l		#$400,d0
bne.s		mt_stop
clr.l		mt_partnote
addq.l		#1,mt_partnrplay
clr.l		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:
rts


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

clr.l		d3
lea		mt_samples,a1
move.l		d2,d4
asl		#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:
move.w	20(a6),d0
lsl.w	#4,d0
add.w	20(a6),d0
move.w	d0,$dff09e

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	#14,d0
bne.s	mt_noset
move.w	2(a6),24(a6)
rts
mt_noset:
tst.b	3(a6)
bne.s	mt_noclr
clr.w	24(a6)
mt_noclr:
cmp.b	#3,d0
beq.s	mt_modvol
cmp.b	#6,d0
beq.s	mt_modvol
cmp.b	#9,d0
beq.s	mt_modvol
cmp.b	#4,d0
beq.s	mt_modper
cmp.b	#7,d0
beq.s	mt_modper
cmp.b	#10,d0
beq.s	mt_modper
cmp.b	#5,d0
beq.s	mt_modvolper
cmp.b	#8,d0
beq.s	mt_modvolper
cmp.b	#11,d0
beq.s	mt_modvolper
cmp.b	#12,d0
bne.s	mt_nochnge
move.b	3(a6),8(a5)
mt_nochnge:
rts

mt_modvol:
move.w	20(a6),d0
bra.s	mt_push

mt_modper:
move.w	20(a6),d0
lsl.w	#4,d0
bra.s	mt_push

mt_modvolper:
move.w	20(a6),d0
lsl.w	#4,d0
add.w	20(a6),d0

mt_push:
add.w	#$8000,d0
move.w	d0,$dff09e
rts


mt_aud1temp:
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0000,$0001,$0000,$0000
mt_aud2temp:
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0000,$0002,$0000,$0000
mt_aud3temp:
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0000,$0004,$0000,$0000
mt_aud4temp:
dc.w $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
dc.w $0000,$0000,$0008,$0000,$0000
mt_partnote:
dc.l 0
mt_partnrplay:
dc.l 0
mt_counter:
dc.l 0
mt_partpoint:
dc.l 0
mt_samples:
dc.w $0000,$0000
mt_sample1:
dc.l 0
mt_sample2:
dc.l 0
mt_sample3:
dc.l 0
mt_sample4:
dc.l 0
mt_sample5:
dc.l 0
mt_sample6:
dc.l 0
mt_sample7:
dc.l 0
mt_sample8:
dc.l 0
mt_sample9:
dc.l 0
mt_sample10:
dc.l 0
mt_sample11:
dc.l 0
mt_sample12:
dc.l 0
mt_sample13:
dc.l 0
mt_sample14:
dc.l 0
mt_sample15:
dc.l 0
mt_maxpart:
dc.w $0000
mt_kn1:
dc.w $0000
mt_dmacon:
dc.w $0000

mt_modulate:
dc.w $0c39,$0039,$00bf,$ec01,$6630,$0839,$0007,$00bf
dc.w $e001,$6626,$2c79,$0000,$0004,$43fa,$0020,$4eae
dc.w $fe68,$2c40,$4280,$41fa,$0026,$223c,$0000,$0032
dc.w $4eae,$ffa6,$60ee,$0000,$0000,$4e75,$696e,$7475
dc.w $6974,$696f,$6e2e,$6c69,$6272,$6172,$7900,$0104
dc.w $1753,$6f75,$6e64,$5472,$6163,$6b65,$7220,$5632
dc.w $0063,$00f0,$20a9,$2054,$6865,$204a,$756e,$676c
dc.w $6520,$436f,$6d6d,$616e,$6400,$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_sampleinfo:
dc.l	0
mt_music_pointer:
dc.l	0


read  = $5c6d4
lowwr = $30000

s:
move.l	#crunch_end,a0
move.l	#dat,a1		
move.l -(a0),a2		
add.l a1,a2		
move.l -(a0),d5		
move.l -(a0),d0		
eor.l d0,d5		

notfinished:
lsr.l #1,d0
bne.S notempty1
bsr getnextlwd
notempty1:
bcs.S bigone		

moveq #8,d1	
moveq #1,d3	
lsr.l #1,d0
bne.S notempty2
bsr getnextlwd
notempty2:
bcs.S dodupl	

moveq #3,d1	
clr.w d4	

dojmp:		
		
bsr rdd1bits	
move.w d2,d3	
add.w d4,d3	

getd3chr:

moveq #7,d1	
get8bits:
lsr.l #1,d0
bne.S notempty3
bsr getnextlwd
notempty3:
roxl.l #1,d2
dbf d1,get8bits	

move.b d2,-(a2)
dbf d3,getd3chr	
bra nextcmd

bigjmp:
moveq #8,d1	
moveq #8,d4	
		
		
		
bra dojmp

bigone:
moveq #2,d1	
bsr rdd1bits
cmp.b #2,d2	
blt.S midjumps	
cmp.b #3,d2	
beq.S bigjmp	


moveq #8,d1	
bsr rdd1bits	
move.w d2,d3	
move.w #12,d1	
bra dodupl	

midjumps:
move.w #9,d1	
add.w d2,d1
addq #2,d2
move.w d2,d3	

dodupl:
bsr rdd1bits	
		
		
copyd3bytes:
subq #1,a2

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

dbf d3,copyd3bytes

nextcmd:
cmp.l a2,a1
blt.L notfinished
rts


getnextlwd:
move.l -(a0),d0
eor.l d0,d5
move.w #$10,ccr
roxr.l #1,d0
rts

rdd1bits:	
subq.w #1,d1
clr.w d2

getbits:
lsr.l #1,d0
bne.S notempty
move.l -(a0),d0
eor.l d0,d5
move.w #$10,ccr
roxr.l #1,d0

notempty:
roxl.l #1,d2
dbf d1,getbits
rts

crunch:
blk.b 84680
crunch_end:	
