
	opt	c-,o-


	Section ddp1,code_C

	move.l	4.w,a6
	move.l	#scrsize,d0
	move.l	#$10002,d1
	jsr	-198(a6)
	move.l	d0,screen

	move.l	4.w,a6
	move.l	#30*1024,d0
	move.l	#$10002,d1
	jsr	-198(a6)
	move.l	d0,scrollmem
	
	lea	glib,a1
	moveq	#0,d0
	move.l	4.w,a6
	jsr	-$228(a6)
	tst	d0
	beq	error
	move.l	d0,graphics

	lea	dlib,a1
	moveq	#0,d0
	move.l	4.w,a6
	jsr	-$228(a6)
	tst	d0
	beq	error
	move.l	D0,dos

	lea	scrolltext3,a0
	move.l	a0,textptr
	move.l	a0,scrolltext
	
	move.l	Screen,d0	; store address of bitplane0
	move.w	d0,bitplane0_lo	; into the copper list
	swap	d0
	move.w	d0,bitplane0_hi
	swap	d0
	add.l	#bplen,d0
	
	move.w	d0,bitplane1_lo
	swap	d0
	move.w	d0,bitplane1_hi
	swap	d0
	add.l	#bplen,d0
	
	move.w	d0,bitplane2_lo
	swap	d0
	move.w	d0,bitplane2_hi
	swap	d0
	add.l	#bplen,d0
	
	move.w	d0,bitplane3_lo
	swap	d0
	move.w	d0,bitplane3_hi
		
	jsr	mt_init
	jsr	load_text
	jsr	do_logo

	move.l	graphics,a6
	add.l	#$32,a6
	move.w	#$80,$dff096		; dma control write
	move.l	(a6),old_copper		; store the address of the
	lea	my_copper,a0
	move.l	a0,(a6)			; old copperlist
	move.w	#$8080,$dff096		; dma control write
	move.w	#$8010,$dff09a		; interupt enable bits
	move.l	$6c.w,old_interupt	; store old level 3 int
	lea	new_interupt,a0
	move.l	a0,$6c.w		; store my routine
					; into level 3 int
	bsr	waitmouse
	bsr	mt_end
	
	move.l	old_interupt,$6c.w	; resore old level 3 int
	move.l	#$10,$dff09a 		; Disable Level 3 Interupt
	move.l	graphics,a6
	add.l	#$32,a6
	move.w	#$0080,$dff096
	move.l	old_copper,(a6)		; restore old copper list
	move.w	#$8080,$dff096
	move.l	graphics,a1
	move.l	4.w,a6
	jsr	-$19e(a6)
	move.l	4.w,a6
	jsr	-138(a6)
	
	move.l	4.w,a6
	move.l	screen,a1
	move.l	#scrsize,d0
	jsr	-210(a6)
	
	move.l	4.w,a6
	move.l	scrollmem,a1
	move.l	#30*1024,d0
	jsr	-210(a6)
Error:	moveq	#0,d0			; fin
	rts

waitmouse:

	btst	#6,$bfe001
	bne.s	waitmouse

	rts

load_text:

	rts
	
do_logo:

	lea	merlin,a1
	add.l	#32,a1
	move.l	screen,a0
	move.w	#(61*64)+20,a2
	move.w	#0,a3
	jsr	all_blit
	
	add.l	#61*40,a1
	add.l	#bplen,a0
	jsr	all_blit
	
	add.l	#61*40,a1
	add.l	#bplen,a0
	jsr	all_blit
	
	add.l	#61*40,a1
	add.l	#bplen,a0
	jsr	all_blit

	lea	kenpal,a0
	add.l	#2,a0
	lea	merlin,a1
	move.w	#15,d0
	
kenloop1:
	move.w	(a1)+,(a0)+
	add.l	#2,a0
	dbf	d0,kenloop1
	
	rts	
	
	
	
new_interupt:
	movem.l	d0-d7/a0-a6,-(sp)	; my scroll text

	and.w	#$10,$dff01e		; check for copper interupt
	beq 	no_music
	move.w	#$10,$dff09c


	move.l	usepal,d0
	mulu	#28,d0
	move.l	d0,a0
	add.l	#otherpals,a0
	move.w	#6,d0
	lea	palette,a1
	
palloop:

	move.l	(a0)+,(a1)+
	sub.w	#1,d0
	bpl.s	palloop
	
	bsr	do_scrolly
	
	bsr 	mt_music
	
	clr.l	d0
	move.l	bounce_point,a0
	move.b	(a0),d0
	mulu	#wide,d0
	move.l	Screen,d1
	add.l	#bodown+14,d1
	add.l	d1,d0
	
	add.l	#1,bounce_point
	move.l	bounce_point,a0
	cmp.l	#bounce_end,a0
	blt.s	not_bounce_end
	
	lea	bounce_list,a6
	move.l	a6,bounce_point
	
