start:	move.l		4,a6
	jsr		-132(a6)	;no multitasking
	lea		gfxname,a1
	jsr		-408(a6)	;open gfxlib
	move.l		d0,gfxbase

	move.l		gfxbase,a6	;First
	lea		bitmap,a0	;Initialize
	move.l		#1,d0		;bitmap
	move.l		#384,d1		;and rasport
	move.l		#256,d2		;for used plane
	jsr		-390(a6)	; InitBitMap
	lea		rastport,a1
	jsr		-198(a6)	; InitRastPort
	move.l		#bitmap,r_bitmap

	lea		textattr,a0
	jsr		-72(a6)		;OpenFont
	move.l		d0,a0
	lea		rastport,a1
	jsr		-66(a6)		;Setfont to topaz.9

	move.l		#plane,d0	;put bitplane
	move.w		d0,pl+6		;in copperlist
	swap		d0		;high and low
	move.w		d0,pl+2		;word

	move.l		gfxbase,a0
	move.l		$32(a0),oldcop
	move.l		#newcop,$32(a0)	;set new copperlist
	move.l		$6c,oldirq
	move.l		#newirq,$6c	;and new irq vector
wait:	btst		#6,$bfe001	;wait for mouse
	bne		wait
	move.l		oldirq,$6c	;old irq vector back
	move.l		gfxbase,a0	;and old copperlist
	move.l		oldcop,$32(a0)
	move.l		4,a6
	jsr		-138(a6)	;multitasking back on
	clr.l		d0		;no cli error
	rts				;bye

newirq:	bsr		scroll
	bsr		doit
	dc.w		$4ef9		;code for jmp
oldirq:	dc.l		0		;to old irq vector

scroll:	move.l		gfxbase,a6
	move.l		#2,d0		;dx, 2 pixels to the left
	clr.l		d1		;dy
	move.l		#0,d2		;min x
	move.l		#10,d3		;min y
	move.l		#383,d4		;max x
	move.l		#25,d5		;max y
	lea		rastport,a1	;rastport pointer
	jsr		-396(a6)	;ScrollRaster
	subq.w		#1,scrcount	;Counter for newtext
	beq		newtext		;is zero->new char
	rts				;else->bye ??
newtext:move.w		#5,scrcount	;newtext delay set
	move.l		gfxbase,a6
	lea		rastport,a1
	move.l		#374,d0		;x
	move.l		#18,d1		;y
	jsr		-240(a6)	;move
	move.l		stringpointer,a0;pointer to string
	move.l		#1,d0		;1 char
	jsr		-60(a6)
	addq.l		#1,stringpointer;Next char
	cmpi.l		#endstring,stringpointer
	bne		notend		;end of string reached
	move.l		#string,stringpointer;Start al over
notend:	rts

top=2
down=240
left=16
right=364

doit:	lea		oldxy,a3
	move.l		gfxbase,a6
	lea		rastport,a1
	move.l		#0,d0
	jsr		-342(a6)	;set color
	lea		rastport,a1
	move.l		(a3),d0
	move.l		4(a3),d1
	jsr		-240(a6)	;move
	lea		rastport,a1
	move.l		8(a3),d0
	move.l		12(a3),d1
	jsr		-246(a6)	;draw to ->erase old line
	bsr		roll		;cycle through lines
	lea		oldxy,a3

	move.l		gfxbase,a6
	lea		rastport,a1
	move.l		#1,d0		;setcolor
	jsr		-342(a6)
	lea		point1,a2	;calc new points
	bsr		calc		;first point1
	move.l		gfxbase,a6
	lea		rastport,a1
	move.l		d0,496(a3)
	move.l		d1,500(a3)
	jsr		-240(a6)	;move
	lea		point2,a2
	bsr		calc		;then point2
	move.l		gfxbase,a6
	lea		rastport,a1
	move.l		d0,504(a3)
	move.l		d1,508(a3)
	jsr		-246(a6)	;draw new line
 	subq.b		#1,bcount	;delay for gravity
	bne		bnot0
	move.b		#5,bcount
bnot0:	rts

oldxy:	blk.l	128,0

roll:	move.l		#123,d7		;this routine
sloop:	move.l		16(a3),(a3)	;cycles through
	addq.l		#4,a3		;coords
	dbra		d7,sloop	;so first line becomes last
	rts				;at some time
		
calc:	move.l		8(a2),d0	;x-coor.
	move.l		12(a2),d1	;y-coor.
	add.l		(a2),d0		;x=x+dx
	move.l		d0,8(a2)
	add.l		4(a2),d1	;y=y+dy
	move.l		d1,12(a2)
	cmpi.b		#1,bcount	;time for gravity
	bne		noacc		;yes
	addq.l		#1,4(a2)	;so increase speed
noacc:	cmpi.l		#top,d1		;bounce
	bge		skp1
	bra		neg1
skp1:	cmpi.l		#down,d1
	ble		skp2
neg1:	neg.l		4(a2)

skp2:	cmpi.l		#left,d0
	bge		skp3
	bra		neg2
skp3:	cmpi.l		#right,d0
	ble		skp4
neg2:	neg.l		(a2)
skp4:	rts

point1:		dc.l	2
		dc.l	2
		dc.l	100
		dc.l	100
point2:		dc.l	-3
		dc.l	0
		dc.l	100
		dc.l	40

newcop:	dc.w	$0180,$0000,$0182,$0fff		;colors
	dc.w	$008e,$296a,$0090,$29fa		;DIWStart/DIWStop
	dc.w	$0092,$0028,$0094,$00d8		;DFFStart/DFFStop
	dc.w	$0108,$0002,$010a,$0002		;BPL0MOD/BPL1MOD
pl:	dc.w	$00e0,$0000,$00e2,$0000		;bitplane pointers
	dc.w	$0100,$1000			;1 bitplane on
	dc.w	$ffff,$fffe

plane:	blk.b	48*256,0
bitmap:	dc.w	0,0,0,0		;This is the bitmap structure
	dc.l	plane		;as used by the system
	dc.l	0		;bitplane2 off
	dc.l	0		;bitplane3 off
	dc.l	0		;bitplane4 off
	dc.l	0		;bitplane5 off
	dc.l	0		;bitplane6 off
rastport:
	dc.l	0		;and the rastport structure
r_bitmap:
	dc.l	0		;bitmap pointer in rastport struct
	blk.b	102,0
textattr:
	dc.l	fontname	;the textattr structure
	dc.w	9		;fontsize
	dc.b	0,0		;style,flags

stringpointer:	dc.l	string
scrcount:	dc.w	1
oldcop:		dc.l	0
gfxbase:	dc.l	0
gfxname:	dc.b	"graphics.library",0
fontname:	dc.b	"topaz.font",0
bcount:		dc.b	1
string: dc.b	" THE TIMECIRCLE PRESENTS ..."
	dc.b	" A FLASHY LINEBOUNCER (WITH GRAVITY) EFFECT ... "
	dc.b	"CODED BY BRIAN POSTMA FOR THE NEWSFLASH MAGAZINE"
	dc.b	" ......       "
endstring:

