English Amiga Board


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

 
 
Thread Tools
Old 14 December 2018, 15:31   #1
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 868
Copper display problem

Hi all,

I'm trying to add some simple display separation using the copper, what I mean by that is...

At vertical line 26 set bitplane pointers to screen address a (upper panel)

At veritcal line 40 set bitplane pointers to screen address b (main)

Straight forward I thought. However, when I try to do this the main display gets screwed and I can't put my finger on what is going on although it's possibly some timing issue somewhere.

Here is a working copper.. without the wait line...

Code:
 001d25d0: 01fc 0005            ;  FMODE := 0x0005
 001d25d4: 0092 0038            ;  DDFSTRT := 0x0038
 001d25d8: 0094 00d0            ;  DDFSTOP := 0x00d0
 001d25dc: 1a01 ff00            ;  Wait for vpos >= 0x1a, , ignore horizontal
                                ;  VP 1a, VE 7f; HP 00, HE 00; BFD 1
 001d25e0: 0120 000e            ;  SPR0PTH := 0x000e
 001d25e4: 0122 9954            ;  SPR0PTL := 0x9954
 001d25e8: 00f8 000e            ;  BPL7PTH := 0x000e
 001d25ec: 1908 9954            ;  BPL1MOD := 0x9954
 001d25f0: 0128 000e            ;  SPR2PTH := 0x000e
 001d25f4: 012a 9954            ;  SPR2PTL := 0x9954
 001d25f8: 012c 000e            ;  SPR3PTH := 0x000e
 001d25fc: 012e 9954            ;  SPR3PTL := 0x9954
 001d2600: 0130 000e            ;  SPR4PTH := 0x000e
 001d2604: 0132 9954            ;  SPR4PTL := 0x9954
 001d2608: 0134 000e            ;  SPR5PTH := 0x000e
 001d260c: 0136 9954            ;  SPR5PTL := 0x9954
 001d2610: 0138 000e            ;  SPR6PTH := 0x000e
 001d2614: 013a 9954            ;  SPR6PTL := 0x9954
 001d2618: 013c 000e            ;  SPR7PTH := 0x000e
 001d261c: 013e 9954            ;  SPR7PTL := 0x9954
>o
 001d2620: 008e 27a1            ;  DIWSTRT := 0x27a1
 001d2624: 0090 2698            ;  DIWSTOP := 0x2698
 001d2628: 0100 0211            ;  BPLCON0 := 0x0211
 001d262c: 0102 44ff            ;  BPLCON1 := 0x44ff
 001d2630: 0104 0030            ;  BPLCON2 := 0x0030
 001d2634: 010c 0011            ;  BPLCON4 := 0x0011
 001d2638: 0108 009c            ;  BPL1MOD := 0x009c
 001d263c: 010a 009c            ;  BPL2MOD := 0x009c
 001d2640: 0106 0c00            ;  BPLCON3 := 0x0c00
 001d2644: 0180 0000            ;  COLOR00 := 0x0000
 001d2648: 0106 0e00            ;  BPLCON3 := 0x0e00
 001d264c: 0180 0000            ;  COLOR00 := 0x0000
...
 001d2830: 0106 0c00            ;  BPLCON3 := 0x0c00
 001d2834: 01be 0665            ;  COLOR31 := 0x0665
 001d2838: 0106 0e00            ;  BPLCON3 := 0x0e00
 001d283c: 01be 0bc7            ;  COLOR31 := 0x0bc7
 001d2840: 00e2 25f8            ;  BPL1PTL := 0x25f8
 001d2844: 00e0 001a            ;  BPL1PTH := 0x001a
 001d2848: 00e6 2620            ;  BPL2PTL := 0x2620
 001d284c: 00e4 001a            ;  BPL2PTH := 0x001a
>o
 001d2850: 00ea 2648            ;  BPL3PTL := 0x2648
 001d2854: 00e8 001a            ;  BPL3PTH := 0x001a
 001d2858: 00ee 2670            ;  BPL4PTL := 0x2670
 001d285c: 00ec 001a            ;  BPL4PTH := 0x001a
 001d2860: 00f2 2698            ;  BPL5PTL := 0x2698
 001d2864: 00f0 001a            ;  BPL5PTH := 0x001a
 001d2868: 00f6 25d8            ;  BPL6PTL := 0x25d8
 001d286c: 00f4 001b            ;  BPL6PTH := 0x001b
 001d2870: 00fa 2600            ;  BPL7PTL := 0x2600
 001d2874: 00f8 001b            ;  BPL7PTH := 0x001b
 001d2878: 00fe 2628            ;  BPL8PTL := 0x2628
 001d287c: 00fc 001b            ;  BPL8PTH := 0x001b
And here is when it breaks...

