-------------------------------------------------------------------------
            Softscroller - Created for UGA PD by Brian Postma
-------------------------------------------------------------------------
start:	movem.l		d0-d7/a0-a6,-(a7)
	lea		gfxname,a1	;Name of graphics library
	move.l		4,a6		;Execbase
	jsr		-408(a6)	;Open Library
	move.l		d0,gfxbase	;Rememer graphics base
	lea		intname,a1	;Name of intuition lib.
	jsr		-408(a6)	;Open Library
	move.l		d0,intbase	;Remember intuition base
	move.l		intbase,a6
	lea		osargs,a0	;Pointer to newscreen struct.
	jsr		-198(a6)	;Open Screen
	move.l		d0,screenbase	;Pointer to screen struct
	beq		quit		;Could I open it ??
	add.l		#84,d0		;Screenbase+84
	move.l		d0,rastport	;Is Rastport
	move.l		gfxbase,a6	
	move.l		rastport,a1
	clr.l		d0		;Color=0
	jsr		-234(a6)	;Setrast->Clear Screen
	move.l		screenbase,a0
	move.l		192(a0),d0	;Pointer to first bitplane
	move.w		d0,planes+6	;Low word in copperlist
	swap		d0
	move.w		d0,planes+2	;High word in copperlist
	move.l		gfxbase,a0	;gfxbase+$32=pointer to clist
	move.l		$32(a0),oldcop	;save old copperlist
	move.l		#newcop,$32(a0)	;My own copperlist
	move.l		$6c,oldirq	;Save old VBL irq pointer
	move.l		#newirq,$6c	;my VBL interrupt
wait:	btst		#6,$bfe001	;Left mouse button pressed ??
	bne		wait		;No !!
	move.l		oldirq,$6c	;Restore interrupt
	move.l		gfxbase,a0	;restore
	move.l		oldcop,$32(a1)	;old copperlist
	move.l		intbase,a6
	move.l		screenbase,a0
	jsr		-66(a6)		;Close the screen
quit:	movem.l		(a7)+,d0-d7/a0-a6
	rts

newirq:	movem.l		d0-d7/a0-a6,-(a7);Save regs
	bsr		scroll
	movem.l		(a7)+,d0-d7/a0-a6;Restore regs
	dc.w		$4ef9		;Code for 'JUMP'
oldirq:	dc.l		0		;Jump to oldirq

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		#0,d3		;min y
	move.l		#367,d4		;max x
	move.l		#15,d5		;max y
	move.l		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
	move.l		rastport,a1
	move.l		#358,d0		;x
	move.l		#8,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

newcop:	dc.w	$0092,$0028,$0094,$00d8	;DFFSTART,DFFSTOP->OverScan
	dc.w	$008e,$296a,$0090,$29fa	;DIWSTART,DIWSTOP
	dc.w	$0108,$0000,$010a,$0000	;BPL1MOD,BPL2MOD
	dc.w	$0096,$0020,$0100,$0000	;Sprites off,planes off
	dc.w	$0180,$0000,$0182,$0fff	;Colors
planes:	dc.w	$00e0,$0000,$00e2,$0000	;Plane1 low,high word
	dc.w	$8001,$fffe		;Wait till line 128 reached
	dc.w	$0100,$1000		;Bitplane 1 on
	dc.w	$9001,$fffe		;Wait till line 144 reached
	dc.w	$0100,$0000		;Bitplanes off
	dc.w	$ffff,$fffe		;Wait till end

osargs:	dc.w	0,0,368,16		;x-min,y-min,width,height
	dc.w	1			;depth 1 bitplane
	dc.b	0,1			;detailpen,blockpen
	dc.w	0,15			;viewmodes,type=customscreen
	dc.l	textattr,0		;textattr,title=none
	dc.l	0,0			;gadgets,bitmap
textattr:
	dc.l	fontname		;Fontname
	dc.w	9			;fontsize
	dc.b	0			;Style=normal
	dc.b	1			;flags=romfont

scrcount:	dc.w	1
oldcop:		dc.l	0
gfxbase:	dc.l	0
intbase:	dc.l	0
rastport:	dc.l	0
screenbase:	dc.l	0
stringpointer:	dc.l	string
intname:	dc.b	"intuition.library",0
gfxname:	dc.b	"graphics.library",0
fontname:	dc.b	"topaz.font",0
string:
 dc.b	"THE UGA PUBLIC DOMAIN SCROLLER - WRITTEN BY BRIAN POSTMA"
 dc.b	"      "
endstring:
-------------------------------------------------------------------------
<How to assemble>

This program, a softscroller, was written on seka. To assemble do the
following.
-Load Source file from this disk by typing 'r<CR>' followed by
 'Scroll<CR>'.
-Now assemble by typing 'a<CR><CR>'.
Now you got an assembled object file in memory, you can do the following
-Type 'j<CR>' to make a testrun (remember to reassemble after doing this)
-Type 'wo<CR>' to save an executable file to disk. When you have a
 version 2.0 or higher of 'seka' you will be prompted with 'MODE', here
 type 'c<CR>' to save a chipcode file.

<Beware>

This program will only run when it is placed in chipmem, because the
copperlist which is used will only work there. When you have a version
2.0 or higher of 'seka', this is no problem because this program asks
for the type of memory it should use (type 'c'). When you have an older
version, you should turn off your memory expansion.

<What's the use>

Well, this program demonstrates how you can create a simple softscroller
and shows how you can use your own copperlists, experiment around with
the copperlist, and you will find out how it works (it's the way I learn-
ed it).


for questions, comments, remarkes contact:

Brian Postma
J.v.Hartenstraat 51
7576VX Oldenzaal (NL)
Tel:05410-14763

