	SECTION		Chipmemory,data_c	
							;BY BLAINE EVANS
							;1 ERITH WAY
							;PONTYBODKIN
							;NR MOLD
							;CLWYD
							;CH7 4TR
							;TEL O352-771673
		Opt	C-,D+

Height			equ	256
Width			equ	42
Depth			equ	5

ScreenSize		equ	Height*Width
MemoryRequired		equ	ScreenSize*Depth

FontHeight		equ	8
FontWidth		equ	1
FontSize		equ	FontHeight*FontWidth

		Incdir	source:Include/
		Include	Hardware.i

	Move.l	4.w,a6			;FIND EXEC BASE
	Lea	Gfxlib(pc),a1		;LOAD GRAPHICS LIBRARY IN A1
	Moveq.l	#$00,d0			;VERSION 0
	Jsr	-552(a6)		;OPEN LIBRARY
	Move.l	d0,_Gfxbase		;STORE D0 (GFX ADDRESS )
	Beq.s	NoLib_Exit		;ELSE EXIT

	Move.l	4.w,a6
	Move.l	#MemoryRequired,d0	; Amount of memory
	Moveq.l	#2,d1			; Chip memory
	Jsr	-198(a6)		; Allocate memory
	Move.l	d0,ScreenPointer	; Save area of memory
	Beq.s	NoMem_Exit		; Error-End

	Bsr	Plane_Addresses		
	Bsr	Init
	Bsr	Clear_Display

	Lea	$dff000,a6
	Move.l	_Gfxbase,a0		;LOAD ADDRESS OF GRAPHICS LIB IN A0
	Move.l	50(a0),Oldcop		;STORE CURRENT COPPER,ETC TO RETRIEVE LATER
S
	Move.l	#Newcop,50(a0)		;POINT TO OUR COPPERLIST

Wait					;WAIT LOOP
	Cmp.b	#255,$dff006		;VERTICAL BLANKING GAP 
	Bne.s	Wait			;
;	Move.w	#$fff,$180(a6)		;REMove TO MEASURE RASTER TIME
	Bsr	Scroller
;	Move.w	#$000,$180(a6)		;REMove TO MEASURE RASTER TIME
	Btst	#$6,$bfe001		;QUIT LEFT MOUSE PRESSED
	Bne.s	Wait
Ended					;ELSE LOOP TO WAIT
	Move.l	_Gfxbase,a0		;LOAD GRAPHICS LIB ADDRESS IN A0
	Move.l	Oldcop,50(a0)		;RESTORE OLD COPPER TO RETURN TO EDITTER
NoMem_Exit	
	Move.l	4.w,a6
	Move.l	ScreenPointer,a1	; Address to release from
	Move.l	#MemoryRequired,d0	; Size to release
	Jsr	-210(a6)		; Free memory
NoLib_Exit
	Move.l	4.w,a6			;FIND EXEC BASE
	Move.l	_Gfxbase,a1		;LOAD GRAPHICS BASE IN A1
	Jsr	-414(a6)		;CLOSE LIBRARY
Exit
	Rts				;RETURN TO EDITER

Plane_Addresses				
	Move.l	ScreenPointer,d0	; Start of Screen Memory
	Lea	Planes,a0		; BitPlane Control Words
	Moveq.l	#(Depth)-1,d1		; Number of Planes-1
PlaneLoop
	Move.w	d0,6(a0)		; Low Word of Bit-Plane 
	Swap	d0				
	Move.w	d0,2(a0)		; High Word of Bit-Plane
	Swap	d0
	Add.l	#ScreenSize,d0
	Add.l	#8,a0			; Increment to Next Control Word
	DBra	d1,PlaneLoop
	Rts
Init
	Move.l	ScreenPointer,d0	; Start of SCREEN memory
	Add.l	#(100*Width)+(Width-2),d0	; Add x number of lines 
	Move.l	d0,ScrollAddr		; Address of Scroller
        Lea	Text(pc),a1		; Text to Scroll
	Move.l	a1,Text_Address		; Store value
	Rts

Clear_Display
	Move.l	ScreenPointer,a0	; Start of Screen memory
	Move.l	#(MemoryRequired/4)-1,d0; Number of long words 
Clear
	Move.l	#0,(a0)+		; Transfer Data
	DBra	d0,Clear		; Loop till 0
	Rts

Scroller
	Add.w	#1,Count		; Do we need a char
	Cmp.w	#8,Count		; Font is 8*8
	Beq.s	Char_Needed
	Bsr	Scroll
	Rts
