English Amiga Board

Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

Thread Tools
Old 08 September 2016, 12:51   #1
Registered User

Join Date: Jul 2015
Location: The Netherlands
Posts: 3,297
Question Best way to mix blitting with copper and copper effects

I've been tempted lately (http://eab.abime.net/showthread.php?t=83043) to adapt my blitter routines to start the blitter using the copper instead of using the CPU.

But I'm running into a problem to solve and I'm wondering how other people deal with this. I've tried searching the forums and google, but can't seem to find any real information on it.

The problem is mixing copper effects (which usually need to be done at an exact beam position) and blitter waits using the copper (which could end at differing beam positions depending on DMA bus utilisation).

There are basically four main issues here and I've not solved them yet:
  1. Playing modules usually means using a CIA interrupt, which can happen anywhere during a frame (seems to me this stops blitter nasty from being usefull, unless module players don't care about latencies that could end up being a dozen scanlines or more)
  2. Even without interrupts, CPU usage will vary from frame to frame anyway - which makes predicting how long a blit lasts harder (unless you use blitter nasty mode, which in my experience tends to slow down things if the CPU is still doing useful work)
  3. Waiting on the blitter could end up taking so much time a copper effect gets pushed 'down'. This is generally not really acceptable.
  4. Some copper effects might have varying positions from frame to frame, which blitter waits have to take into account.
Now, I have not made any actual code yet (because I'm not sure how to fix the above and I'd like to have at least a basic idea before I get started). So my question is mainly: is there a 'best practice' for these kind of problems and are there any pointers anyone can give me to start tackling this?

I'd be grateful for any help here

Edit: the idea would be to use this technique on a basic OCS system, so no AGA or fastmem

Edit 2:
I've been thinking a bit and am now considering a copper list that's somewhat like this:

<set up blit 1>
WAIT blitter_finished
<set up blit 2>
WAIT blitter_finished
<set up blit 3>
SKIP VHPOS = effect_VHPOS-copper_skip_time-copper_wait_time
WAIT blitter_finished
WAIT VHPOS = effect
<set up blit 4>
WAIT blitter_finished
<set up blit 5>
SKIP VHPOS = next_effect_VHPOS-copper_skip_time-copper_wait_time
WAIT blitter_finished
WAIT VHPOS = next_effect
The idea being that the SKIP instruction can be used to allow the copper to execute the effect on time. However, this will only work if the blits running prior to the last blit running before an effect are never going to be delayed so much that the effect should've already happened.

I wonder if this is a viable approach?

Last edited by roondar; 08 September 2016 at 16:36.
roondar is offline  
Old 12 September 2016, 01:40   #2
Registered User
Lazycow's Avatar
Join Date: Oct 2014
Location: Germany
Posts: 194
Hi roondar,

you want to have the fastest blitter access while maintaining the highest flexibility. I don't think this is possible.

Either you want to have some super-effect on the Amiga, then you can try to finetune the copper, the blitter, the CPU and everything. But then the system is optimized to this effect and you lose your flexibility.

Or you want to have dynamic actions on the Amiga, then you can use the copper, the blitter, the CPU and everything dynamicly. But you have to isolate them to maintain the flexibility, which effectively preludes the use of dependant optimisations.

My hint for you is: Don't focus too much on optimizing the last cycles at blitter and copper control. Usually, the biggest potential for optimisations is located at the hligher levels of the algorithm.
Lazycow is offline  
Old 12 September 2016, 05:32   #3
Total Chaos forever!

Samurai_Crow's Avatar
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 48
Posts: 1,965
Agreed. Remember that Graphics.library uses an interrupt to queue the blitter. If you want to bang the blitter hardware and use the same interrupt, use QBlit.
Samurai_Crow is offline  
Old 12 September 2016, 14:12   #4
Registered User

Join Date: Jul 2015
Location: The Netherlands
Posts: 3,297
I'm slowly comming round to that idea as well. I do tend to get a bit 'obsessed' with micro-optimisations, which is not always usefull.

Thanks for the advice.

As is, I've more or less decided to drop the copper blitting idea for now and I may or may not change my simple blitter code for an interrupt based approach instead (not for performance, but for easy of use and a personal preference to do so).
roondar 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
Combining copper scrolling with copper background phx Coders. Asm / Hardware 16 13 February 2021 13:41
Copper timing yaqube Coders. General 61 08 April 2019 01:41
copper ? turrican3 Coders. Asm / Hardware 10 27 January 2016 10:10
Copper Effects With PAL Filter Leandro Jardim support.WinUAE 1 08 April 2011 08:56
Stuck with copper example cosmiq Coders. General 6 17 October 2008 23:29

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 11:05.

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