not_bounce_end:
	
	move.w	d0,bitplane4_lo	; into the copper list
	swap	d0
	move.w	d0,bitplane4_hi
	swap	d0
	add.l	#bplen,d0
	
	move.w	d0,bitplane5_lo
	swap	d0
	move.w	d0,bitplane5_hi
	swap	d0
	add.l	#bplen,d0

	move.w	d0,bitplane6_lo
	swap	d0
	move.w	d0,bitplane6_hi

	sub.l	#1,delay
	bpl	noequ4
	
	move.l	#0,delay

	move.w	equ1a,d0
	cmp.w	#0,d0
	beq.s	noequ1a
	sub.w	#equmajor,equ1a
	sub.w	#equmajor,equ1c
noequ1a:move.w	equ1b,d0
	cmp.w	#0,d0
	beq.s	noequ1
	sub.w	#equminor,equ1b
noequ1:

	move.w	equ2a,d0
	cmp.w	#0,d0
	beq.s	noequ2a
	sub.w	#equmajor,equ2a
	sub.w	#equmajor,equ2c
noequ2a:move.w	equ2b,d0
	cmp.w	#0,d0
	beq.s	noequ2
	sub.w	#equminor,equ2b
noequ2:
	move.w	equ3a,d0
	cmp.w	#0,d0
	beq.s	noequ3a
	sub.w	#equmajor,equ3a
	sub.w	#equmajor,equ3c
noequ3a:move.w	equ3b,d0
	cmp.w	#0,d0
	beq.s	noequ3
	sub.w	#equminor,equ3b
noequ3:
	move.w	equ4a,d0
	cmp.w	#0,d0
	beq.s	noequ4a
	sub.w	#equmajor,equ4a
	sub.w	#equmajor,equ4c
noequ4a:move.w	equ4b,d0
	cmp.w	#0,d0
	beq.s	noequ4
	sub.w	#equminor,equ4b
noequ4:



no_music:
	movem.l	(sp)+,d0-d7/a0-a6	
	dc.w	$4ef9			; jmp
old_interupt:	dc.l	0		; the old int lev 3


all_blit:

	move.l	a0,$dff054			; dest mem d
	Move.l	a1,$dff050			; source mem a
	move.w	#0,$dff064			; source a modulo 
	Move.w	#$ffff,$dff044			; blit 1st word mask source a
	Move.w	#$ffff,$dff046			; blit 1st word mask source a
	move.w	#%1001*256+$f0,$dff040		; blit cont reg 0
	move.w	#0,$dff042			; blit cont reg 1
	Move.w	a3,$dff066			; modulo for dest
	Move.w	a2,$dff058			; blit height,width
	bsr	doblit
	rts


do_scrolly:

	move.l	scrollspeed,d0
	sub.w	d0,scrollpos
	bmi.s	doit_scrolly
	move.w	scrollpos,d0
	and.w	#15,d0
	mulu	#16,d0
	or.w	scrollpos,d0
	move.w	d0,scroll_big
	
	rts
	
doit_scrolly:
	add.w	#16,scrollpos
	move.w	scrollpos,d0
	and.w	#15,d0
	mulu	#16,d0
	or.w	scrollpos,d0
	move.w	d0,scroll_big

	move.l	screen,a0
	add.l	#an-42,a0
	Move.l	screen,a1
	add.l	#an-40,a1
	move.w	#(140*64)+22,a2
	move.w	#0,a3
	bsr	all_blit
 
	add.l	#(wide*down),a0
	add.l	#(wide*down),a1
	bsr	all_blit
	
	add.l	#(wide*down),a0
	add.l	#(wide*down),a1
	bsr	all_blit
	
	move.l	scrmask,d0
	move.l	minmask,d1
	cmp.b	d0,d1
	ble	more_balls_2

next_char:
	
	clr.l	d0

	move.l	textptr,a0
	move.b	(a0),d0
	
	add.l	#1,textptr
	cmp.b	#0,d0
	bne.s	scroll_text_ok
	
	move.l	scrolltext,a6
	move.l	a6,textptr
	move.w	#32,d0
	
scroll_text_ok:
	cmp.b	#32,d0
	bge.s	ascii_normal
	bra.s	next_char

ascii_normal:
	

	cmp.b	#"|",d0
	bne.s	not_ctrl

	clr.l	d0
	clr.l	d3
	
	move.l	textptr,a0
	move.b	(a0)+,d3
	
	sub.l	#48,d3
	mulu	#10,d3
	
	move.b	(a0)+,d0
	sub.l	#48,d0
	add.l	d0,d3
	
	cmp.l	#80,d3
	blt.s	changebob
	
	sub.l	#80,d3
	move.l	d3,usepal
	move.l	scrollspeed,d3
	
changebob:
	cmp.l	#60,d3
	blt.s	speedchange
	
	sub.l	#60,d3
	move.l	d3,ballnum
	move.l	scrollspeed,d3
	
speedchange:
	move.l	d3,scrollspeed
	move.b	(a0)+,d0
	move.l	a0,textptr
	bra.s	scroll_text_ok
not_ctrl:

	sub.b	#32,d0
	move.l	d0,a6
	mulu	#8,d0
	
	lea	chrtable,a1
	move.w	d0,a2
	add.l	a2,a1
	
	move.l	screen,a0
	add.l	#an,a0
	move.l	a1,cbadd

	move.l	a0,mem1

	lea	spctable,a1
	add.l	a1,a6
	
	move.b	(a6),d6
	move.l	#7,d5
	sub.l	d6,d5
	move.l	#7,scrmask
	move.l	d5,minmask

more_balls_2:

	move.l	screen,a4
	add.l	#an,a4
	move.l	a4,$dff054			; dest mem d
	move.w	#0,$dff064			; source a modulo 
	Move.w	#0,$dff044			; blit 1st word mask source a
	move.w	#0,$dff046			; blit last word mask source a
	move.w	#(%0001)*256,$dff040		; blit cont reg 0
	move.w	#%0000000000000100,$dff042	; blit cont reg 1
	Move.w	#wide-2,$dff066			; modulo for dest
	Move.w	#(128*64)+1,$dff058		; blit height,width
	bsr	doblit

	add.l	#wide*down,a4
	move.l	a4,$dff054			; dest mem d
	move.w	#0,$dff064			; source a modulo 
	Move.w	#0,$dff044			; blit 1st word mask source a
	move.w	#0,$dff046			; blit last word mask source a
	move.w	#(%0001)*256,$dff040		; blit cont reg 0
	move.w	#%0000000000000100,$dff042	; blit cont reg 1
	Move.w	#wide-2,$dff066			; modulo for dest
	Move.w	#(128*64)+1,$dff058		; blit height,width
	bsr	doblit

	add.l	#wide*down,a4
	move.l	a4,$dff054			; dest mem d
	move.w	#0,$dff064			; source a modulo 
	Move.w	#0,$dff044			; blit 1st word mask source a
	move.w	#0,$dff046			; blit last word mask source a
	move.w	#(%0001)*256,$dff040		; blit cont reg 0
	move.w	#%0000000000000100,$dff042	; blit cont reg 1
	Move.w	#wide-2,$dff066			; modulo for dest
	Move.w	#(128*64)+1,$dff058		; blit height,width
	bsr	doblit

	add.l	#wide*down,a4
	move.l	a4,$dff054			; dest mem d
	move.w	#0,$dff064			; source a modulo 
	Move.w	#0,$dff044			; blit 1st word mask source a
	move.w	#0,$dff046			; blit last word mask source a
	move.w	#(%0001)*256,$dff040		; blit cont reg 0
	move.w	#%0000000000000100,$dff042	; blit cont reg 1
	Move.w	#wide-2,$dff066			; modulo for dest
	Move.w	#(128*64)+1,$dff058		; blit height,width
	bsr	doblit

	move.l	scrmask,d6
	cmp.l	#0,d6
	bge.s	ok_test
	
	sub.l	#1,scrmask
	
	rts
	
ok_test:

	move.l	mem1,a0
	
	move.w	#7,d2
	move.l	scrmask,d4

more_balls_1:
	
	move.l	cbadd,a1
	move.b	(a1),d0

	btst	d4,d0
	beq.s	no_ball_here

	bsr	blit_ball
	
no_ball_here:	

	add.l	#1,cbadd
	move.l	scrheight,d6
	add.l	d6,a0
		
	sub.w	#1,d2
	bpl.s	more_balls_1	
	
	move.l	scrheight,d6
	mulu	#8,d6
	move.l	d6,a6
	sub.l	a6,a0

	sub.l	#1,scrmask
	sub.l	#8,cbadd

	move.l	a0,mem1
	
	rts
	
	
	
	
	


