שתשת
; Setting up a simple copperlist + 1 Bitplane and copy
; a single letter onto it! No (c)ode by aLpHa oNe!
; ====================================================

	section	flashtro,code_c

	move.l 4.w,a6		; Get base of exec lib
	lea gfxlib(pc),a1	; Adress of gfxlib string to a1
	jsr -408(a6)		; Call OpenLibrary()
	move.l d0,gfxbase	; Save base of graphics.library
	move.l #cop,$dff080	; Set new copperlist

	moveq #0,d3		; Main counter for colortable
	lea coltab(pc),a0	; Pointer to Colortable in A0
colors:	lea topbar+2(pc),a1	; Pointer to first Color0-Entry Top Bar in A1
	lea bottombar-2(pc),a2	; Pointer to last Color0-Entry Bottom Bar in A2
	moveq #54-1,d2		; Number of colorchanges for top/bottom bar
	move.l d3,d0		; Colortablecounter to d0
movec:	move.w (a0,d0.w),d1	; Get current colorvalue
	move.w d1,(a1)		; Move into copperlist
	move.w d1,(a2)		;
	addq.l #4,a1		; Increase to next colorentry Top Bar
	subq.l #4,a2		; Decrease to next colorentry Bottom Bar
	addq.l #2,d0		; Increase counter for colortable
	cmp.l #48*2,d0		; End of colortable reached?
	bne.b nocend		; Nah, continue
	moveq #0,d0		; Otherwise set counter to 0 again
nocend:	dbf d2, movec		; Loop

wait:	cmp.b #$ff,$dff006	; Wait for VBL
	bne.b wait		;

	addq.l #2,d3		; Increase main counter for colortable
	cmp.l #48*2,d3		; End of colortable reached?
	bne.b mouse		; Nah, continue
	moveq #0,d3		; Otherwise set main counter to 0 again
	
mouse:	btst #6,$bfe001		; Left mouse clicked ?
	bne.b colors		; No, continue loop!

	move.l gfxbase(pc),a1	; Base of graphics.library to a1
	move.l 38(a1),$dff080	; Restore old copperlist
	jsr -414(a6)		; Call CloseLibrary()
	moveq #0,d0		; Over..
	rts			; and out!

; Stuff
; *****

cop:		dc.w	$0106,$0000,$01fc,$0000		; AGA compatible
		dc.w	$0120,$0000,$0122,$0000		; Clear spriteptrs
		dc.w	$0124,$0000,$0126,$0000
		dc.w	$0128,$0000,$012a,$0000
		dc.w	$012c,$0000,$012e,$0000
		dc.w	$0130,$0000,$0132,$0000
		dc.w	$0134,$0000,$0136,$0000
		dc.w	$0138,$0000,$013a,$0000
		dc.w	$013c,$0000,$013e,$0000
		dc.w	$0100,$0200			; No Bitplane
		dc.w	$0180,$0000			; Color0 = Black

		dc.w	$500f,$fffe			; Wait VPos $50
topbar:		blk.l	54,$01800f00			; Space for 54 Color0-
							; changes
		dc.w	$0180,$0000			; Color0 = Black again

		dc.w	$f00f,$fffe			; Wait VPos $f0
		blk.l	54,$01800f00			; Space for 54 Color0-
							; changes
bottombar:	dc.w	$0180,$0000			; Color0 = Black again

		dc.w	$ffff,$fffe

coltab:		; 48 lousy colors :)

		dc.w	$f02,$f04,$f06,$f08,$f0a,$f0c,$f0e,$f0f
		dc.w	$e0f,$c0f,$a0f,$80f,$60f,$40f,$20f,$00f
		dc.w	$02f,$04f,$06f,$08f,$0af,$0cf,$0ef,$0ff
		dc.w	$0fe,$0fc,$0fa,$0f8,$0f6,$0f4,$0f2,$0f0
		dc.w	$2f0,$4f0,$6f0,$8f0,$af0,$cf0,$ef0,$ff0
		dc.w	$fe0,$fc0,$fa0,$f80,$f60,$f40,$f20,$f00
coltabend:

gfxlib:		dc.b	"graphics.library",0,0
gfxbase:	dc.l	0
