Hits: 3407

Setting up a simple copperlist + 1 Bitplane & copy a single letter onto it!

Author: aLpHa oNe
Submitted by: musashi9
Date: 2006-01-31 20:02
No tags

; 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
FileDownload: 2.Bitplane
Filesize: 0KB, downloaded 810 times
Powered by the best online Amiga mod player: FLOD

Some more you may like:



Leave a Comment!

: Use this calculator
Your comment will be available for editing for 10 minutes
2006-02-01 07:52

1. demoniac writes

This explains well how the bitmap characters are created.
2012-08-04 11:18

2. boot writes

Here, you have the fonts in binary format. 1 bit = 1 pixel.
Alpha One copy each line of fonts in a screen. The font height is 8 pixel tall so, you have 8 iterations. The move.b (a0)+,(a1)+ is the most important because here you make the action of copying. you copy a line of 8 pixels of wide. move.b can be translated by copy a byte (so 8bits wide) to A0 towards A1 and after the operation, increment the address of A0 and A1 of a unit (1 position). This operation will repeat 8 times.

2012-08-04 18:34

3. WayneK writes

This is my personal favourite way to store entire fonts (in a giant vertical 'strip') also...eg: 8x8 1bpl font:

;assume scrolltextptr in d0
lea scrolltext(pc),a0
lea (a0,d0),a0
lea fontgfx(pc),a1
move.b (a0),d1
sub.b #32,d1
lsl.w #3,d1
lea (a1,d1),a1
;now a1 points to the start of the gfx for this char
...amazingly optimised 8x8 drawing code here...

To me this is neater than the chartable-lookup stuff in some of Alpha-One's other example source, but whatever works for you!
2012-08-05 10:41

4. boot writes

interesting :-)
2012-08-09 11:21

5. TB Falsename writes

Hmmm, is there any reason why this would work perfectly on OCS and AGA but fail on ECS? Cos that's what I'm seeing; ie no bitplane is displayed (although if I change COLOR0 I do see the BG color fine...) :/
2012-08-11 23:19

6. musashi9 writes

Works on FULL-ESC for me, what are you winuae settings?
2012-08-21 22:13

7. TB Falsename writes

Sorry for the delay!

musashi9, using the "A500+" preset from this toolchain: http://pouet.net/prod.php?which=58703.

It's using Full ECS, it seems...
2012-08-22 22:04

8. TB Falsename writes

Just to say that in fact it works just fine on hardware :)
2012-08-22 23:11

9. musashi9 writes

problem solved ;)