Archived

This topic is now archived and is closed to further replies.

Vanukoff

Direct Draw 8Bit "copper" effects ...

Recommended Posts

Anyone whose seen an old Amiga demo knows what I am talking about. A trick where they made a palette change every scan line, to make horizontal rainbow backgrounds and whatnot, using just one palette entry. This trick was used in Turrican 2 for the background/sky in the first world, and in other games for similar effects. Anyway, is there any way to do something like this with Direct Draw? Back when I programmed DOS/VGA I once simulated it by drawing 200 horizontal lines on the screen, each one a different palette index, then I just updated the first 200 palette entries once per frame, to do cool rainbowey effects. But I don''t want to give up 200 entries just for a rainbow background. Anyway to do a palette entry change every scan line? Maybe every other scan line? (I know, just use 16/24 bpp - but I have an older computer, and not ready to jump into 16/24 bpp just yet)

Share this post


Link to post
Share on other sites
G''day!

There''s no way to do this with DirectDraw. You''d need to poke the graphics card directly and I think you''d need to drop into DOS to do that and you''d probably need register specs for your card.

At the time tricks like that made the Amiga the most amazing graphics computer of its time, but that time is long past. To be honest you wouldn''t really gain anything by doing this (other than the cool-factor).

16-bit isn''t really much harder than 8-bit, and 32-bit is even easier than 16 and not much slower.


Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites
It wasn''t actually a "trick" as such, just a function of the Amigas hardware.

The Copper was a genuine co-processor syncronised to the scanline hardware. It had 3 (IIRC) instructions, WAIT, MOVE and SKIP. WAIT would wait in the copperlist program for a particular vertical and even horizontal scanline to be reached before continuing.

SKIP allowed some degree of conditional operation where you could skip over statements.

MOVE moved immediate data into one of the Amigas custom hardware registers.

To do things like copper bars and plasma the copper program consisted of a few simple WAIT and MOVE calls (pseudo-code):


WAIT 100,0 ; wait for scanline 100 (v=100, h=0)
MOVE $200,$0180 ; $dff0180 = color0 register
WAIT 102,0 ; wait for scanline 102 before continuing
MOVE $800,$0180 ; once at 102, change color0 again
WAIT 108,0
MOVE $F00,$0180
WAIT 114,0
MOVE $800,$0180
WAIT 118,0
MOVE $200,$0180
WAIT 120,0
MOVE $000,$0180
$FFFF,$FFFF




On PC''s theres no way to reliably wait for an exact scanline and change a palette register - about the best you can do is get a vsync interrupt and try and guess how long it''ll take for the scanline to reach a particular point of the screen and wait until then... on your hardware (people used to do that on the C64 for hardware defying split screens etc

On multitasking, multiprocessing, hardware video accelerated PCs it definately isn''t practical.

But do remember that the PC does have a stupidly fast CPU (compared to platforms of yesteryear) so your best bet is to modify the actual pixels in the backbuffer inside a Lock if you want a similar effect..

..or start thinking in terms of 3D hardware and what it does well - with gouraud shading, colours get smoothly interpolated across a polygon, so you can simulate the same with polys

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites