שתשת
; 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 #bitplane,d0	; Get adress of our bitplane...
	move.w d0,bplptr+6	; ...and set up bitplaneregs in copperlist
	swap d0			;
	move.w d0,bplptr+2	;
	move.l #cop,$dff080	; Set new copperlist

	lea bitplane(pc),a0	; Adress of our bitplane to A0
	add.l #40*40,a0		; Move pointer to line 40 on it
	lea char(pc),a1		; Adress of our char to A1
	move.l #8,d0		; Height of char = 8
copy:	move.b (a1)+,(a0)	; Move a row from our char to bitplane and
				; increase charptr by one
				; *Remember 1 byte = 8 bit = 8 pixels ;)
	add.l #40,a0		; Pointer to next line in bitplane
				; *Remember 40 bytes = 320 bit = 320 pixels
	subq.l #1,d0		; Decrease heightcounter
	bne.b copy		; If not zero, continue to copy char

mouse:	btst #6,$bfe001		; Left mouse clicked ?
	bne.b mouse		; 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	$008e,$1a64,$0090,$ffc4		; Setting up display,
		dc.w	$0092,$0038,$0094,$00d0		; modulo and so on
		dc.w	$0102,$0000,$0104,$0000
		dc.w	$0106,$0000,$0108,$0000
		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,$1200			; 1 Bitplane
bplptr:		dc.w	$00e0,$0000			; Adress of bpl
		dc.w	$00e2,$0000
		dc.w	$0180,$0000			; Color00 = black
		dc.w	$0182,$0fff			; Color01 = white
		dc.w	$ffff,$fffe

char:		dc.b	%01111110			; our 8x8 letter
		dc.b	%11100111			; "A"
		dc.b	%11100111
		dc.b	%11111111
		dc.b	%11100111
		dc.b	%11100111
		dc.b	%11100111
		dc.b	%11100111

bitplane:	blk.b	10240,0				; Space for one
							; 320x256 bitplane
							; 40 bytes each row
							; (320 bits/pixels)
gfxlib:		dc.b	"graphics.library",0,0
gfxbase:	dc.l	0