blit_ball:
	movem.l	d0-d7/a0-a6,-(sp)
	
	lea	ball,a1
	move.l	ballnum,d0
	mulu	#96,d0
	add.l	d0,a1

	move.l	a0,$dff054				; dest mem d
	Move.l	a1,$dff050				; source mem a
	move.w	#0,$dff064				; source a modulo 
	Move.w	#$ffff,$dff044				; blit 1st word mask source a
	Move.w	#$ffff,$dff046				; blit 1st word mask source a
	move.w	#%1001*256+$f0,$dff040				; blit cont reg 0
	move.w	#0,$dff042				; blit cont reg 1
	Move.w	#wide-2,$dff066				; modulo for dest
	Move.w	#(16*64)+1,$dff058			; blit height,width

	bsr	doblit

	add.l	#(wide*down),a0
	add.l	#32,a1
	
	move.l	a0,$dff054				; dest mem d
	move.w	#0,$dff064				; source a modulo 
	move.w	#0,$dff042				; blit cont reg 1
	Move.w	#wide-2,$dff066				; modulo for dest
	Move.w	#(16*64)+1,$dff058			; blit height,width

	bsr	doblit

	add.l	#(wide*down),a0
	add.l	#32,a1
	
	move.l	a0,$dff054				; dest mem d
	move.w	#0,$dff064				; source a modulo 
	move.w	#0,$dff042				; blit cont reg 1
	Move.w	#wide-2,$dff066				; modulo for dest
	Move.w	#(16*64)+1,$dff058			; blit height,width

	bsr	doblit

	movem.l	(sp)+,d0-d7/a0-a6	
	rts


doblit:
	Btst.b	#6,$dff002		; wait for the blit
wait_blit:
 	Btst.b	#6,$dff002		; wait for the blit
	Bne.s	wait_blit		; to finish
	
	rts
	

; call 'mt_init' to initialize the playroutine
mt_init:lea	mt_data,a0
	add.l	#$03b8,a0
	moveq	#$7f,d0
	moveq	#0,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	#8,d2
	asl.l	#2,d2
	add.l	#$438,d2
	add.l	a0,d2
	moveq	#$1e,d0
mt_init4:
	move.l	d2,(a1)+
	moveq	#0,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	#0,d0
mt_clear:
	move.l	(a0,d0.w),a1
	clr.l	(a1)
	addq.w	#4,d0
	cmp.w	#$7c,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+$3b6,mt_maxpart+1
	rts

; call 'mt_end' to switch the sound off

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

; the playroutine - call this every frame

mt_music:
	addq.w	#1,mt_counter
mt_cool:cmp.w	#6,mt_counter
	bne.s	mt_notsix
	clr.w	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	mt_arpegrt
	cmp.b	#$01,d0
	beq.s	mt_portup
	cmp.b	#$02,d0
	beq.s	mt_portdwn
	cmp.b	#$0a,d0
	beq.s	mt_volslide
	rts

mt_portup:
	moveq	#0,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	#0,d0
	move.b	3(a6),d0
	add.w	d0,22(a6)
	cmp.w	#$538,22(a6)
	bmi.s	mt_ok2
	move.w	#$538,22(a6)
mt_ok2:	move.w	22(a6),6(a5)
	rts

mt_volslide:
	moveq	#0,d0
	move.b	3(a6),d0
	lsr.b	#4,d0
	tst.b	d0
	beq.s	mt_voldwn
	add.w	d0,18(a6)
	cmp.w	#64,18(a6)
	bmi.s	mt_ok3
	move.w	#64,18(a6)
mt_ok3:	move.w	18(a6),8(a5)
	rts
mt_voldwn:
	moveq	#0,d0
	move.b	3(a6),d0
	and.b	#$0f,d0
	sub.w	d0,18(a6)
	bpl.s	mt_ok4
	clr.w	18(a6)
mt_ok4:	move.w	18(a6),8(a5)
	rts

mt_arpegrt:
	move.w	mt_counter(PC),d0
	cmp.w	#1,d0
	beq.s	mt_loop2
	cmp.w	#2,d0
	beq.s	mt_loop3
	cmp.w	#3,d0
	beq.s	mt_loop4
	cmp.w	#4,d0
	beq.s	mt_loop2
	cmp.w	#5,d0
	beq.s	mt_loop3
	rts