Code:
 001d2248: 01fc 0005            ;  FMODE := 0x0005
 001d224c: 0092 0038            ;  DDFSTRT := 0x0038
 001d2250: 0094 00d0            ;  DDFSTOP := 0x00d0
 001d2254: 1a01 ff00            ;  Wait for vpos >= 0x1a, , ignore horizontal
                                ;  VP 1a, VE 7f; HP 00, HE 00; BFD 1
 001d2258: 0120 000e            ;  SPR0PTH := 0x000e
 001d225c: 0122 9bcc            ;  SPR0PTL := 0x9bcc
 001d2260: 00f8 000e            ;  BPL7PTH := 0x000e
 001d2264: 1908 9bcc            ;  BPL1MOD := 0x9bcc
 001d2268: 0128 000e            ;  SPR2PTH := 0x000e
 001d226c: 012a 9bcc            ;  SPR2PTL := 0x9bcc
 001d2270: 012c 000e            ;  SPR3PTH := 0x000e
 001d2274: 012e 9bcc            ;  SPR3PTL := 0x9bcc
 001d2278: 0130 000e            ;  SPR4PTH := 0x000e
 001d227c: 0132 9bcc            ;  SPR4PTL := 0x9bcc
 001d2280: 0134 000e            ;  SPR5PTH := 0x000e
 001d2284: 0136 9bcc            ;  SPR5PTL := 0x9bcc
 001d2288: 0138 000e            ;  SPR6PTH := 0x000e
 001d228c: 013a 9bcc            ;  SPR6PTL := 0x9bcc
 001d2290: 013c 000e            ;  SPR7PTH := 0x000e
 001d2294: 013e 9bcc            ;  SPR7PTL := 0x9bcc
>o
 001d2298: 008e 27a1            ;  DIWSTRT := 0x27a1
 001d229c: 0090 2698            ;  DIWSTOP := 0x2698
 001d22a0: 3f01 ff00            ;  Wait for vpos >= 0x3f, , ignore horizontal
                                ;  VP 3f, VE 7f; HP 00, HE 00; BFD 1
 001d22a4: 0100 0211            ;  BPLCON0 := 0x0211
 001d22a8: 0102 44ff            ;  BPLCON1 := 0x44ff
 001d22ac: 0104 0030            ;  BPLCON2 := 0x0030
 001d22b0: 010c 0011            ;  BPLCON4 := 0x0011
 001d22b4: 0108 009c            ;  BPL1MOD := 0x009c
 001d22b8: 010a 009c            ;  BPL2MOD := 0x009c
 001d22bc: 0106 0c00            ;  BPLCON3 := 0x0c00
 001d22c0: 0180 0000            ;  COLOR00 := 0x0000
 001d22c4: 0106 0e00            ;  BPLCON3 := 0x0e00
 001d22c8: 0180 0000            ;  COLOR00 := 0x0000
 ...
 001d24ac: 0106 0c00            ;  BPLCON3 := 0x0c00
 001d24b0: 01be 0665            ;  COLOR31 := 0x0665
 001d24b4: 0106 0e00            ;  BPLCON3 := 0x0e00
 001d24b8: 01be 0bc7            ;  COLOR31 := 0x0bc7
 001d24bc: 00e2 2270            ;  BPL1PTL := 0x2270
 001d24c0: 00e0 0018            ;  BPL1PTH := 0x0018
 001d24c4: 00e6 2298            ;  BPL2PTL := 0x2298
>o
 001d24c8: 00e4 0018            ;  BPL2PTH := 0x0018
 001d24cc: 00ea 22c0            ;  BPL3PTL := 0x22c0
 001d24d0: 00e8 0018            ;  BPL3PTH := 0x0018
 001d24d4: 00ee 22e8            ;  BPL4PTL := 0x22e8
 001d24d8: 00ec 0018            ;  BPL4PTH := 0x0018
 001d24dc: 00f2 2310            ;  BPL5PTL := 0x2310
 001d24e0: 00f0 0018            ;  BPL5PTH := 0x0018
 001d24e4: 00f6 2250            ;  BPL6PTL := 0x2250
 001d24e8: 00f4 0019            ;  BPL6PTH := 0x0019
 001d24ec: 00fa 2278            ;  BPL7PTL := 0x2278
 001d24f0: 00f8 0019            ;  BPL7PTH := 0x0019
 001d24f4: 00fe 22a0            ;  BPL8PTL := 0x22a0
 001d24f8: 00fc 0019            ;  BPL8PTH := 0x0019

Does anyone have any ideas where I'm going wrong?

Geezer
Attached Thumbnails
Click image for larger version

Name:	copper_ok.png
Views:	85
Size:	168.1 KB
ID:	61200   Click image for larger version

