	opt l-,p+
	
	incdir	rad:include/
	include	exec/exec_lib.i
	include	graphics/graphics_lib.i
	include	graphics/gfx.i
	include	graphics/gfxbase.i
	include	graphics/view.i
	include	graphics/rastport.i 
	include	graphics/text.i
	
TOPAZ_EIGHTY	EQU	8

	lea	grafname(pc),a1
	clr.l	d0
	CALLEXEC	OpenLibrary
	lea	_GfxBase(pc),a0
	move.l	d0,(a0)
	
	move.l	d0,a0
	lea	_OldView(pc),a1
	move.l	gb_ActiView(a0),(a1)
	
	lea	BitMap1(pc),a0
	move.l	#2,d0
	move.l	#320,d1 
	move.l	#270,d2
	CALLGRAFPC	InitBitMap
	
	lea	BitMap2(pc),a0
	move.l	#2,d0
	move.l	#320,d1
	move.l	#270,d2
	CALLGRAFPC	InitBitMap
	
	lea	BitMap1(pc),a3
	lea	BitMap2(pc),a4
	addq.l	#bm_Planes,a3
	addq.l	#bm_Planes,a4
	
	move.l	#1,d5
Loop	move.l	#320,d0
	move.l	#270,d1
	CALLGRAFPC	AllocRaster
	move.l	d0,(a3)+
	move.l	d0,(a4)+
	move.l	d0,a1
	move.l	#$2A30,d0
	clr.l	d1
	CALLGRAFPC	BltClear
	dbra	d5,Loop

	lea	FontTopaz80(pc),a0
	lea	fontname(pc),a1
	move.l	a1,(a0)
	CALLGRAFPC	OpenFont
	move.l	d0,a4
	
	lea	RastPort1(pc),a1
	CALLGRAFPC	InitRastPort
	
	lea	RastPort1(pc),a1
	lea	BitMap1(pc),a0
	move.l	a0,rp_BitMap(a1)
	move.b	#%010101,rp_Mask(a1)
	move.l	a4,rp_Font(a1)
	
	lea	RastPort2(pc),a1
	CALLGRAFPC	InitRastPort
	
	lea	RastPort2(pc),a1
	lea	BitMap2(pc),a0
	move.l	a0,rp_BitMap(a1)
	move.b	#%101010,rp_Mask(a1)
	move.l	a4,rp_Font(a1)
	
	lea	ViewPort1(pc),a0
	CALLGRAFPC	InitVPort
	
	lea	ViewPort1(pc),a0
	move	#V_DUALPF!V_PFBA,vp_Modes(a0)
	move	#320,vp_DWidth(a0)
	move	#256,vp_DHeight(a0)
	move	#-10,vp_DyOffset(a0)
	lea	RasInfo1(pc),a1
	lea	RasInfo2(pc),a2
	move.l	a2,ri_Next(a1)
	clr.l	ri_Next(a2)
	lea	BitMap1(pc),a3
	move.l	a3,ri_BitMap(a1)
	lea	BitMap2(pc),a3
	move.l	a3,ri_BitMap(a2)
	move.l	a1,vp_RasInfo(a0)
	clr.l	vp_Next(a0)
	
	lea	View1(pc),a1
	CALLGRAFPC	InitView
	lea	ViewPort1(pc),a0
	move.l	a0,v_ViewPort(a1)
	
	move.l	#12,d0
	CALLGRAFPC	GetColorMap
	lea	ViewPort1(pc),a0
	move.l	d0,vp_ColorMap(a0)
	
	lea	ColorTable(pc),a1
	lea	ViewPort1(pc),a0
	move.l	#12,d0
	CALLGRAFPC	LoadRGB4
	
	lea	View1(pc),a0
	lea	ViewPort1(pc),a1
	CALLGRAFPC	MakeVPort
	
	lea	View1(pc),a1
	CALLGRAFPC	MrgCop
	
	lea	View1(pc),a1
	CALLGRAFPC	LoadView
	
	lea	RastPort1(pc),a1
	move.l	#1,d0
	CALLGRAFPC	SetAPen
	
	lea	RastPort2(pc),a1
	move.l	#10,d0
	CALLGRAFPC	SetAPen
	
	lea	frasi1(pc),a4
	lea	frasi2(pc),a5
	clr.l	d5
	clr.l	d6
	move.l	#3,d7
	
Scrolling 
Length1	addq.l	#1,d5
	tst.b	(a4)+
	bne.s	Length1

Length2	addq.l	#1,d6
	tst.b	(a5)+
	bne.s	Length2
	
