English Amiga Board


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

 
 
Thread Tools
Old 20 January 2022, 17:12   #1
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
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
deimos is offline  
Old 20 January 2022, 17:20   #2
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,408
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
roondar is offline  
Old 20 January 2022, 17:36   #3
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by roondar View Post
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.
Attached Thumbnails
Click image for larger version

Name:	colours.png
Views:	95
Size:	8.7 KB
ID:	74484  
deimos is offline  
Old 20 January 2022, 17:43   #4
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,408
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.
roondar is offline  
Old 20 January 2022, 17:44   #5
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by roondar View Post
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.
deimos is offline  
Old 20 January 2022, 17:47   #6
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Or if you really like crazy stuff, do it with Copper+CPU
ross is offline  
Old 20 January 2022, 17:49   #7
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by ross View Post
Or if you really like crazy stuff, do it with Copper+CPU
Let's not go there.
deimos is offline  
Old 20 January 2022, 17:51   #8
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by deimos View Post
Let's not go there.
Wise choice
ross is offline  
Old 20 January 2022, 17:58   #9
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
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.
deimos is offline  
Old 20 January 2022, 18:07   #10
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
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.
ross is offline  
Old 20 January 2022, 18:18   #11
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by ross View Post
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.
deimos is offline  
Old 20 January 2022, 18:27   #12
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,039
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.
a/b is offline  
Old 20 January 2022, 18:32   #13
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by a/b View Post
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?
deimos is offline  
Old 20 January 2022, 18:38   #14
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,039
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.
a/b is offline  
Old 20 January 2022, 18:46   #15
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by a/b View Post
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.
deimos is offline  
Old 20 January 2022, 19:07   #16
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,039
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.
a/b is offline  
Old 20 January 2022, 19:13   #17
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by a/b View Post
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.
deimos is offline  
Old 20 January 2022, 19:43   #18
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
Quote:
Originally Posted by a/b View Post
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

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

Last edited by ross; 20 January 2022 at 20:00.
ross is offline  
Old 20 January 2022, 23:39   #19
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL?
Posts: 2,743
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.
pandy71 is offline  
Old 21 January 2022, 00:57   #20
mc6809e
Registered User
 
Join Date: Jan 2012
Location: USA
Posts: 372
Quote:
Originally Posted by ross View Post
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.
mc6809e 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
Scroll/horizontal delay issue (with copper split) chadderack Coders. Asm / Hardware 8 22 October 2021 13:50
changing colours in c64 forever honx support.Amiga Forever 9 29 March 2019 21:03
DblPAL vs changing the screen bitmap using Copper BSzili Coders. System 2 23 August 2016 14:49
double copper colours turrican3 support.WinUAE 12 19 January 2016 11:20
Changing colours in CLI? Dreedo support.Other 2 09 January 2011 01:02

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 00:07.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.10010 seconds with 14 queries