Char_Needed
	Move.w	#0,Count		; Clear scroll count
	Moveq.l	#0,d0			; Clear d0
	Move.l	Text_Address,a0		; Text chars in a0
       	Move.b	(a0)+,d0		; Next char
	Cmp.b	#$ff,d0			; Are we at the end
	Bne	Not_End			; Yes
	Lea	Text(pc),a0		; The reload text
	Move.b	(a0)+,d0		; Next Char
Not_End
	Move.l	a0,Text_Address		; Store value
        Sub.b	#32,d0		     	; Take off offset
        Mulu.w	#8,d0		   	; To find font gfx
        Lea	Font(pc),a1		; Font gfx in a1
        Add.l	d0,a1	         	; Add offset
	Move.l	ScrollAddr,a0		; Address
	Move.w	#(FontSize)-1,d0	; No of words
FontBuild
	Move.b	(a1)+,(a0)+	
	Add.w	#(Width-(FontWidth)),a0	; Add modula to get to next byte
	Dbra	d0,FontBuild
	Bsr	Scroll
	Rts
Scroll
	Move.l	ScrollAddr,a0			; Address
	Add.l	#(FontHeight)*(Width),a0	; Get to last word 
	Move.w	#(FontHeight),d1		; No of words down
Move_2
	Move.w	#(Width/2)-1,d0			; No of words across
Move
	Roxl.w	-(a0)				; Rotate with transfer to z flag 
	Dbra	d0,Move				; 1st loop=no across
	Dbra	d1,Move_2			; 2nd loop=no down
	Rts

Gfxlib	Dc.b	"graphics.library",0	
	Even
_Gfxbase	Dc.l	0			;LONG WORD TO STORE GFX ADDRESS
Oldcop		Dc.l	0			;OLD COPPERLIST ADDRESS
ScreenPointer	Dc.l	0
Text_Address	Dc.l	0
ScrollAddr	Dc.l	0
Count		Dc.w	0
	Even


Newcop
	Dc.w	BplCon0,%0101001000000000
	Dc.w	BplCon1,$0000			;SCROLL VALUE
	Dc.w	BplCon2,%0000000000000001	;NO PRIORITIES
	Dc.w	Bpl1Mod,Width-40		; Modula1
	Dc.w	Bpl2Mod,Width-40		; Modula2
	Dc.w	DdfStrt,$0038
	Dc.w	DdfStop,$00d0		
	Dc.w	DiwStrt,$2c81
	Dc.w	DiwStop,$2cc1		
						
Planes
	Dc.w	Bpl1pth
	Dc.w	$0000,Bpl1ptl
	Dc.w	$0000,Bpl2pth
	Dc.w	$0000,Bpl2ptl
	Dc.w	$0000,Bpl3pth
	Dc.w	$0000,Bpl3ptl
	Dc.w	$0000,Bpl4pth
	Dc.w	$0000,Bpl4ptl
	Dc.w	$0000,Bpl5pth
	Dc.w	$0000,Bpl5ptl
	Dc.w	$0000,Bpl6pth
	Dc.w	$0000,Bpl6ptl
	Dc.w	$0000

Sprites						;SPRITES
	Dc.w	Spr0pth
	Dc.w	$0000,Spr0ptl
	Dc.w	$0000,Spr1pth
	Dc.w	$0000,Spr1ptl
	Dc.w	$0000,Spr2pth
	Dc.w	$0000,Spr2ptl
	Dc.w	$0000,Spr3pth
	Dc.w	$0000,Spr3ptl
	Dc.w	$0000,Spr4pth
	Dc.w	$0000,Spr4ptl
	Dc.w	$0000,Spr5pth
	Dc.w	$0000,Spr5ptl
	Dc.w	$0000,Spr6pth
	Dc.w	$0000,Spr6ptl
	Dc.w	$0000,Spr7pth
	Dc.w	$0000,Spr7ptl
	Dc.w	$0000

	Dc.w	Color00,$0000,Color01,$0fff
	Dc.w	Color02,$0d00,Color03,$0f80
	Dc.w	Color04,$0ff0,Color05,$00ff
	Dc.w	Color06,$008f,Color07,$0095

	Dc.w	Color08,$0000,Color09,$0283
	Dc.w	Color10,$08f4,Color11,$0095
	Dc.w	Color12,$0243,Color13,$00ff
	Dc.w	Color14,$0ff0,Color15,$0fa0

	Dc.w	Color16,$0f00,Color17,$0b00
	Dc.w	Color18,$0600,Color19,$0F40
	Dc.w	Color20,$0F80,Color21,$0Fa0
	Dc.w	Color22,$0Ff0,Color23,$000f
	Dc.w	Color24,$004f,Color25,$008f
	Dc.w	Color26,$00ff,Color27,$00f0
	Dc.w	Color28,$0283,Color29,$0f00
	Dc.w	Color30,$0456,Color31,$0f04

	Dc.w	$ffff,$fffe			;END OF COPPERLIST