mt_loop2:
	moveq	#0,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:
	add.w	d0,d0
	moveq	#0,d1
	move.w	16(a6),d1
	and.w	#$fff,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	#$3b8,a2
	add.l	#$43c,a0
	move.l	mt_partnrplay(PC),d0
	moveq	#0,d1
	move.b	(a2,d0),d1
	asl.l	#8,d1
	asl.l	#2,d1
	add.l	mt_partnote(PC),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(PC),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	#0,d0
	move.w	mt_maxpart(PC),d0
	move.l	mt_partnrplay(PC),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.l),(a6)
	addq.l	#4,d1
	moveq	#0,d2
	move.b	2(a6),d2
	and.b	#$f0,d2
	lsr.b	#4,d2

	move.b	(a6),d0
	and.b	#$f0,d0
	or.b	d0,d2
	tst.b	d2
	beq.s	mt_nosamplechange

	moveq	#0,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.l),8(a6)
	move.w	2(a3,d4.l),18(a6)
	move.w	4(a3,d4.l),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.l),8(a6)
	move.w	6(a3,d4.l),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.l),14(a6)
	move.w	18(a6),8(a5)
mt_nosamplechange:
	move.w	(a6),d0
	and.w	#$fff,d0
	tst.w	d0
	beq	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),d0
	and.w	#$fff,d0
	move.w	d0,6(a5)
	move.w	20(a6),d0
	or.w	d0,mt_dmacon

	cmpa.l	#$dff0a0,a5
	bne.s	not_equ1
	move.w	#$f00,equ1a
	move.w	#$fff,equ1b
	move.w	#$f00,equ1c
not_equ1:
	cmpa.l	#$dff0b0,a5
	bne.s	not_equ2
	move.w	#$f00,equ2a
	move.w	#$fff,equ2b
	move.w	#$f00,equ2c
not_equ2:
	cmpa.l	#$dff0c0,a5
	bne.s	not_equ3
	move.w	#$f00,equ3a
	move.w	#$fff,equ3b
	move.w	#$f00,equ3c
not_equ3:
	cmpa.l	#$dff0a0,a5
	bne.s	not_equ4
	move.w	#$f00,equ4a
	move.w	#$fff,equ4b
	move.w	#$f00,equ4c
not_equ4:





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	#$0b,d0
	beq.s	mt_posjmp
	cmp.b	#$0c,d0
	beq.s	mt_setvol
	cmp.b	#$0d,d0
	beq.s	mt_break
	cmp.b	#$0e,d0
	beq.s	mt_setfil
	cmp.b	#$0f,d0
	beq.s	mt_setspeed
	rts

mt_posjmp:
	not.w	mt_status
	moveq	#0,d0
	move.b	3(a6),d0
	subq.b	#1,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	#0,d0
	move.b	3(a6),d0
	and.b	#1,d0
	rol.b	#1,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.w	mt_counter
	move.b	d0,mt_cool+3
mt_back:rts
	
mt_aud1temp:
	Dcb.w	10,0
	dc.w	1
	Dcb.w	2,0
mt_aud2temp:
	Dcb.w	10,0
	dc.w	2
	Dcb.w	2,0
mt_aud3temp:
	Dcb.w	10,0
	dc.w	4
	Dcb.w	2,0
mt_aud4temp:
	Dcb.w	10,0
	dc.w	8
	Dcb.w	2,0

mt_partnote:	dc.l	0
mt_partnrplay:	dc.l	0
mt_counter:	dc.w	0
mt_partpoint:	dc.l	0
mt_samples:	dc.l	0
mt_sample1:	Dcb.l	31,0
mt_maxpart:	dc.w	0
mt_dmacon:	dc.w	0
mt_status:	dc.w	0

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

	
	Section	copdat,Data_C




bounce_list:
		dc.b	15
		dc.b	16
		dc.b	17
		dc.b	18
		dc.b	19
		dc.b	20
		dc.b	21
		dc.b	22
		dc.b	22
		dc.b	23
		dc.b	24
		dc.b	25
		dc.b	26
		dc.b	26
		dc.b	27
		dc.b	27
		dc.b	28
		dc.b	28
		dc.b	29
		dc.b	29
		dc.b	29
		dc.b	29
		dc.b	29
		dc.b	29
		dc.b	29
		dc.b	29
		dc.b	29
		dc.b	29
		dc.b	28
		dc.b	28
		dc.b	27
		dc.b	27
		dc.b	26
		dc.b	26
		dc.b	25
		dc.b	24
		dc.b	23
		dc.b	22
		dc.b	22
		dc.b	21
		dc.b	20
		dc.b	19
		dc.b	18
		dc.b	17
		dc.b	16
		dc.b	15
		dc.b	13
		dc.b	12
		dc.b	11
		dc.b	10
		dc.b	9
		dc.b	8
		dc.b	7
		dc.b	7
		dc.b	6
		dc.b	5
		dc.b	4
		dc.b	3
		dc.b	3
		dc.b	2
		dc.b	2
		dc.b	1
		dc.b	1
		dc.b	0
		dc.b	0
		dc.b	0
		dc.b	0
		dc.b	0
		dc.b	0
		dc.b	0
		dc.b	0
		dc.b	0
		dc.b	0
		dc.b	1
		dc.b	1
		dc.b	2
		dc.b	2
		dc.b	3
		dc.b	3
		dc.b	4
		dc.b	5
		dc.b	6
		dc.b	7
		dc.b	7
		dc.b	8
		dc.b	9
		dc.b	10
		dc.b	11
		dc.b	12
		dc.b	13
		dc.b	14
