*****************************************************************************
*                                                                           *
* 		        Second Part For Demo ( Introduction )               *
*                                                                           *
*  Start Date : 2/3/91                                                      *
* Last Update : 2/3/91                                                      *
*   							   Code : Melt Down *
*                                                                           *
*****************************************************************************

; Include the macros

	Incdir	Df1:
	Include	Source/Macro

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

; Dont forget to use chip ram

	Chip
	
*****************************************************************************

; Kill the operating system for good mesure

	Kill		
	
*****************************************************************************

; Load custom and set up copper list

	Lea	Custom,A5
	Move.l	#Copper,Cop1lch(a5)
	
*****************************************************************************

; Clear Some Shit

	Blitwait
	Move.l	#$70000,Bltdpth(a5)
	Move.l	#-1,Bltafwm(a5)
	Move.w	#0,Bltdmod(a5)
	Move.l	#$01000000,Bltcon0(a5)
	Move.w	#256*64+60,Bltsize(a5)

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

	Blitwait

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

	Bsr	PrintTitle
	
*****************************************************************************

; Main routine here

Mouse
	Pos					; Get in sync with vbi
	Bsr	Scroller
	Tst.l	OutFlag
	Bne.s	Quit
	Tstmice	Mouse				; Pressed the mouse
	
*****************************************************************************

; Return operating system and go back to user

Quit
	Heal
	Clr.l	D0				; No error
	Rts
	
*****************************************************************************

Scroller
	Tst.l	Scrolled
	Bne.s	Scrollon
	Move.l	#8,Scrolled
	Moveq	#0,D0
	Move.l	ScrollPtr,a0
	Move.b	(a0)+,d0
	Cmp.b	#-1,D0
	Bne.s	NoEnd
	Move.l	#Scroll,A0
	Move.b	(a0)+,d0
	Move.l	#-1,OutFlag
NoEnd
	Move.l	a0,ScrollPtr
	Sub.b	#32,d0				
	Divu	#20,d0				
	Move.w	d0,d1				
	Mulu	#40*16,d1			
	Swap	d0				
	Add.w	d0,d0				
	Add.w	d0,d1				
	Lea	Font,A2
	Add.w	D1,A2
	Move.l	A2,Bltapth(A5)
	Move.l	#$70000+(62*42)-18,Bltdpth(A5)
	Move.w	#38,Bltamod(A5)
	Move.w	#40,Bltdmod(A5)
	Move.l	#-1,Bltafwm(A5)
	Move.l	#$09f00000,Bltcon0(a5)
	Move.w	#16*64+1,Bltsize(A5)
Scrollon	

	Move.l	#$70002+(62*42)-18,Bltapth(A5)
	Move.l	#$70000+(62*42)-18,Bltdpth(A5)
	Move.w	#0,Bltamod(A5)
	Move.w	#0,Bltdmod(A5)
	Move.l	#-1,Bltafwm(A5)
	Move.l	#$E9f00000,Bltcon0(a5)
	Move.w	#16*64+21,Bltsize(A5)
	Sub.l	#1,Scrolled
	Rts
Scrolled
	Dc.l	0
			
*****************************************************************************

PrintTitle
	Move.l	#$09f00000,Bltcon0(a5)
	Move.w	#38,Bltamod(A5)
	Move.w	#38,Bltdmod(A5)
	Move.l	#-1,Bltafwm(a5)
	Move.l	#20-1,d7				; Amount Of Chars
	Lea	$70000+(3*40),A0			; Dest
	Lea	Title,A1				; Text
	Move.w	#16*64+1,D6
Loop
	Moveq	#0,D0
	Moveq	#0,D1
	Move.b	(a1)+,d0
	Sub.b	#32,d0				
	Divu	#20,d0				
	Move.w	d0,d1				
	Mulu	#40*16,d1			
	Swap	d0				
	Add.w	d0,d0				
	Add.w	d0,d1				
	Lea	Font,A2
	Add.w	D1,A2
	Move.l	A2,Bltapth(A5)
	Move.l	A0,Bltdpth(A5)
	Move.w	D6,Bltsize(a5)
	Add.w	#2,A0
	Dbf	D7,Loop
	Rts
	
*****************************************************************************

; All copper list after here

Copper

	Spr_Off					; Switch sprites off
	Cmove	$2871,Diwstrt
	Cmove	$2cc1,Diwstop
	Cmove	$0038,Ddfstrt
	Cmove	$00d0,Ddfstop
	Cmove	$0000,Bpl1mod			
	Cmove	$0000,Bpl2mod
	Cmove	$0000,Color00
	Cmove	$0fff,Color01
A	Set	70
B	Set	$0000
	Rept	$f
	Cwait	a,0
	Cmove	B,Color00
A	Set	a+1
B	Set	B+$100
	Endr
	Rept	$f
	Cwait	a,0
	Cmove	B,Color00
A	Set	a+1
B	Set	B-$100	
	Endr

	Cmove	$0007,Bpl1pth
	Cmove	$0000,Bpl1ptl
	Cmove	$1200,Bplcon0

A	Set	120
B	Set	$0000
	Rept	$f
	Cwait	a,0
	Cmove	B,Color00
A	Set	a+1
B	Set	B+$010
	Endr
	Rept	$f
	Cwait	a,0
	Cmove	B,Color00
A	Set	a+1
B	Set	B-$010	
	Endr
	Cmove	2,Bpl1mod
	Cmove	2,Bpl2mod

A	Set	190
B	Set	$0000
	Rept	$f
	Cwait	a,0
	Cmove	B,Color00
A	Set	a+1
B	Set	B+$110
	Endr
	Rept	$f
	Cwait	a,0
	Cmove	B,Color00
A	Set	a+1
B	Set	B-$110	
	Endr
	Cmove	$0200,Bplcon0
	Endcop

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

Title
	DC.B	"   ARENA PRESENTS   "
	
*****************************************************************************

OUTFLAG	DC.L	0

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

SCROLLPTR
	DC.L	SCROLL
SCROLL
	DC.B	" THERE FIRST DEMO"
	DC.B	" CREDS FOR THIS COOL DEMO GO TO"
	DC.B	" ME MELT DOWN FOR THE CODE GFX ARE BY EFFEX"
	DC.B	" THE MUSIC IS BY ?????"
	DC.B	" NOW THIS IS AN AMIGA LETS USE IT LIKE ONE"
	DC.B	" WELL LETS COUNT DOWN TO THE REAL CODE                    "
	DC.B	255
	 EVEN
	 
*****************************************************************************

Font
	Incbin	Gfx/16x16.bm
	
*****************************************************************************