Text	     	
	Dc.b	"Hi to all ACC Readers.This is a re-coding of "
	Dc.b	"a ^68000 Scroller I coded back in September,91 "
	Dc.b	"Please note the use of the include file Hardware.i "
	Dc.b	"Special Hello's to Mark,Leon,Mike,Gary Wright,Trog "
	Dc.b	"To MasterBeat,Dave Shaw,Neil-Why haven't you replied "
	Dc.b	"lately.See you all in another scroller soon,...F.M..." 
	Dc.b	$ff        
	even

Font        
	Dc.b    $00,$00,$00,$00,$00,$00,$00,$00  ' '
	Dc.b    $18,$18,$18,$18,$18,$00,$18,$00  '!'
	Dc.b    $6C,$6C,$6C,$00,$00,$00,$00,$00  '"'
	Dc.b    $36,$36,$7F,$36,$7F,$36,$36,$00  '#'
	Dc.b    $0C,$3F,$68,$3E,$0B,$7E,$18,$00  '$'
	Dc.b    $60,$66,$0C,$18,$30,$66,$06,$00  '%'
	Dc.b    $38,$6C,$6C,$38,$6D,$66,$3B,$00  '&'
	Dc.b    $18,$18,$18,$00,$00,$00,$00,$00  '''
	Dc.b    $0C,$18,$30,$30,$30,$18,$0C,$00  '('
	Dc.b    $30,$18,$0C,$0C,$0C,$18,$30,$00  ')'
	Dc.b    $00,$18,$7E,$3C,$7E,$18,$00,$00  '*'
	Dc.b    $00,$18,$18,$7E,$18,$18,$00,$00  '+'
	Dc.b    $00,$00,$00,$00,$00,$0C,$0C,$30  ','
	Dc.b    $00,$00,$00,$3C,$00,$00,$00,$00  '-'
	Dc.b    $00,$00,$00,$00,$00,$00,$18,$18  '.'
	Dc.b    $00,$06,$0C,$18,$30,$60,$00,$00  '/'
	Dc.b    $3C,$66,$6E,$7E,$76,$66,$3C,$00  '0'
	Dc.b    $18,$38,$18,$18,$18,$18,$7E,$00  '1'
	Dc.b    $3C,$66,$06,$0C,$18,$30,$7E,$00  '2'
	Dc.b    $3C,$66,$06,$1C,$06,$66,$3C,$00  '3'
	Dc.b    $0C,$1C,$3C,$6C,$7E,$0C,$0C,$00  '4'
	Dc.b    $7E,$60,$7C,$06,$06,$66,$3C,$00  '5'
	Dc.b    $1C,$30,$60,$7C,$66,$66,$3C,$00  '6'
	Dc.b    $7E,$06,$0C,$18,$30,$30,$30,$00  '7'
	Dc.b    $3C,$66,$66,$3C,$66,$66,$3C,$00  '8'
	Dc.b    $3C,$66,$66,$3E,$06,$0C,$38,$00  '9'
	Dc.b    $00,$00,$18,$18,$00,$18,$18,$00  ':'
	Dc.b    $00,$00,$18,$18,$00,$18,$18,$30  ';'
	Dc.b    $0C,$18,$30,$60,$30,$18,$0C,$00  '<'
	Dc.b    $00,$00,$7E,$00,$7E,$00,$00,$00  '='
	Dc.b    $30,$18,$0C,$06,$0C,$18,$30,$00  '>'
	Dc.b    $3C,$66,$0C,$18,$18,$00,$18,$00  '?'
	Dc.b    $3C,$66,$6E,$6A,$6E,$60,$3C,$00  '@'
	Dc.b    $3C,$66,$66,$7E,$66,$66,$66,$00  'A'
	Dc.b    $7C,$66,$66,$7C,$66,$66,$7C,$00  'B'
	Dc.b    $3C,$66,$60,$60,$60,$66,$3C,$00  'C'
	Dc.b    $78,$6C,$66,$66,$66,$6C,$78,$00  'D'
	Dc.b    $7E,$60,$60,$7C,$60,$60,$7E,$00  'E'
	Dc.b    $7E,$60,$60,$7C,$60,$60,$60,$00  'F'
	Dc.b    $3C,$66,$60,$6E,$66,$66,$3C,$00  'G'
	Dc.b    $66,$66,$66,$7E,$66,$66,$66,$00  'H'
	Dc.b    $7E,$18,$18,$18,$18,$18,$7E,$00  'I'
	Dc.b    $3E,$0C,$0C,$0C,$0C,$6C,$38,$00  'J'
	Dc.b    $66,$6C,$78,$70,$78,$6C,$66,$00  'K'
	Dc.b    $60,$60,$60,$60,$60,$60,$7E,$00  'L'
	Dc.b    $63,$77,$7F,$6B,$6B,$63,$63,$00  'M'
	Dc.b    $66,$66,$76,$7E,$6E,$66,$66,$00  'N'
	Dc.b    $3C,$66,$66,$66,$66,$66,$3C,$00  'O'
	Dc.b    $7C,$66,$66,$7C,$60,$60,$60,$00  'P'
	Dc.b    $3C,$66,$66,$66,$6A,$6C,$36,$00  'Q'
	Dc.b    $7C,$66,$66,$7C,$6C,$66,$66,$00  'R'
	Dc.b    $3C,$66,$60,$3C,$06,$66,$3C,$00  'S'
	Dc.b    $7E,$18,$18,$18,$18,$18,$18,$00  'T'
	Dc.b    $66,$66,$66,$66,$66,$66,$3C,$00  'U'
	Dc.b    $66,$66,$66,$66,$66,$3C,$18,$00  'V'
	Dc.b    $63,$63,$6B,$6B,$7F,$77,$63,$00  'W'
	Dc.b    $66,$66,$3C,$18,$3C,$66,$66,$00  'X'
	Dc.b    $66,$66,$66,$3C,$18,$18,$18,$00  'Y'
	Dc.b    $7E,$06,$0C,$18,$30,$60,$7E,$00  'Z'
	Dc.b    $7C,$60,$60,$60,$60,$60,$7C,$00  '['
	Dc.b    $00,$60,$30,$18,$0C,$06,$00,$00  '\'
	Dc.b    $3E,$06,$06,$06,$06,$06,$3E,$00  ']'
	Dc.b    $18,$3C,$66,$42,$00,$00,$00,$00  '^'
	Dc.b    $00,$00,$00,$00,$00,$00,$00,$FF  '_'
	Dc.b    $1C,$36,$30,$7C,$30,$30,$7E,$00  '`'
	Dc.b    $00,$00,$3C,$06,$3E,$66,$3E,$00  'a'
	Dc.b    $60,$60,$7C,$66,$66,$66,$7C,$00  'b'
	Dc.b    $00,$00,$3C,$66,$60,$66,$3C,$00  'c'
	Dc.b    $06,$06,$06,$3E,$66,$66,$3E,$00  'd'
	Dc.b    $00,$00,$3C,$66,$7E,$60,$3C,$00  'e'
	Dc.b    $1C,$30,$30,$7C,$30,$30,$30,$00  'f'
	Dc.b    $00,$00,$3E,$66,$66,$3E,$06,$3C  'g'
	Dc.b    $60,$60,$7C,$66,$66,$66,$66,$00  'h'
	Dc.b    $18,$00,$38,$18,$18,$18,$3C,$00  'i'
	Dc.b    $18,$00,$38,$18,$18,$18,$18,$70  'j'
	Dc.b    $60,$60,$66,$6C,$78,$6C,$66,$00  'k'
	Dc.b    $38,$18,$18,$18,$18,$18,$3C,$00  'l'
	Dc.b    $00,$00,$36,$7F,$6B,$6B,$63,$00  'm'
	Dc.b    $00,$00,$7C,$66,$66,$66,$66,$00  'n'
	Dc.b    $00,$00,$3C,$66,$66,$66,$3C,$00  'o'
	Dc.b    $00,$00,$7C,$66,$66,$7C,$60,$60  'p'
	Dc.b    $00,$00,$3E,$66,$66,$3E,$06,$07  'q'
	Dc.b    $00,$00,$6C,$76,$60,$60,$60,$00  'r'
	Dc.b    $00,$00,$3E,$60,$3C,$06,$7C,$00  's'
	Dc.b    $30,$30,$7C,$30,$30,$30,$1C,$00  't'
	Dc.b    $00,$00,$66,$66,$66,$66,$3E,$00  'u'
	Dc.b    $00,$00,$66,$66,$66,$3C,$18,$00  'v'
	Dc.b    $00,$00,$63,$6B,$6B,$7F,$36,$00  'w'
	Dc.b    $00,$00,$66,$3C,$18,$3C,$66,$00  'x'
	Dc.b    $00,$00,$66,$66,$66,$3E,$06,$3C  'y'
	Dc.b    $00,$00,$7E,$0C,$18,$30,$7E,$00  'z'
	Dc.b    $0C,$18,$18,$70,$18,$18,$0C,$00  '{'
	Dc.b    $18,$18,$18,$00,$18,$18,$18,$00  '|'
	Dc.b    $30,$18,$18,$0E,$18,$18,$30,$00  '}'
	Dc.b    $31,$6B,$86,$00,$00,$00,$00,$00  '~'


