; Setting up a simple copperlist + 1 Bitplane + 
; a simple Textengine!  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

	move.l #text,a0		; Adress of our text to a0
	move.l #0,d0		; Start X Value
	move.l #90,d1		; Start Y Value
	bsr.w print		; Call Textroutine

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!

; Little Textout-Routine, not optimised, just for explanation
; A0 = ptr to text, D0 = Start X Value, D1 = Start Y Value

print:	move.b (a0)+,d3		; Get current letter
	cmp.b #1,d3		; Check for newline? 
	bne.b nope		; Nah? Continue...
	moveq #0,d0		; Otherwise.., X Value = 0 again and
	addq.l #8,d1		; Y Value + 9
	bra.b print		; Start from beginning
nope:	tst.b d3		; End of text reached?
	beq.b later		; Okay, quit print routine
	lea chartab(pc),a1	; Adress of chartab to a1
	moveq #0,d2		; Counter
search:	cmp.b (a1,d2),d3	; Find letter in chartab
	beq.b foundit		; Letter found? Go on...
	addq.l #1,d2		; ..else increase counter
	bra.b search		; and continue searching
foundit:lsl.l #3,d2		; counter*8 = correct offset to charbuffer
	lea chars(pc),a3	; Address of chars to a3
	add.l d2,a3		; + offset to correct letter
	lea bitplane(pc),a2	; Address of bitplane to a2
	move.l d1,d2		; Current Y Value to d2
	muls.w #40,d2		; Multiply Y Value by 40...
	add.l d0,d2		; ... + X Value 	
	add.l d2,a2		; a2 now points to correct x/y position
	moveq #8-1,d2		; Height of chars (-1 coz we use dbf loop)
copy:	move.b (a3)+,(a2)	; Copy the letter
	add.l #40,a2		; 
	dbf d2,copy		;
	addq.l #1,d0		; Increase X Value
	bra.b print		; Continue with next letter
later:	rts			; Return to where we came from ;)

; 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,$0fae			; Color01 = pink?
		dc.w	$ffff,$fffe

text:		dc.b	"       * simple textroutine *",1
		dc.b	1
		dc.b	"          flashtro rulez!!",0

chartab: 	dc.b 	"abcdefghijklmnopqrstuvwxyz!"	; chars as they appear
		dc.b 	"0123456789*-. "		; in our char table

chars:		dc.b	$00,$7C,$E6,$E6,$FE,$E6,$E6,$06	;"A"
		dc.b	$00,$FC,$E6,$FC,$E6,$E6,$FC,$00	;"B"
		dc.b	$00,$7E,$E6,$E0,$E0,$E6,$7E,$00	;"C"
		dc.b	$00,$FC,$E6,$E6,$E6,$E6,$FC,$00	;"D"
		dc.b	$00,$FE,$E6,$F8,$E0,$E6,$FE,$00	;"E"
		dc.b	$00,$FE,$E6,$F8,$E0,$E0,$E0,$E0	;"F"
		dc.b	$00,$7C,$E0,$EE,$E6,$E6,$7E,$00	;"G"
		dc.b	$E0,$E6,$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,$FC,$00	;"5"
		dc.b	$00,$7C,$E0,$FC,$E6,$E6,$7C,$00	;"6"
		dc.b	$00,$FE,$CE,$1C,$38,$38,$38,$38	;"7"
		dc.b	$00,$7C,$E6,$7C,$E6,$E6,$7C,$00	;"8"
		dc.b	$00,$7C,$CE,$CE,$7E,$0E,$7C,$00	;"9"
		dc.b	$00,$66,$FF,$FF,$7E,$3C,$18,$00	;"*"
		dc.b	$00,$00,$00,$00,$FE,$00,$00,$00	;"-"
		dc.b	$00,$00,$00,$00,$00,$38,$38,$00	;"."
		dc.b	$00,$00,$00,$00,$00,$00,$00,$00 ;" "

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

Publication author

offline 2 weeks

mus@shi9

0
Comments: 1160Publics: 2780Registration: 06-03-2017

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
stu
stu
18 years ago

so sad i missed the golden years and ended up on a 386

0
aLpHa oNe
18 years ago

This is amiga, stu 😉

0
stu
stu
18 years ago

btw can you compiler this with tasm.exe ?

0
stu
stu
18 years ago

change to mode 13

mov ax,13
int 10h

change the border and background on a commodore 64
poke 543280,0: poke 543281,0

thats about all i remember 🙂

0
Authorization
*
*

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Registration
*
*
*

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Password generation

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

0
Would love your thoughts, please comment.x
()
x