Name:	copper_broke.png
Views:	83
Size:	215.0 KB
ID:	61201  
mcgeezer is offline  
Old 14 December 2018, 15:42   #2
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 868
Update - if I set the vertical wait line to $24 then the display is ok... anything after that screws it up.
mcgeezer is offline  
Old 14 December 2018, 15:54   #3
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 868
Further update...

This is defo some sort of timing thing...

if I set the wait to include horizontal to...

#$3c0dfffe

Then it works!
mcgeezer is offline  
Old 14 December 2018, 15:58   #4
ross
Sum, ergo Cogito

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,462
Quote:
Originally Posted by mcgeezer View Post
Update - if I set the vertical wait line to $24 then the display is ok... anything after that screws it up.
mmh, I don't see in copper a setup for BPLxPT before line $27 (where DIW start)
So garbage on screen is normal.
ross is online now  
Old 14 December 2018, 16:03   #5
roondar
Registered User

 
Join Date: Jul 2015
Location: The Netherlands
Posts: 768
It might have to do with the raster position at which your bitplane pointer writes execute.

If I'm reading the copper list correctly, you set up the display fetch & window first, then do a copper wait, then bplcon values and write colours and only then write the bitplane pointers. These may be slightly too late as the writing of AGA colours takes a while (you used 64 colours IIRC, so that'd be 64*2 moves = over 2 scanlines).

It may simply be a case of moving the bitplane pointer writes to before the colours.

Edit: same idea as Ross, different way of putting it
Edit 2: a way to get a grip on these things, I find, is to use the WinUAE visual DMA debugger. This shows the position of the copper activity vs the bitplane fetching so you can see if you're still writing during display (and where on the scanlines)

Last edited by roondar; 14 December 2018 at 16:09.
roondar is offline  
Old 14 December 2018, 16:04   #6
ross
Sum, ergo Cogito

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,462
Quote:
Originally Posted by mcgeezer View Post
Further update...

This is defo some sort of timing thing...

if I set the wait to include horizontal to...

#$3c0dfffe

Then it works!
#$3c01fffe and #$3c01ff00 is the same if done in line <$3c
So yes, if works with $3c0dfffe the little delay make the difference.
[anyway update all these registers on the very same line is a bit to much for the copper, better in previous positions]
ross is online now  
Old 14 December 2018, 16:14   #7
ross
Sum, ergo Cogito

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,462
An example if a single line is not enough to update all the registers:
Code:
 dc.l $008e27a1            ;  DIWSTRT
 dc.l $00902798            ;  DIWSTOP
 dc.l $2603fffe
 dc.l $01004201
 .... setup upper panel
 dc.l $3d03fffe
 dc.l $01000201
 .... setup main panel
 dc.l $3f03fffe
 dc.l $01000211
added 16 colors upper panel BPLCON0 but is just to setup a different screen

Last edited by ross; 14 December 2018 at 16:31. Reason: added 16 colors upper panel BPLCON0 :)
ross is online now  
Old 14 December 2018, 16:20   #8
a/b
Registered User

 
Join Date: Jun 2016
Location: europe
Posts: 84
008e 27a1
So display starts at line $27, and you initialize bpl pointers after wait $3f01ff00.
As Ross already pointed, but also...
You initialize sprite pointers after wait $1a01ff00, so line 26, and I'm surprised they work. Sprite DMA reads them at line 25/$19 (for PAL, end of VBL) and you "should" set them during line 24 at the latest. I just tried that (in WinUAE) and waiting for $1901fffe is already too late.
a/b is offline  
Old 14 December 2018, 16:24   #9
ross
Sum, ergo Cogito

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,462
Quote:
Originally Posted by a/b View Post
You initialize sprite pointers after wait $1a01ff00, so line 26, and I'm surprised they work. Sprite DMA reads them at line 25/$19 (for PAL, end of VBL) and you "should" set them during line 24 at the latest. I just tried that (in WinUAE) and waiting for $1901fffe is already too late.
Maybe SPR DMA is off
ross is online now  
Old 14 December 2018, 16:34   #10
roondar
Registered User

 
Join Date: Jul 2015
Location: The Netherlands
Posts: 768
A quick side note about Sprite pointers: once Sprite DMA is running you can actually set them to a different value somewhere down the line, allowing different Sprite images being stored in different areas of memory instead of needing a single block.
roondar is offline  
Old 14 December 2018, 16:39   #11
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 868
The sprites are all ok, i just dont have them fully enabled while i was debugging this.
mcgeezer is offline  
Old 14 December 2018, 20:35   #12
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 868
Wll after some tinkering and optimising I managed to get things going.

One question I do have which is related is... is it possible to switch on or off sprite dma at arbitrary vertical lines?