Stampa	lea	RastPort1(pc),a1
	move.l	d5,d0
	subq.l	#1,d0
	lsl.l	#3,d0
	sub.l	#320,d0
	neg.l	d0
	lsr.l	#1,d0
	move.l	#8,d1
	CALLGRAFPC	Move
	
	lea	RastPort2(pc),a1
	move.l	d6,d0
	subq.l	#1,d0
	lsl.l	#3,d0
	sub.l	#320,d0
	neg.l	d0
	lsr.l	#1,d0
	move.l	#265,d1
	CALLGRAFPC	Move
	
o	lea	RastPort1(pc),a1
	move.l	d5,d0
	move.l	a4,a0
	sub.l	d5,a0
	move.l	d5,d0
	subq.l	#1,d0
	CALLGRAFPC	Text
	
	lea	RastPort2(pc),a1
	move.l	d6,d0
	move.l	a5,a0
	sub.l	d6,a0
	move.l	d6,d0
	subq.l	#1,d0
	CALLGRAFPC	Text


	move.l	#15,d6
Cicla	lea	RastPort1(pc),a1
	clr.l	d0
	move.l	#-1,d1
	clr.l	d2
	move.l	#0,d3
	move.l	#320,d4
	move.l	#270,d5
	CALLGRAFPC	ScrollRaster
	lea	RastPort2(pc),a1
	clr.l	d0
	move.l	#1,d1
	clr.l	d2
	move.l	#0,d3
	move.l	#320,d4
	move.l	#270,d5
	CALLGRAFPC	ScrollRaster
	dbra	d6,Cicla
	
	clr.l	d6
	clr.l	d5
	dbra	d7,Scrolling
	
	move.l	#160,d6
Cicla1	lea	RastPort1(pc),a1
	clr.l	d0
	move.l	#-1,d1
	clr.l	d2
	move.l	#0,d3
	move.l	#320,d4
	move.l	#270,d5
	CALLGRAFPC	ScrollRaster
	lea	RastPort2(pc),a1
	clr.l	d0
	move.l	#1,d1
	clr.l	d2
	move.l	#0,d3
	move.l	#320,d4
	move.l	#270,d5
	CALLGRAFPC	ScrollRaster
	dbra	d6,Cicla1
	
a	btst	#6,$BFE001
	bne.s	a
	
	move.l	_OldView(pc),a1
	CALLGRAFPC	LoadView
	
	lea	ViewPort1(pc),a0
	move.l	vp_ColorMap(a0),a0
	CALLGRAFPC	FreeColorMap
	
	lea	ViewPort1(pc),a0
	CALLGRAFPC	FreeVPortCopLists
	
	lea	View1(pc),a0
	move.l	v_LOFCprList(a0),a0
	CALLGRAFPC	FreeCprList
	
	move.l	#1,d5
	lea	BitMap1(pc),a4
	addq.l	#bm_Planes,a4
Loop3	move.l	(a4)+,a0
	move.l	#320,d0
	move.l	#270,d1
	CALLGRAFPC	FreeRaster
	dbra	d5,Loop3
	
	
	move.l	_GfxBase(pc),a1
	CALLEXEC	CloseLibrary
Fine	rts 

ColorTable
	dc.w	$000
	dc.w	$F00
	dc.w	$0FF
	dc.w	$00F 
	dc.w	0
	dc.w	0
	dc.w	0
	dc.w	0
	dc.w	$000
	dc.w	$FF0
	dc.w	$F00
	dc.w	$888
	
FontTopaz80	
	dc.l	0
	dc.w	TOPAZ_EIGHTY
	dc.b	FS_NORMAL
	dc.b	FPF_ROMFONT
	
	
_GfxBase	ds.l 1
_OldView	ds.l 1
BitMap1	ds.b bm_SIZEOF
BitMap2	ds.b bm_SIZEOF
RastPort1	ds.b $64
RastPort2	ds.b $64
ViewPort1	ds.b vp_SIZEOF
View1	ds.b v_SIZEOF
RasInfo1	ds.b ri_SIZEOF
RasInfo2	ds.b ri_SIZEOF
grafname	GRAFNAME	
frasi2	dc.b 'DevPac Assembler Version 2.08',0
	dc.b 'Copyright © HiSoft 1988',0
	dc.b 'Markt & Technik Verlag',0
	dc.b 'Haar bei M',220,'nchen',0
	
frasi1	dc.b '--------------',0
	dc.b 'Luca Marceglia',0
	dc.b ' ',0
	dc.b 'Scrolling done by',0
fontname	dc.b 'topaz.font',0
	cnop 0,2