bounce_end:
		even

old_copper:	dc.l	0
graphics:	dc.l	0
dos:		dc.l	0
usepal:		dc.l	0

otherpals:
		dc.w	$182,$08f
		dc.w	$184,$05c
		dc.w	$186,$04b
		dc.w	$188,$029
		dc.w	$18a,$017
		dc.w	$18c,$006
		dc.w	$18e,$004

		dc.w	$182,$f8f
		dc.w	$184,$c5c
		dc.w	$186,$b4b
		dc.w	$188,$929
		dc.w	$18a,$717
		dc.w	$18c,$606
		dc.w	$18e,$404

		dc.w	$182,$f80
		dc.w	$184,$c50
		dc.w	$186,$b40
		dc.w	$188,$920
		dc.w	$18a,$710
		dc.w	$18c,$600
		dc.w	$18e,$400

		dc.w	$182,$8f0
		dc.w	$184,$5c0
		dc.w	$186,$4b0
		dc.w	$188,$290
		dc.w	$18a,$170
		dc.w	$18c,$060
		dc.w	$18e,$040

		dc.w	$182,$8ff
		dc.w	$184,$5cc
		dc.w	$186,$4bb
		dc.w	$188,$299
		dc.w	$18a,$177
		dc.w	$18c,$066
		dc.w	$18e,$044

		dc.w	$182,$fff
		dc.w	$184,$ccc
		dc.w	$186,$bbb
		dc.w	$188,$999
		dc.w	$18a,$777
		dc.w	$18c,$666
		dc.w	$18e,$444

		dc.w	$182,$f00
		dc.w	$184,$c00
		dc.w	$186,$b00
		dc.w	$188,$900
		dc.w	$18a,$700
		dc.w	$18c,$600
		dc.w	$18e,$400

		dc.w	$182,$0f0
		dc.w	$184,$0c0
		dc.w	$186,$0b0
		dc.w	$188,$090
		dc.w	$18a,$070
		dc.w	$18c,$060
		dc.w	$18e,$040

		dc.w	$182,$00f
		dc.w	$184,$00c
		dc.w	$186,$00b
		dc.w	$188,$009
		dc.w	$18a,$007
		dc.w	$18c,$006
		dc.w	$18e,$004

		dc.w	$182,$ff0
		dc.w	$184,$cc0
		dc.w	$186,$bb0
		dc.w	$188,$990
		dc.w	$18a,$770
		dc.w	$18c,$660
		dc.w	$18e,$440

		dc.w	$182,$0ff
		dc.w	$184,$0cc
		dc.w	$186,$0bb
		dc.w	$188,$099
		dc.w	$18a,$077
		dc.w	$18c,$066
		dc.w	$18e,$044

		dc.w	$182,$f0f
		dc.w	$184,$c0c
		dc.w	$186,$b0b
		dc.w	$188,$909
		dc.w	$18a,$707
		dc.w	$18c,$606
		dc.w	$18e,$404

my_copper:	
		dc.w	$100,-1,$0101,$ff00		; action replay
		dc.w	$100,$4200	; 4 bp - lo res
		dc.w	$104,$a		; bp control reg
		dc.w	$108,0		; bp modulo - odd
		dc.w	$10a,0		; bp modulo - even
		dc.w	$180,0		; colour 0 to black
		dc.w	$102,0
		
		dc.w	$08e,$2c81	; bp window start left
		dc.w	$090,$2fc1	; bp window bot right
		dc.w	$094,$d0	; bp stop horz
		dc.w	$92,$38
		dc.w	$120,0,$122,0
		
kenpal:		dc.w	$180,$fff
		dc.w	$182,$fff
		dc.w	$184,$fff
		dc.w	$186,$fff
		dc.w	$188,$fff
		dc.w	$18a,$fff
		dc.w	$18c,$fff
		dc.w	$18e,$fff
		dc.w	$190,$fff
		dc.w	$192,$fff
		dc.w	$194,$fff
		dc.w	$196,$fff
		dc.w	$198,$fff
		dc.w	$19a,$fff
		dc.w	$19c,$fff
		dc.w	$19e,$fff

		dc.w	$0e0		; bp 1 address hi-byte
