29 June 2024, 11:12 | #1 |
Registered User
Join Date: Dec 2007
Location: Aarhus / Denmark
Posts: 44
|
Does disabling copper DMA stop the copper?
If copper DMA is disabled, and I enable it mid-frame, does the copper continue immediately from where it left off, or does it stay paused until the next vblank (or write to COMJMP)?
Does the behavior perhaps depend on what the copper was doing when DMA was turned off, and/or whether a vblank has happened in the meantime? |
29 June 2024, 11:41 | #2 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,501
|
DMACON bits toggle the DMA channels from 'idle' mode to 'active' mode.
So yes, the Copper simply pause and then continue from where it was. With one exception, that is, if a new video frame started. In this case by setting the bit the copper starts from the beginning; or rather, from the address present in COP1LC. |
29 June 2024, 12:09 | #3 |
Registered User
Join Date: Dec 2007
Location: Aarhus / Denmark
Posts: 44
|
I feared as much.
My use case is I want to use all of chip memory for my demo. If I just disable copper DMA, initialize chip memory, set COP1LC and then enable copper DMA, the copper might execute whatever is now in the place where the system copperlist was. If I wait a frame after setting COP1LC before enabling copper DMA, it might execute my copperlist immediately, rather than waiting for the next vblank as desired. It seems this requires some dance, like, point COP1LC to an FFFFFFFE longword, wait a frame, point COP1LC to my proper copperlist, then enable copper DMA. Any ideas for a simpler way to achieve this? |
29 June 2024, 12:10 | #4 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,501
|
Furthermore, since you mentioned COPJMP, it is better to clarify its functioning to avoid unwanted effects (too often in demos its 'abuse' leads to problems, it should be used with caution..).
Copper's Program Counter is internally just one and COP1LC/COP2LC are just buffers that contain values that can be 'pushed' in it. But in only one case the insertion is automatic (and only for COP1LC), that when a new vblank is happening. In the remaining cases it can be done manually through COPJMPx, even with active Copper DMA (non in Wait state). And the latter situation can also lead to video glitches (in the best case scenario) or even a machine crash in particular conditions (there is a description of this case on EAB somewhere, search for Copper Wait/Blitter bug or similar..). That said, a correct use is to set COP1LC during the frame and let the system automatically insert the value for the next vblank. In the meantime you can change LCs and stop the Copper as you like EDIT: I hadn't read your message above yet, but I basically replied to you in this |
29 June 2024, 12:17 | #5 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,501
|
|
29 June 2024, 12:22 | #6 |
Registered User
Join Date: Dec 2007
Location: Aarhus / Denmark
Posts: 44
|
|
29 June 2024, 12:27 | #7 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,501
|
Quote:
It's a few cycles at most! I can't imagine such a case, but I don't know what you want to do with your CPU/Copper code... EDIT: hmm, maybe you fill the chip memory with Copper Moves? And this need to start exactly at vblank? But why? I'm curious now Last edited by ross; 29 June 2024 at 12:33. Reason: typos... |
|
29 June 2024, 12:46 | #8 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,501
|
I offer you a dirty alternative, but I don't know if you at least have location 0 available.
Usually contains 0*, but you can also put the value $FFFFFFFE and then reset it to 0 at program exit. Set COP1LC=0 ant COPJMP1 immediately (don't turn off the Copper). Fill the chip memory as much as you like and then finally set the correct value for Copper PTR. Then you definitely get what you wanted. *Copper HALT (it re-start and re-HALT at next vblank) |
29 June 2024, 13:18 | #9 |
Registered User
Join Date: Dec 2007
Location: Aarhus / Denmark
Posts: 44
|
Even if I have no locations available, I can do:
- Put $FFFFFFFE temporarily somewhere and point COP1LC to it. - Wait for vblank. - Set correct COP1LC. - Restore the $FFFFFFFE to what I wanted to have there. Interesting. I thought 0 was a copper no-op (move to dummy address). |
29 June 2024, 13:24 | #10 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,501
|
Quote:
Not only 0, all Copper 'opcodes' that do a Move on 'protected' RGA registers (i.e. the usuals with CDANG=0) |
|
Yesterday, 10:58 | #11 |
Registered User
Join Date: Apr 2023
Location: "Hamcastle"
Posts: 26
|
The thread reminded me of a question that is lingering in my mind...If copper DMA is off and vertical blanking occurs which copper list will then be executed when copper DMA is turned on?: 1) The one that was in $dff080 at the time of vertical blanking or 2) can you reload $dff080 with another copper list at a later beam position before copper DMA is turned on and then this copper list will be executed?
According to some tests a while ago, case 2) seems to hold true which is a bit confusing to me since I seem to remember an EAB thread that sounded to me more like case 1) should be true. |
Yesterday, 11:53 | #12 | |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,649
|
Quote:
|
|
Yesterday, 12:02 | #13 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,073
|
This is how I look at it: copper doesn't need DMA to access its $dffxxx registers, so it should always have access to the latest coplc0/1 and detect the writes to copjmp0/1. Turning DMA off only prevents it from fetching copperlist instructions.
|
Yesterday, 14:29 | #14 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,366
|
For what the OP wants, i think there is another solution :
- stop copper DMA - fill chip mem - setup COP1LC to coplist you want to execute - setup COP2LC to some FFFF FFFE (there should be one somewhere now ?) - hit COP2JMP - start copper DMA |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Copper WAIT, copper SKIP and $80/$100 vpos problem | defor | Coders. Asm / Hardware | 2 | 23 July 2021 08:32 |
Combining copper scrolling with copper background | phx | Coders. Asm / Hardware | 16 | 13 February 2021 12:41 |
Copper, Horizontal Blanking, and DMA | AlexBruger | support.Hardware | 5 | 19 July 2020 17:31 |
Copper instructions and dma | Jherek Carnelia | Coders. Asm / Hardware | 4 | 05 December 2019 22:33 |
Best way to mix blitting with copper and copper effects | roondar | Coders. Asm / Hardware | 3 | 12 September 2016 13:12 |
|
|