09 January 2017, 08:17 | #1 |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 256
|
Bordersprites restrictions (AGA chipset)
On my original hardware, an Amiga 1200/020, a display error in conjunction with borderspriters in the left overscan-region occurs. As a change the error doesn’t exist on WinUAE (3.3.0). So lean back, Toni.
The Routine A horizontal starscrolling of vertical reused 1x bandwidth attached bordersprites which use hires/super-hires positioning on a 320x256 display with two colours in 4x fetchmode (DDFSTRT $38, DDFSTOP=$a0). All eight sprites are used. The starscrolling has four different planes with different speeds. The attached sprite pairs are SPR01 = foremost plane1 with the largest/fastest balls and priority over the rest of the sprites, SPR23=plane2, SPR45=Plane3, SPR67=most backward plane4 with the smallest/slowest balls and the lowest display priority. The Display-Error SPR4/5 and SPR6/7 are displayed with the wrong colours between the horizontal (lores) positions $5b-$68. After position $68 everything is fine. Sprite pair SPR 4/5 starts with this error earlier than SPR6/7. This effect appears during the whole display (all 256 rasterlines). The Sprites pairs 0/1 and 2/4 are not affected. Turning off the bitplane-DMA with zero bitplanes in BPLCON0 doesn’t have any influence on the display error. Theory 1 My first theory is that the sprite-DMA seems not able to display these sprites correctly because it is blocked by other, higher priorized DMA devices. I’ve seen in the DMA time slot allocation diagram of the HRM that for Sprite 5-7 other DMA devices could also use their slots. I’ve marked them red. HRM says that these slots are also available for Blitter, Copper and 680x0. But the blitter is not used and the copper doesn’t execute any commands in this display region. So only the 680x0 could steal these cycles from these sprites. But when I did the screenshot, I stopped the routine, so there is also no 680x0 activity. The diagram also confirms that the sprites 4/5 are blocked earlier that sprite 6/7. Theory 2 My second theory is, that the display-error occurs if the sprite should be displayed in the same region while it is fetched there by DMA. For SPR4 this would be between lores position $4a-$50 , SPR5=position $52-$58, SPR6=position $5a-$60, SPR7=position $62-$68. Paired together in attached mode this would mean that SPR45 are loaded between position $4a-$58 and SPR67 between position $5a-$68. The sprites are visible before these regions because the fetched planedata of the previous line is used. To make things clearer, I’ve also included a little video https://www.dropbox.com/s/llfcdahmpt...rites.AVI?dl=0 and a screenshot of this effect to show how it appears on my multisync monitor. I’ve manipulated the display with the BPLCON4 so that the background-colour within HSTART-HSTOP/DDFSTRT-DDFSTOP is changed to emphasize the left border area. Maybe you, Toni, could explain this phenomenon. |
09 January 2017, 08:53 | #2 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
I think I have seen this effect previously in some of my bitplane/sprite tests but I forgot about it because I was always examining some other problem.
I am sure your theory #2 is correct. Sprite is not horizontally armed when horizontal comparison matches = sprite's shift register won't get loaded or only SPRxDATA gets loaded (and DATB gets previous line's data, I guess) if match position is after sprite's DATA DMA but before sprite's DATB DMA slot. SPRxDATA write does the horizontal arming. It can't be #1, copper, blitter or cpu can't steal sprite cycles. (Only bitplanes can steal sprite cycles). |
09 January 2017, 17:10 | #3 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
Do you have some example code that shows this (and does nothing else)? Because I am so lazy to test it myself.. You can email if you prefer to keep it secret. Executable only is fine, I don't need sources.
|
09 January 2017, 19:38 | #4 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
My first guess can't be right, it has nothing to do with armed status. (It is always good idea to check HRM and current emulation code before guessing anything too weird..)
It is most likely really simple reason: horizontal comparison matches after DATA has been loaded but before DATB: DATB still has previous line's data. |
09 January 2017, 20:58 | #5 | |||
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 256
|
Quote:
Quote:
Quote:
|
|||
10 January 2017, 21:37 | #6 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
Fixed. It wasn't even directly chipset emulation related, it was just a side-effect of lazy evaluation (delay something as long as possible until it really needs to be done) which assumed that DMA mode sprites can't have side-effects and can be delayed until end of scanline (or until next CPU or copper sprite-register access if earlier than end of scanline).
Fixed was very simple: test sprite's X-coordinate against sprite's SPRxDATB DMA slot in DMA emulation, if coordinate is smaller, do pending sprite decisions immediately. Test prevents useless CPU usage increase with "normally" positioned sprite. |
11 January 2017, 07:41 | #7 | ||
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 256
|
Quote:
Quote:
|
||
11 January 2017, 08:32 | #8 | |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
Quote:
I think it should be quite easy to work around it by having multiple sprites (one normal, one that has second plane shifted by one pixel vertically and so on) and selecting correct depending on sprite's x-coordinate. |
|
11 January 2017, 22:38 | #9 | |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 256
|
Quote:
Between line $2c-$12b the copper sets with x-pos=$6 (minimum) the register BPL1DAT=0. The display error at the left border can be prohibited, waiting with the copper for the x-pos=$38. But as a consequence, the left overscan region gets blanked and the sprites are disabled. The values of these register remain the same: DDFSTRT=$38, DDFSTOP=$a0, FMODE=4x for one bitplane. Important: To see the sprites outside the border, it is necessary to change the horizontal window-limits (DIWSTRT/DIWSTOP/DIWHIGH) to the overscan values HSTART=$5b and HSTOP=$1c7. Otherwise the sprites are only visible in the standart region if you use for example HSTART=$81, HSTOP=$1c1. The display error at the left border is the same as with real bordersprites. At the right border the sprites disappear much sooner like the real bordersprites, if you use HSTOP>=$1c8. It seems that they can’t have the horizontal lores-positions greater $1c7. Toni, if you want, I could send you my revised routine by mail for testing purposes. Please remember, that my routine is AGA only. I haven’t got an init-routine for the OCS yet. Last edited by dissident; 12 January 2017 at 08:03. |
|
12 January 2017, 11:00 | #10 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
I don't think I need any test cases anymore. Only remaining part is confirming that glitches happen exactly at right x coordinate positions. I'll do it later..
This test is needed because some sprite operations that happen exactly at the same time as DMA write use previous data and some use new data. |
12 January 2017, 22:14 | #11 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
Positioning is exactly correct in emulation but I found another side-effect (and confirmed it also happens on ECS A500):
If sprite start xpos is before xDATB/xCTL fetch, sprite's last line gets duplicated, line that normally would have been blank (line that DMA engine uses to fetch next xPOS and xCTL words) will have same sprite graphics as previous line. It happens because condition that loads words to shift register is: must be "armed" and horizontal comparison matches. Sprite stays armed until next xCTL write, if horizontal comparison matches before xCTL DMA fetch, sprite is still armed and shift register will get loaded with previous line's xDATA and xDATB. Result is repeated extra line. (This is not yet emulated, it is more tricky to implemented without other side-effects) |
13 January 2017, 09:09 | #12 | |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 256
|
Sure, your emulation works correctly. My monitor seems to display more of the right border region than it is necessary. That's what I meant.
Quote:
|
|
14 January 2017, 15:13 | #13 | |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
Quote:
Last line doubling should be emulated properly now. |
|
09 January 2019, 15:52 | #14 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Hi Toni, there is something wrong in border sprite emulation, probably related to patch you have done here.
All 'bad' sprites behavior in low x-coordinates works only if BRDSPRT=1. (tested on AGA 64bit sprites and latest WinUAE) |
09 January 2019, 16:37 | #15 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
hmm, there is also something wrong with BRDSPRT=1.
I think that all the situations in attached images indicate something strange. Sprites not y-multiplexed, latest image with BRDSPRT=0. Attached also a little executable (joy button to toggle BRDSPRT bit). |
11 January 2019, 18:53 | #16 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
Fixed. I tried to optimize handling of this feature a bit too much..
|
11 January 2019, 21:19 | #17 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Perfect! Now it behaves as I remember from the old days .
Thank you, ross |
31 January 2019, 18:19 | #18 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Quote:
My first DIWSTRT position for a full left overscan is value $5c, that correspond to a x sprite position = $5b. Or are you saying that you have DIWSTRT = $5b? (one lo-res pixel more that WinUAE). Regarding max x position.. in WinUAE I can set an x>$1c7 and the sprites do not disappears. From this message seems that the sprites in real machine disappears. Can you enlighten me? Thanks. |
|
01 February 2019, 08:34 | #19 | |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 256
|
Quote:
DIWSTOP = $1c7 is the normal horizontal overscan value. Or did you set DIWSTOP = $1c8? Then you will get an extra wide display (left&right border will be extended to their maximum values) because of a hardware bug. And I guess then, sprites are also visible at a horizontal position >=$1c8. |
|
01 February 2019, 11:05 | #20 | ||
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Quote:
Toni confirmed in an old message that first pixel is visible with DIWSTRT(<)=$5C for ECS and AGA, apart some early A1000 where DIWSTRT can be $60. So in WinUAE. Quote:
So I did not understand what you meant here: "At the right border the sprites disappear much sooner like the real bordersprites, if you use HSTOP>=$1c8. It seems that they can’t have the horizontal lores-positions greater $1c7." Can you elaborate please? Thanks |
||
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to detect AGA chipset installed from C? | earok | Coders. C/C++ | 3 | 04 June 2016 02:31 |
Auto-setting chipset to "original" on AGA startup | MethodGit | Coders. General | 16 | 11 March 2016 17:47 |
Best way of detecting the AGA chipset? | Steve | Coders. Asm / Hardware | 13 | 25 January 2014 22:08 |
Copper color-changing restrictions? | Dan Locke | Coders. General | 24 | 01 February 2010 03:00 |
EHB sprites with AGA chipset ? | FrenchShark | Coders. General | 4 | 17 September 2009 06:37 |
|
|