bitplane0_hi:	dc.w	0
		dc.w	$e2		; bp 1 address
bitplane0_lo:	dc.w	0,$e4

bitplane1_hi:	dc.w	0
		dc.w	$e6		; bp 2 address
bitplane1_lo:	dc.w	0,$e8

bitplane2_hi:	dc.w	0
		dc.w	$ea		; bp 3 address
bitplane2_lo:	dc.w	0,$ec

bitplane3_hi:	dc.w	0
		dc.w	$ee		; bp 4 address
bitplane3_lo:	dc.w	0


		dc.b	equdown+0,1
		dc.w	$ff00
		dc.w	$180
equ1a:		dc.w	$000
		dc.b	equdown+1,1
		dc.w	$ff00
		dc.w	$180
equ1b:		dc.w	$000
		dc.b	equdown+2,1
		dc.w	$ff00
		dc.w	$180
equ1c:		dc.w	$000
		dc.b	equdown+3,1
		dc.w	$ff00,$180,$000

		dc.b	equdown+4,1
		dc.w	$ff00
		dc.w	$180
equ2a:		dc.w	$000
		dc.b	equdown+5,1
		dc.w	$ff00
		dc.w	$180
equ2b:		dc.w	$000
		dc.b	equdown+6,1
		dc.w	$ff00
		dc.w	$180
equ2c:		dc.w	$000
		dc.b	equdown+7,1
		dc.w	$ff00,$180,$000

		dc.b	equdown+8,1
		dc.w	$ff00
		dc.w	$180
equ3a:		dc.w	$000
		dc.b	equdown+9,1
		dc.w	$ff00
		dc.w	$180
equ3b:		dc.w	$000
		dc.b	equdown+10,1
		dc.w	$ff00
		dc.w	$180
equ3c:		dc.w	$000
		dc.b	equdown+11,1
		dc.w	$ff00,$180,$000

		dc.b	equdown+12,1
		dc.w	$ff00
		dc.w	$180
equ4a:		dc.w	$000
		dc.b	equdown+13,1
		dc.w	$ff00
		dc.w	$180
equ4b:		dc.w	$000
		dc.b	equdown+14,1
		dc.w	$ff00
		dc.w	$180
equ4c:		dc.w	$000
		dc.b	equdown+15,1
		dc.w	$ff00,$180,$000

		dc.w	$100,$3200	; 3 bp - lo res

		dc.b	equdown+16,1
		dc.w	$ff00,$108,0,$10a,0,$102,0
		
		dc.w	$0e0		; bp 1 address hi-byte
bitplane4_hi:	dc.w	0
		dc.w	$e2		; bp 1 address
bitplane4_lo:	dc.w	0,$e4

bitplane5_hi:	dc.w	0
		dc.w	$e6		; bp 2 address
bitplane5_lo:	dc.w	0,$e8

bitplane6_hi:	dc.w	0
		dc.w	$ea		; bp 3 address
bitplane6_lo:	dc.w	0

		dc.w	$08e,$2c70	; bp window start left
		dc.w	$090,$2cc6	; bp window bot right
		dc.w	$092,$28	; bs start horz
		dc.w	$094,$e0	; bp stop horz

		dc.w	$102
scroll_big:	dc.w	0
		
palette:	dc.w	$182,$08f
		dc.w	$184,$05c
		dc.w	$186,$04b
		dc.w	$188,$029
		dc.w	$18a,$017
		dc.w	$18c,$006
		dc.w	$18e,$004
		
		dc.w	$ffe1,$fffe	; end of ntsc screen
		dc.b	refdown+0,01
		dc.w	$ff00,$180,$003
		dc.b	refdown+1,01
		dc.w	$ff00,$180,$004
		dc.b	refdown+2,01
		dc.w	$ff00,$180,$005
		dc.b	refdown+3,01
		dc.w	$ff00,$180,$006
		dc.b	refdown2,01
		dc.w	$ff00,$108,-wide*4,$10a,-wide*4
		
		dc.w	$3001,$ff00	; end of pal screen

		dc.w	$100,0		; action replay
		dc.w	$9c,$8010	; irq set bits - ?
		dc.w	$ffff,$fffe	; end of copper list
	
glib:		dc.b	"graphics.library",0
	even
dlib:		dc.b	"dos.library",0
	even
	
file:		dc.l	0

equdown		equ	$70
equmajor	equ	$100
equminor	equ	$111

down		equ	280
wide		equ	46
an		equ	128*44+10
bodown		equ	(90*wide)-28
refdown		equ	4
refdown2	equ	12

scrmask:	dc.l	-1
minmask:	dc.l	-1

