English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. Asm / Hardware (https://eab.abime.net/forumdisplay.php?f=112)
-   -   Split screen with a copper list - changing all the colours in time (https://eab.abime.net/showthread.php?t=109566)

deimos 20 January 2022 17:12

Split screen with a copper list - changing all the colours in time
 
I want to do a split screen using the copper, changing the 4 bitplane pointers and the colour registers at the split point.

It looks to me like I don't have time to do that, by the time I've set all 16 colours I'm well into the first row of the lower half of the screen.

Is this a limitation I have to work with, or am I doing it wrong?

I can imagine at least two ways to work around it, either a black line built in, or choosing the order that I change the colours smarterly, or maybe even changing less colours, or changing half of them on the second line so my first line can have something other than blackness.

Hints?

Code:

L000C006: $0005b3f8: $008e,$2c81; DIWSTRT = $2c81
L000C010: $0005b3fc: $0090,$2cc1; DIWSTOP = $2cc1
L000C014: $0005b400: $0092,$0038; DDFSTRT = $0038
L000C018: $0005b404: $0094,$00d0; DDFSTOP = $00d0
L000C022: $0005b408: $0100,$4200; BPLCON0 = $4200
L000C026: $0005b40c: $0102,$0000; BPLCON1 = $0000
L000C030: $0005b410: $0104,$0000; BPLCON2 = $0000
L000C034: $0005b414: $0108,$0078; BPL1MOD = $0078
L000C038: $0005b418: $010a,$0078; BPL2MOD = $0078
L000C042: $0005b41c: $00e0,$0001; BPL1PTH = $0001
L000C046: $0005b420: $00e2,$f058; BPL1PTL = $f058
L000C050: $0005b424: $00e4,$0001; BPL2PTH = $0001
L000C054: $0005b428: $00e6,$f080; BPL2PTL = $f080
L000C058: $0005b42c: $00e8,$0001; BPL3PTH = $0001
L000C062: $0005b430: $00ea,$f0a8; BPL3PTL = $f0a8
L000C066: $0005b434: $00ec,$0001; BPL4PTH = $0001
L000C070: $0005b438: $00ee,$f0d0; BPL4PTL = $f0d0
L000C074: $0005b43c: $0180,$0000; COLOR00 = $0000 
L000C078: $0005b440: $0182,$0fff; COLOR01 = $0fff 
L000C082: $0005b444: $0184,$0f00; COLOR02 = $0f00 
L000C086: $0005b448: $0186,$0f70; COLOR03 = $0f70 
L000C090: $0005b44c: $0188,$0ff0; COLOR04 = $0ff0 
L000C094: $0005b450: $018a,$00f0; COLOR05 = $00f0 
L000C098: $0005b454: $018c,$000f; COLOR06 = $000f 
L000C102: $0005b458: $018e,$0f0f; COLOR07 = $0f0f 
L000C106: $0005b45c: $0190,$0000; COLOR08 = $0000 
L000C110: $0005b460: $0192,$0000; COLOR09 = $0000 
L000C114: $0005b464: $0194,$0000; COLOR10 = $0000 
L000C118: $0005b468: $0196,$0000; COLOR11 = $0000 
L000C122: $0005b46c: $0198,$0000; COLOR12 = $0000 
L000C126: $0005b470: $019a,$0000; COLOR13 = $0000 
L000C130: $0005b474: $019c,$0000; COLOR14 = $0000 
L000C134: $0005b478: $019e,$0000; COLOR15 = $0000 
L000C138: $0005b47c: $bcdf,$fffe; Wait for vpos >= 188 and hpos >= 222
L188C226: $0005b480: $00e0,$0005; BPL1PTH = $0005
L189C004: $0005b484: $00e2,$1058; BPL1PTL = $1058
L189C008: $0005b488: $00e4,$0005; BPL2PTH = $0005
L189C012: $0005b48c: $00e6,$1080; BPL2PTL = $1080
L189C016: $0005b490: $00e8,$0005; BPL3PTH = $0005
L189C020: $0005b494: $00ea,$10a8; BPL3PTL = $10a8
L189C024: $0005b498: $00ec,$0005; BPL4PTH = $0005
L189C028: $0005b49c: $00ee,$10d0; BPL4PTL = $10d0
L189C032: $0005b4a0: $0180,$0f00; COLOR00 = $0f00 
L189C036: $0005b4a4: $0182,$0fff; COLOR01 = $0fff 
L189C040: $0005b4a8: $0184,$0f00; COLOR02 = $0f00 
L189C044: $0005b4ac: $0186,$0f70; COLOR03 = $0f70 
L189C048: $0005b4b0: $0188,$0ff0; COLOR04 = $0ff0 
L189C052: $0005b4b4: $018a,$00f0; COLOR05 = $00f0 
L189C056: $0005b4b8: $018c,$000f; COLOR06 = $000f 
L189C060: $0005b4bc: $018e,$0f0f; COLOR07 = $0f0f 
L189C064: $0005b4c0: $0190,$0000; COLOR08 = $0000 
L189C068: $0005b4c4: $0192,$0000; COLOR09 = $0000 
L189C072: $0005b4c8: $0194,$0000; COLOR10 = $0000 
L189C076: $0005b4cc: $0196,$0000; COLOR11 = $0000 
L189C080: $0005b4d0: $0198,$0000; COLOR12 = $0000 
L189C084: $0005b4d4: $019a,$0000; COLOR13 = $0000 
L189C088: $0005b4d8: $019c,$0000; COLOR14 = $0000 
L189C092: $0005b4dc: $019e,$0000; COLOR15 = $0000 
L189C096: $0005b4e0: $0180,$0fff; COLOR00 = $0fff; <-- * lets me see when I've finished *
L189C100: $0005b4e4: $2cc1,$fffe; Wait for vpos >= 44 and hpos >= 192
L189C108: $0005b4e8: $009c,$8010; INTREQ = $8010
L189C112: $0005b4ec: $ffff,$fffe; End of CopperList


roondar 20 January 2022 17:20

You are correct that you'll likely not have time to do this between lines (assuming OCS and a 320 pixel wide display). You can normally fit 16 Copper move instruction during the Horizontal Blank for such a display*. So if you also want to set 4 bitplane pointers and you need both high and low to be set, it won't fit.

That said, you might be able to still do something if you store your bitplanes cleverly in memory and reduce the screen to 304 pixels wide: if the bitplanes you wish to switch between are located at less than 32768 bytes away in memory, you can also do the switch using the modulo registers instead. That way you'd need only 18 moves rather than the 24 you need at the moment.

However, that does mean having a memory setup where this works. Which will be tricky and almost certainly makes interleaved bitplanes impossible.

*) technically 16,5 IIRC, though there might be a difference between PAL and NTSC here

deimos 20 January 2022 17:36

1 Attachment(s)
Quote:

Originally Posted by roondar (Post 1528050)
You are correct that you'll likely not have time to do this between lines (assuming OCS and a 320 pixel wide display). You can normally fit 16 Copper move instruction during the Horizontal Blank for such a display*. So if you also want to set 4 bitplane pointers and you need both high and low to be set, it won't fit.

That said, you might be able to still do something if you store your bitplanes cleverly in memory and reduce the screen to 304 pixels wide: if the bitplanes you wish to switch between are located at less than 32768 bytes away in memory, you can also do the switch using the modulo registers instead. That way you'd need only 18 moves rather than the 24 you need at the moment.

However, that does mean having a memory setup where this works. Which will be tricky and almost certainly makes interleaved bitplanes impossible.

*) technically 16,5 IIRC, though there might be a difference between PAL and NTSC here

Thanks. I think the best approach for me is to arrange my colour palette and the first line of my lower half so that I can pretend the problem isn't there.

This must have made things interesting for the people doing sliced ham mode stuff back then.

roondar 20 January 2022 17:43

AFAIK sliced HAM gfx didn't update the bitplane pointers between slices, only the colours - so that should still work in the horizontal blanking period.

deimos 20 January 2022 17:44

Quote:

Originally Posted by roondar (Post 1528058)
AFAIK sliced HAM gfx didn't update the bitplane pointers between slices, only the colours - so that should still work in the horizontal blanking period.

Oh of course, 16 moves.

ross 20 January 2022 17:47

Or if you really like crazy stuff, do it with Copper+CPU ;)

deimos 20 January 2022 17:49

Quote:

Originally Posted by ross (Post 1528061)
Or if you really like crazy stuff, do it with Copper+CPU ;)

Let's not go there.

ross 20 January 2022 17:51

Quote:

Originally Posted by deimos (Post 1528063)
Let's not go there.

Wise choice :)

deimos 20 January 2022 17:58

Looking at this with my rational hat near by, I can change 10 colours in time (assuming I don't need to add anything else into the copper list at that point), so there are 6 colours that I either don't change, or design my stuff knowing that they're not ready at the start of that first line. That doesn't sound like much of a hardship.

ross 20 January 2022 18:07

There is also another trick you can use regarding bitplane pointers and that is to modify only the top of the register(s).
If the splitted bitmap is exactly 64k (or multiple) away from the value present in the ptrs prior to the split then you can modify only 4 registers.

deimos 20 January 2022 18:18

Quote:

Originally Posted by ross (Post 1528070)
There is also another trick you can use regarding bitplane pointers and that is to modify only the top of the register(s).
If the splitted bitmap is exactly 64k (or multiple) away from the value present in the ptrs prior to the split then you can modify only 4 registers.

I'm not going there. 'Tis a silly place.

a/b 20 January 2022 18:27

There are several ways to limit the number of copper moves to set bitplane pointers:
- have all bitplanes within a single 64KB bank (e.g. $6xxxx), so that all the upper words are constant and you only have to change 4 lower words, or
- have both bitmaps 64KB aligned (e.g. $60000 and $70000), so that all the lower words are constant and you only have to change 4 uppper words.
You can use AGA colorbank swaping or OCS/ECS 7-bitplanes trick to swap all 16 colors with a single copper move:
- set bplcon0 to $4200 if AGA, $7200 otherwise,
- set bpl6dat to 0 to cancel half-bright mode,
- set bpl5data to $0000 to activate colors 0-15 or $ffff to activate colors 16-31.

deimos 20 January 2022 18:32

Quote:

Originally Posted by a/b (Post 1528078)
You can use AGA colorbank swaping or OCS/ECS 7-bitplanes trick to swap all 16 colors with a single copper move:
- set bplcon0 to $4200 if AGA, $7200 otherwise,
- set bpl6dat to 0 to cancel half-bright mode,
- set bpl5data to $0000 to activate colors 0-15 or $ffff to activate colors 16-31.

So, pretending to be in 6bp mode, but forcing in all zeros or all ones? Am I understanding?

The drawback would be losing control of the colours that you'd use for sprites though, wouldn't it?

a/b 20 January 2022 18:38

Yes, bitplane DMA will fill in bpldat1-4, but all 6 bitplanes will be active so you can then change bpldat5-6 manually with cpu/copper at any time.
If you are using sprites, yeah bad luck then as they are using colors 16-31 ;P.

deimos 20 January 2022 18:46

Quote:

Originally Posted by a/b (Post 1528082)
Yes, bitplane DMA will fill in bpldat1-4, but all 6 bitplanes will be active so you can then change bpldat5-6 manually with cpu/copper at any time.
If you are using sprites, yeah bad luck then as they are using colors 16-31 ;P.

I think I'd rather work around the limitations of a few colours being unavailable for a few dozen pixels.

The hardest part will be explaining the limitations to the person who draws the graphics for me.

a/b 20 January 2022 19:07

And I forgot one obvious thing when it comes to bitplanes, you can typically achieve the same by only changing the modulos, but since I don't know the details (you seem to have the bitmaps quite apart, more than 16-bit modulos can ever handle) it's hard to tell.

deimos 20 January 2022 19:13

Quote:

Originally Posted by a/b (Post 1528092)
And I forgot one obvious thing when it comes to bitplanes, you can typically achieve the same by only changing the modulos, but since I don't know the details (you seem to have the bitmaps quite apart, more than 16-bit modulos can ever handle) it's hard to tell.

Roondar did mention the modulo option, but, really, "just don't use these 6 colours in the first quarter of the first line" seems like a much easier thing. To me, the muppet writing the code, anyway.

ross 20 January 2022 19:43

Quote:

Originally Posted by a/b (Post 1528078)
You can use AGA colorbank swaping or OCS/ECS 7-bitplanes trick to swap all 16 colors with a single copper move..

This always made me think about what a huge wasted opportunity in the design phase to use only the BPU bits and not a mask for selective activating the bpl DMA channels :rolleyes

EDIT:
removed my reply to another user in a multi-quote deleted message, perhaps the user prefers it that way

pandy71 20 January 2022 23:39

Another solution is to not use all 'new' colors in first line - with careful sorting what colors need to appear as first you may use two slots to alter all 16 CLUT entries.
This apply to last line with 'old' colors - perhaps no all CLUT entries need to be used so you can distribute change across few lines.

mc6809e 21 January 2022 00:57

Quote:

Originally Posted by ross (Post 1528061)
Or if you really like crazy stuff, do it with Copper+CPU ;)

Don't even need the copper. There are enough cycles for a pair of movem.l instructions -- one for the bitplane pointers and one for the color registers.

CPU registers must be preloaded of course.


All times are GMT +2. The time now is 12:26.

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

Page generated in 0.04871 seconds with 11 queries