English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   Coders. Asm / Hardware (http://eab.abime.net/forumdisplay.php?f=112)
-   -   skipping parts of a static copperlist... (http://eab.abime.net/showthread.php?t=94182)

Steril707 11 September 2018 10:35

skipping parts of a static copperlist...
 
Is there any way to skip parts of a static copperlist (means one, that I am not dynamically constructing myself with code on runtime) based on some condition?

ross 11 September 2018 11:18

The easiest thing that comes to mind is to set COP1LCx and then strobe COPJMPx, overwriting the first words part of the copper list you want to skip.

Steril707 11 September 2018 15:39

That sounds like a nice idea..

Will have a look into it.. thanks, ross... :)

Photon 21 September 2018 17:03

That's not a conditional, though, you'd have to poke the destination address with code calculating it from the condition.

There's the SKIP instruction, but it's of limited use.

FSizzle 22 September 2018 03:43

Take care to either write both the high and low address for the jmp destination, OR make sure the jmp destination is in the same 64KiB aligned block as the copper list start address if you only set the low word to save cycles.

Steril707 27 October 2019 15:00

Some thoughts here, please correct me if I am wrong..

Could I strobe COPJMP2 when the part of the copperlist gets executed where I want to jmp over the next few instructions to the place thats written in COP2LCH/L?

example in pseudo code:

("jumpAdress" is written to COP2LCH/L at the initialization of the code,

move.l #jumpAdress,a6
move.l a6,Cop2lch
)

Code:

        ;some copper list stuff
        dc.w $0180,$0000
        dc.w $0182,$0000
        dc.w $0184,$0000
        dc.w $0186,$0000
        dc.w $0188,$0000
        dc.w $018a,$0000
        dc.w $018c,$0000
        dc.w $018e,$0000

        dc.w $008a,$0000  ;here I strobe COPJMP2, so we jump to "jumpAdress" in our copper list and don't execute the next commands

        dc.w $0190,$0000
        dc.w $0192,$0000
        dc.w $0194,$0000
        dc.w $0196,$0000
        dc.w $0198,$0000
        dc.w $019a,$0000
        dc.w $019c,$0000
        dc.w $019e,$0000

jumpAdress:        ;here we jump to
        dc.w $3d0f,$fffe
        dc.w $0100,$4200


On my condition check I would then simply overwrite that COPJMP2 statement with something harmless if I want to execute the stuff after the COPJMP2 instruction..

Would this work the way intended?

deimos 27 October 2019 15:38

Similar things have been done. The trick is setting cop2lc at a safe time to do so. You'll never have any real condition checking within your copper list, it all has to happen in your main code, and timed to happen when it's safe to change cop2lc, which may well limit you to once per screen refresh. Unless you're actually branching out to dynamically generated code it may not be worth the effort.

Steril707 27 October 2019 15:48

Yep, I wanna check that in my main code once per frame and not within the copper list (I wouldn't have any idea how to do that, anyway)

At the moment if I have the COPJMP2 executing in the copperlist, it starts showing me a corrupted workbench screen, and not my game anymore..

Very strange...

ross 27 October 2019 16:03

Quote:

Originally Posted by Steril707 (Post 1354487)
At the moment if I have the COPJMP2 executing in the copperlist, it starts showing me a corrupted workbench screen, and not my game anymore..

Very strange...

Are you sure COP2LC is ever set?
Corrupted WB visible is a symptom of an old value buffered in pointer register.
(screens use COP2 for splits)

deimos 27 October 2019 16:08

Quote:

Originally Posted by Steril707 (Post 1354487)
Yep, I wanna check that in my main code once per frame and not within the copper list (I wouldn't have any idea how to do that, anyway)

At the moment if I have the COPJMP2 executing in the copperlist, it starts showing me a corrupted workbench screen, and not my game anymore..

Very strange...

Well, the idea works, I'm using it myself. What is happening in the place that COPLC2 is pointing to? Does it return to the main copper list with another jump? What if you try just making it go to sleep "$ffff, $fffe"?

Edit: Didn't realise ross was about - listen to him, he taught me everything I know (about copper lists).

Steril707 27 October 2019 16:19

I am not "returning" to a copper list.
I have just one copper list, and all I wanna do is skip a part of it by doing this copjmp thing.

So, at the beginning of the frame, in my main code I load up Cop2lc with the adress where i wanna jump to in the copper list, and i put a copjmp2 into the copper list at the place where i wanna jump...

Is this wrong?

deimos 27 October 2019 16:26

Quote:

Originally Posted by Steril707 (Post 1354500)
I am not "returning" to a copper list.
I have just one copper list, and all I wanna do is skip a part of it by doing this copjmp thing.

So, at the beginning of the frame, in my main code I load up Cop2lc with the adress where i wanna jump to in the copper list, and i put a copjmp2 into the copper list at the place where i wanna jump...

Is this wrong?

No, not wrong, that's me thinking about how I did mine.

You say "at the beginning of the frame". Can you expand on that, because I had problems caused by doing things at what I thought were the right time, even though they were actually the wrong time.

ross 27 October 2019 16:27

In the first part of IRQ3/VBI handler (before video line $18!) I would check the choice condition for the sub-list and write the NULL or COPJMP2 value at 'switch:'

Copper list:

Code:

COP1_start:
        dc.w $00e0,$0000
        .. general setup

        dc.w $1807,$fffe        ;<---
        dc.w $0120,$0000
        -- sprites setup
       
        ;some copper list stuff
        dc.w $0180,$0000
        dc.w $0182,$0000
        dc.w $0184,$0000
        dc.w $0186,$0000
        dc.w $0188,$0000
        dc.w $018a,$0000
        dc.w $018c,$0000
        dc.w $018e,$0000

switch: dc.w $008a,$0000          ;or $01fe,$0000 (NULL)

        dc.w $0190,$0000
        dc.w $0192,$0000
        dc.w $0194,$0000
        dc.w $0196,$0000
        dc.w $0198,$0000
        dc.w $019a,$0000
        dc.w $019c,$0000
        dc.w $019e,$0000

jumpAdress:
        ;here we jump to
        dc.w $3d0f,$fffe
        dc.w $0100,$4200

EDIT: in fact I could leave what I had written the first time, it wasn't the OP's request but equally interesting ;)

Steril707 27 October 2019 17:11

Seems I can do whatever I want, it won't work.

If I put

setCopLC:
dc.w $0084,$0000
dc.w $0086,$0000

before

dc.w $008a,$0000

at least it jumps somewhere else than the workbench, it seems.

But setting those values with

move.l #setCopLC,a0
move.l #jumpAdress,d0
move.w d0,6(a0)
swap d0
move.w d0,2(a0)

doesn't do anything...

*scratching my head*


ADD/EDIT: okay, it works now.. seems I was just too dumb to notice that my copperlist isn't "sufficient" with the skipped part and looks weird as a result..
Thanks, Ross (and Deimos)..
Happy coding!


All times are GMT +2. The time now is 23:44.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.

Page generated in 0.04498 seconds with 11 queries