
*	HORIZONTAL SCROLLING (C)1990 MIKE CROSS

*	NOTE:
*	TO USE YOUR OWN GRAPHICS WITHOUT ALTERING THE CODE, YOU
*	MUST SAVE THE RAW DATA AT 700 PIXELS WIDE.
*	IF YOU WANT TO CHANGE THE WIDTH YOU WILL NEED TO ALTER THE BIT 
*	PLANE MODULO REGISTERS.



 	Section Horizontal,Code_c	* Chips please


	move.w	#$0,Smoothy
	move.w	#$0020,$dff096	
	clr.w	LogoCount1
	clr.w	LogoCount2
	clr.w	LogoCount3
	
	move.l	#Logo,d0
	move.w	d0,Bpl0ptl
	swap	d0
	move.w	d0,Bpl0pth
	swap	d0
	add.l	#$1340,d0
	
	move.w	d0,Bpl1ptl
	swap	d0
	move.w	d0,Bpl1pth
	swap	d0
	add.l	#$1340,d0
	
	move.w	d0,Bpl2ptl
	swap	d0
	move.w	d0,Bpl2pth
	swap	d0
	add.l	#$1340,d0
	
	move.w	d0,Bpl3ptl
	swap	d0
	move.w	d0,Bpl3pth
	add.w	#2,Bpl3ptl
	
	
	move.l	$04,a6		
	jsr	-132(a6)	
	lea	Gfxname,a1	 
	jsr	-408(a6)	;Open Library
	move.l	d0,Gfxbase	
	
	move.l	Gfxbase,a0	
	move.l	50(a0),Oldclist	
	move.l	#Newclist,50(a0)

	move.l	$6c,Oldirq+2	
	move.l	#Newirq,$6c	
	jmp	Wait

Newirq:
	movem.l	a0-a6/d0-d7,-(a7)	;Save all data onto Stack


	jsr	MoveLogo
	

Exit:
	movem.l	(a7)+,d0-d7/a0-a6	;Re-load saved data from Stack
Oldirq:
	jmp	$00000000

Wait:
	btst	#$06,$bfe001	;Left button?
	beq	Quit
	btst	#$0a,$dff016	;Right button?
	bne	Wait
 
Quit	move.w	#$8e30,$dff096
	move.l	Oldirq+2,$6c	;Reset the IRQ`s
	move.l	Gfxbase,a0	
	move.l	Oldclist,50(a0)	;Restart the Old Copper List
	move.l	$04,a6
	jsr	-138(a6)	;Lets Have Our Disk Drive Back!
	move.l	Gfxbase,a1	
	jsr	-414(a6)	;Close Graphics Library
	rts



Newclist:	
	dc.w	$008e,$2010
	dc.w	$0090,$2cc9
		
	dc.w	$0092,$0028,$0094,$00d8	;Data Fetch Start/Stop
	dc.w	$0102
Smoothy	dc.w	$0000
	dc.w	$0104,$0000		;Bitplane Scroll Registers
	dc.w	$0108,0042,$010a,0042 	;Bitplane Modulo
	dc.w	$180,0
	dc.w	$0100,$0000
	
	dc.w	$6009,$fffe,$180,$222
	dc.w	$6109,$fffe,$180,$333
	dc.w	$6209,$fffe,$180,$444
	dc.w	$6309,$fffe,$180,$555
	dc.w	$6409,$fffe,$180,$555
	dc.w	$6509,$fffe,$180,$444
	dc.w	$6609,$fffe,$180,$333
	dc.w	$6709,$fffe,$180,$222
	dc.w	$6809,$fffe,$180,$000
	
	dc.w	$7009,$fffe,$100,$4200
	
	dc.w	$00e0	
Bpl0pth dc.w	$0000,$00e2
Bpl0ptl dc.w	$0000,$00e4
Bpl1pth dc.w	$0000,$00e6
Bpl1ptl dc.w	$0000,$00e8
Bpl2pth dc.w	$0000,$00ea
Bpl2ptl dc.w	$0000,$00ec
Bpl3pth dc.w	$0000,$00ee
Bpl3ptl dc.w	$0000
	
	dc.w	$180,$000,$182,$888,$184,$444,$186,$ccc,$188,$333
	dc.w	$18a,$aaa,$18c,$666,$18e,$eee,$190,$111,$192,$999
	dc.w	$194,$555,$196,$ddd,$198,$333,$19a,$bbb,$19c,$777
	dc.w	$19e,0
	
Bar	dc.w	$a709,$fffe,$100,$000
	dc.w	$ab09,$fffe,$180,$222
	dc.w	$ac09,$fffe,$180,$333
	dc.w	$ad09,$fffe,$180,$444
	dc.w	$ae09,$fffe,$180,$555
	dc.w	$b009,$fffe,$180,$555
	dc.w	$b109,$fffe,$180,$444
	dc.w	$b209,$fffe,$180,$333
	dc.w	$b309,$fffe,$180,$222
	dc.w	$b409,$fffe,$180,$000
	
	dc.w	$ffff,$fffe		* Copper no more.




Oldclist	dc.l	0
Gfxbase		dc.l	0
Gfxname		dc.b	"graphics.library",0

Logo	incbin	source_2:tutorials/hardware/Pe-Logo6.Raw



MoveLogo
	cmpi.w	#20,LogoCount2
	bne.s	BackAgain
	
	cmpi.w	#20,LogoCount1
	bne.s	There

	
	jsr	ClearCounts
	rts
	
	
There	cmpi.w	#$ff,Smoothy
	beq.s	Step2
	addi.w	#$11,Smoothy
	rts

Step2	subi.w	#2,Bpl0ptl
	subi.w	#2,Bpl1ptl
	subi.w	#2,Bpl2ptl
	subi.w	#2,Bpl3ptl
	move.w	#$0,Smoothy
	addi.w	#1,LogoCount1
	addi.w	#1,LogoCount3
	rts
	
BackAgain
	cmpi.w	#$0,Smoothy
	beq.s	Step3
	subi.w	#$11,Smoothy
	rts

Step3	addi.w	#2,Bpl0ptl
	addi.w	#2,Bpl1ptl
	addi.w	#2,Bpl2ptl
	addi.w	#2,Bpl3ptl
	move.w	#$ff,Smoothy
	addi.w	#1,LogoCount2
	rts
	
ClearCounts
	clr.w	LogoCount1
	clr.w	LogoCount2
	rts
	

LogoCount1	dc.w	0
LogoCount2	dc.w	0
LogoCount3	dc.w	0
	