If you take a look at the video you'll see that the sprites are visible in the panels which obviously I don't want them to be, so I had the thought of simply turning off the sprite dma, however this doesn't work.

Basically I wait for a line then write to DMACON turning off sprite DMA which is what I would expect to turn it off... but I have a feeling it is rearming.

I can get round the problem by simply masking the area, but I'd chew up more bitplane dma that way and wondered if I should just be able to switch it off.

[ Show youtube player ]
mcgeezer is offline  
Old 14 December 2018, 23:05   #13
roondar
Registered User

 
Join Date: Jul 2015
Location: The Netherlands
Posts: 768
You should be able to disable sprite DMA midway through the screen and re-enable it again later. You might have to clear the SPRxDAT registers to get the sprite to not display though (if sprite DMA is disabled when a sprite is being displayed it ends up repeating the last line fetched). You could also change the sprite pointer to point to a dummy area filled with just zeroes.

Anyway, two workaround spring to mind:
1) change sprite priority and use a non-colour zero black as the background of the panel (though I think this might be what you meant with masking & bitplane DMA)
2) push sprite control/position words midway into the sprite you're showing and point the sprite pointers to this new start. Then, restore the sprite line you've erased when the vertical position changes. The same can be done for the bottom.

I'm not sure the second point is worded very clearly so here's two 'pictures':

Code:
Original sprite:
line 0: <control words> -- Sprite pointer points to line 0
line 1: 00xx00
line 2: 0xxxx0
line 3: 0xxxx0
line 4: xxxxxx
line 5: 0x00x0
line 6: 0x00x0
line 7: <sprite end>
Suppose this sprite needs a split at line 3 to be kept on screen only, so we store the contents of line three in a buffer somewhere and update sprite pointers to reflect a sprite beginning at line 3. Then we alter line three to be:
Code:
New sprite:
line 0: <control words> -- Ignored
line 1: 00xx00 -- Ignored
line 2: 0xxxx0 -- Ignored
line 3: <adjusted control words> -- Sprite pointer points to line 3
line 4: xxxxxx
line 5: 0x00x0
line 6: 0x00x0
line 7: <sprite end>
It's messy, but it should work with minimal overhead.
roondar is offline  
Old 14 December 2018, 23:27   #14
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 868
Quote:
Originally Posted by roondar View Post
You should be able to disable sprite DMA midway through the screen and re-enable it again later. You might have to clear the SPRxDAT registers to get the sprite to not display though (if sprite DMA is disabled when a sprite is being displayed it ends up repeating the last line fetched). You could also change the sprite pointer to point to a dummy area filled with just zeroes.

Anyway, two workaround spring to mind:
1) change sprite priority and use a non-colour zero black as the background of the panel (though I think this might be what you meant with masking & bitplane DMA)
2) push sprite control/position words midway into the sprite you're showing and point the sprite pointers to this new start. Then, restore the sprite line you've erased when the vertical position changes. The same can be done for the bottom.

I'm not sure the second point is worded very clearly so here's two 'pictures':

Code:
Original sprite:
line 0: <control words> -- Sprite pointer points to line 0
line 1: 00xx00
line 2: 0xxxx0
line 3: 0xxxx0
line 4: xxxxxx
line 5: 0x00x0
line 6: 0x00x0
line 7: <sprite end>
Suppose this sprite needs a split at line 3 to be kept on screen only, so we store the contents of line three in a buffer somewhere and update sprite pointers to reflect a sprite beginning at line 3. Then we alter line three to be:
Code:
New sprite:
line 0: <control words> -- Ignored
line 1: 00xx00 -- Ignored
line 2: 0xxxx0 -- Ignored
line 3: <adjusted control words> -- Sprite pointer points to line 3
line 4: xxxxxx
line 5: 0x00x0
line 6: 0x00x0
line 7: <sprite end>
It's messy, but it should work with minimal overhead.

Thanks Roondar, I'm going for option 1 and just setting the sprite priorities - it's the easiest way to do it and I gain all the colours I need.

Appreciate the help buddy!
mcgeezer is offline  
Old 14 December 2018, 23:32   #15
roondar
Registered User

 
Join Date: Jul 2015
Location: The Netherlands
Posts: 768
Your welcome! It's how I do this myself as well - it's the easiest option by far.
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
Copper Wait Problem sandruzzo support.WinUAE 13 18 May 2016 22:54
Copper Wait Problem sandruzzo Coders. Asm / Hardware 2 17 May 2016 11:30
Problem running copper master demo on A1200 whitebird support.Demos 26 17 August 2014 18:41
Copper effect problem Steve support.WinUAE 3 25 June 2011 15:05
Problem installing Bloodwych's Copper Workbench Thalor project.ClassicWB 25 29 December 2003 19:45

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 23:22.


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