English Amiga Board

Go Back   English Amiga Board > Coders > Coders. General

Thread Tools
Old 21 May 2011, 22:57   #21
Photon's Avatar
Join Date: Nov 2004
Location: Hult / Sweden
Posts: 4,589
From the original post I got that you want a screen buffer to do graphics in? But also that you want to learn hardware and aren't quite at the stage where you do advanced routines? (Just tell me if I got you wrong.)

You can do all that with graphics.library, check for example SystemStartup.S in the Examples dir on any Asm-One disk image.

(I'm assuming you're on Workbench 1.2-3.1, although library coding on later OS versions shouldn't be too cumbersome.)

But if you want to do it the hardware way (see NonSystemStartup.S on a similar such disk image ), you do pretty much what you did above, just start a copper and change some colors, then read up on the bitplane pointer & modulo registers and point them (with the copper) to some free (or allocated by you) area of memory that you can poke with pixels But you should turn off some interrupts to prevent the OS from regularly resetting the display, so you can see *your screen* all the time. A startup source does that for you.

You still need graphics.library (but only to restore the system copper (for the assemblers that don't do it for you)), that's what Stingray's startup 'exit code' does. His startup should be a good start for experimenting, you'll get the hang of what his code does later on.

Going OS or going hardware... it all boils down to what you want to code later. If the programs are supposed to be 'Workbench icons programs', go with OS programming.

I hope this gives a sort of outline to getting started.

(If you do plan to go hardware I recommend Asm-One, since it has a good debugger and is more made for HW programming than many others. I use V1.20.)

Once you have a copper pointing to some screen bitplanes, you can just fill that memory area with zeroes to clear it and then copy bytes or something from a font converted to raw to write text on it.

Here's an example: (All from memory so may have errors. But I don't think so. I have ECC.)

s=$70000	;screen start
e=s+320/8*256	;1 bitplane 320x256 resolution
;----insert at start of copper
	dc.w $e0,s/65536	;addr hi word
	dc.w $e2,s&65535	;addr lo word
	dc.w $108,0		;modulo
	dc.w $10a,0		;modulo
	dc.w $8e,$2881		;upper left corner
	dc.w $90,$28c1		;lower right corner
	dc.w $92,$38		;left edge
	dc.w $94,$d0		;right edge
	dc.w $100,$1200		;1 bitplane, color burst enabled
	dc.w $180,0		;black background
	dc.w $182,$f00		;red 'ink' color
And a Speccy style clearscreen (blit is faster once you learn it)

	move.l SP,a0		;save stack pointer
	move.l #0,d0		;fill-value
	lea e,SP		;point to end of screen
	REPT (e-s)/4		;repeat "screensize in bytes divided by four since we poke longwords" times
	move.l d0,-(SP)
	move.l a0,SP		;restore
Don't use delays; after you have initialized your screen and before the exit-code that restores it, insert

	btst #6,$bfe001
	bne waitmouse

Now go bang the hardware, hehe.

Last edited by Photon; 21 May 2011 at 23:34.
Photon is offline  

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple chunky 2D Graphics Library needed in C NovaCoder Coders. General 4 19 December 2011 13:39
graphics.library 40.25 beta series Cosmos Coders. General 337 22 July 2011 19:15
Some question about graphics.library lowlevels Sonic Coders. General 3 28 July 2010 12:45
graphics.library private LVO's AmiCoder Coders. General 12 30 December 2009 05:24
Can't open version 36 of graphics.library Lambizkit support.Apps 1 07 November 2007 09:00

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 14:53.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.05721 seconds with 13 queries