cbadd:		dc.l	0
mem1:		dc.l	0
delay:		dc.l	0

scrollspeed:	dc.l	10
scrollpos	dc.w	15
scrheight:	dc.l	wide*16

bounce_point:	dc.l	bounce_list

textptr:	dc.l	scrolltext3

scrsize		equ	wide*down*4
screen		dc.l	0
bplen		equ	scrsize/4

chrtable:	incbin	"chrset.bin"
spctable:	incbin	"chrset.spc"

ballnum:	dc.l	0
	
scrollmem:	dc.l	0

merlin:		incbin	"trainlogo.bin"

ball:		incbin	"bob0.pic"
		incbin	"bob2.pic"
		incbin	"bob3.pic"
		incbin	"bob4.pic"
		incbin	"bob5.pic"
		incbin	"bob6.pic"
		incbin	"bob7.pic"
		incbin	"bob14.pic"
		incbin	"bob15.pic"
		incbin	"bob8.pic"
		incbin	"bob9.pic"
		incbin	"bob10.pic"
		incbin	"bob11.pic"
		incbin	"bob12.pic"
		incbin	"bob13.pic"
		incbin	"bob1.pic"

mt_data:	
		;incbin	"dh0:modules/mod.something_else"	; music - use this line
		dc.l	0,0,0,0,0,0	; no music - use this line


scrolltext:	dc.l	scrolltext3
		
scrolltext3:

	dc.b	"|04|60|80LSD PRESENT |6181COMBO RACER ONE DISK VERSION...  |6282CRACKED BY THE ANGELS...  |6383SORRY, ITS 1 MEG...   |8475INTRO WRITTEN BY SHAGRATT...    "
	dc.b	"|6485COMPACTED WITH |6586SHAGGYPAK BY |6687SHAGRATT..."
	dc.b	"|6088GREETINGS GO BOUNCING TO: |6789LIGHTFOOT & THE MIGHTY DRUIDS - |6890INDEX & RELAY - "
	dc.b	"|6991TRIPWIRE & THE POWERLORDS - |7080ELF & QUARTEX - |7181POD & INNER CITY - |7282COUNT ZERO & PROPHECY - "
	dc.b	"|7483COZY & MAGNETIC FIELDS - |7584MONTY PYTHON & AUTOMATION ST - |6085MOLE & ANARCHY - |6186 GARY!!!!!!"
	dc.b	"|6287AND ALL AMIGA FREAKS EVERYWHERE... |6388CONTACT US FOR THE LATEST WARES... " 
	dc.b	"|6089LSD ARE... |6490SHAGRATT, |6591PARASITE, |6690DIGGER, |6789PAW, |6888REBEL, |6987MAXIMAN, |7086MUB, |7185OSSWALD, |7284MARL |6083AND NO-ONE ELSE!    "	
	dc.b	"|7382LOOK OUT FOR MORE SHAGGYPAKS COMING SOON TO AN AMIGA NEAR YOU!...  "
	dc.b	"|7481MESSAGE FROM PARASITE:  |7580I WISH TO GET IN TOUCH WITH AS MANY GROUPS "
	dc.b	"AS POSSIBLE, IF I'M NOT SWAPPING, OR NOT IN TOUCH WITH YOU, CONTACT"
	dc.b	" ME |7085NOW!       "
	dc.b	"|6487BEWARE OF BUZBY FROM BARNSLEY... "
	dc.b	""
	dc.b	"|7289   ...OH NO, SCROLLTEXT LOOP...   ",0
	

	DC.B	0
	even
	
	; use |xx to change speed (max speed) 01-15
	
	
	; use |xx to change shape (60-75)
	
	; 60 - ball
	; 61 - squares left to right diagonal stripe
	; 62 - squares right to left diagonal stripe
	; 63 - squares (pyramids from above!)
	; 64 - squares with crosses
	; 65 - triangles face up
	; 66 - triangles face right
	; 67 - diamonds facing left
	; 68 - diamonds facing right
	; 69 - triangles face left
	; 70 - triangles facing down
	; 71 - squares with lines horozontal
	; 72 - squares with lines vertical
	; 73 - lsd logo
	; 74 - acid smiley
	; 75 - pill  
	
	
	; use |xx to change colour (80-91)
	
	; to clear screen use 5 spaces!
	
	; 80 - blue (highlight)
	; 81 - purple (highlight)
	; 82 - orange (highlight)
	; 83 - green (highlight)
	; 84 - cyan (highlight)
	; 85 - white
	; 86 - red
	; 87 - green
	; 88 - blue
	; 89 - yellow
	; 90 - cyan
	; 91 - purple
	
	End
