English Amiga Board


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

 
 
Thread Tools
Old 27 October 2018, 13:01   #41
ross
Sum, ergo Cogito

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,347
If you zoom in on my last attached jpg (post #36) you can notice that the 'central' line of the 'breaked' sprite is missing.
These values are loaded in xPOS/xCTL by DMA.. (EDIT: see a successive message why this behaviour)

This is an example of code that (partially) works only by chance
(or better, works much similar to what's expected but not for the right reason ).

At the end, yes, a line based change for sprites between DMA/stop/manual modes can be properly 'handled', but you need to be really aware of the 'full picture'.
If you use code similar to what I've done on post #26 you can enjoy a 'mixed' mode perfectly working.

Surely I will soon forget, but at least I know where to look for valid references.
Actually there another detail for a better understand (EDIT: discussed later) but from now thanks to all involved!
As usual especially to the encyclopedic Toni and his patience.

Last edited by ross; 28 October 2018 at 09:27. Reason: rephrased
ross is offline  
Old 27 October 2018, 14:35   #42
adrazar
Registered User

 
Join Date: Feb 2017
Location: Oslo
Posts: 40
Quote:
Originally Posted by Toni Wilen View Post
Sprite Agnus side logic is very simple:

if (current vpos == sprite start) Set sprite DMA state to active.

if (current vpos == first possible sprite line) sprite DMA slots are used to load SPRxPOS and SPRxCTL. Force disable dma state. Disable happens even if SPRxCTL write is not possible due to bitplane DMA stealing sprite cycles.

if (current vpos == sprite end) sprite DMA slots are used to load SPRxPOS and SPRxCTL

if (sprite dma state == active) Sprite DMA slots are used to load SPRxDATA and SPRxDATB

Loading SPRxCTL: dma state -> inactive
This the thing ...but is the last statement true?
It's giving the impression you can stop DMA by writing 0 to SPRxCTL, but that's been shown not to be the case.
I also notice a slight lack of rigour, but I believe this doesn't hide any unexpected surprises (e.g. 3. has priority over 4. if both conditions are satisfied).
adrazar is offline  
Old 27 October 2018, 17:46   #43
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 43
Posts: 22,109
Quote:
Originally Posted by adrazar View Post
This the thing ...but is the last statement true?
It's giving the impression you can stop DMA by writing 0 to SPRxCTL, but that's been shown not to be the case.
Perhaps SPRxPOS start still matched?

Quote:
I also notice a slight lack of rigour, but I believe this doesn't hide any unexpected surprises (e.g. 3. has priority over 4. if both conditions are satisfied).
Stop matching always "wins" if there are multiple matching conditions.
Toni Wilen is offline  
Old 27 October 2018, 18:49   #44
adrazar
Registered User

 
Join Date: Feb 2017
Location: Oslo
Posts: 40
Quote:
Originally Posted by Toni Wilen View Post
Perhaps SPRxPOS start still matched?
No, I wrote 0 to SPRxCTL about ten pixels down a sprite and did not touch SPRxPOS. Hence the start position can't have matched the line.

I should probably attach a small program to support my claim, but I don't have a proper setup to create projects in assembly. I can make a quick demonstration in AMOS though if that's good enough.
adrazar is offline  
Old 27 October 2018, 19:08   #45
ross
Sum, ergo Cogito

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,347
Quote:
Originally Posted by adrazar View Post
No, I wrote 0 to SPRxCTL about ten pixels down a sprite and did not touch SPRxPOS. Hence the start position can't have matched the line.

I should probably attach a small program to support my claim, but I don't have a proper setup to create projects in assembly. I can make a quick demonstration in AMOS though if that's good enough.
Simply guide me on what you do exactly (x/y positions, registers values, etc).
It's sure a one minute job to do.
ross is offline  
Old 27 October 2018, 19:18   #46
adrazar
Registered User

 
Join Date: Feb 2017
Location: Oslo
Posts: 40
Quote:
Originally Posted by ross View Post
Simply guide me on what you do exactly (x/y positions, registers values, etc).
It's sure a one minute job to do.
Ok, take your previous program and wait for the middle line of sprite 2, with a horizontal position right after the sprite DMA slots (pixel 128?). Write 0 to SPR2CTL.
adrazar is offline  
Old 27 October 2018, 19:40   #47
ross
Sum, ergo Cogito

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,347
Quote:
Originally Posted by adrazar View Post
Ok, take your previous program and wait for the middle line of sprite 2, with a horizontal position right after the sprite DMA slots (pixel 128?). Write 0 to SPR2CTL.
Ok.
Only one BPL active to better view DMA activity.

Copper:
Code:
        dc.l	$f027fffe		;right after DMA
	dc.l	$01520000		;2CTL=0
Attached Thumbnails
Click image for larger version

Name:	adrz1.jpg
Views:	34
Size:	110.5 KB
ID:	60458  
Attached Files
File Type: zip adrazar_s2_1.zip (840 Bytes, 13 views)
ross is offline  
Old 27 October 2018, 19:55   #48
adrazar
Registered User

 
Join Date: Feb 2017
Location: Oslo
Posts: 40
Thank you ross

So the picture shows that writing to xCTL disarmed the sprite because a line is missing.
But DMA is still active because it continues drawing the following lines.
adrazar is offline  
Old 27 October 2018, 20:08   #49
ross
Sum, ergo Cogito

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,347
Quote:
Originally Posted by adrazar View Post
Thank you ross

So the picture shows that writing to xCTL disarmed the sprite because a line is missing.
But DMA is still active because it continues drawing the following lines.
Just a comment before Toni intervention.
This is practically the same case that made me comment in post #39.

I've interpreted post #40 as: next line is a normal DMA line so a xDATA/B is done because DMA is still active "and all the comparisons are active all the time".

I've supposed too much?
ross is offline  
Old 27 October 2018, 20:10   #50
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 43
Posts: 22,109
Usual answer: example binary (that works without any external dependencies. If it does: adf that includes everything needed) required that does nothing else than the test case. Programming language is irrelevant.
Toni Wilen is offline  
Old 27 October 2018, 20:12   #51
ross
Sum, ergo Cogito

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,347
Quote:
Originally Posted by Toni Wilen View Post
Usual answer: example binary (that works without any external dependencies. If it does: adf that includes everything needed) required that does nothing else than the test case. Programming language is irrelevant.
It's attached in my post, no dependencies (pure asm, the usual crap).
ross is offline  
Old 27 October 2018, 20:15   #52
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 43
Posts: 22,109
Quote:
Originally Posted by ross View Post
It's attached in my post, no dependencies (pure asm, the usual crap).
But is it actually exact same case as adrazar reported? I don't like guesses.
Toni Wilen is offline  
Old 27 October 2018, 20:21   #53
adrazar
Registered User

 
Join Date: Feb 2017
Location: Oslo
Posts: 40
Yes, it displays exactly the behaviour I was referring to.
adrazar is offline  
Old 27 October 2018, 20:22   #54
ross
Sum, ergo Cogito

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,347
Quote:
Originally Posted by Toni Wilen View Post
But is it actually exact same case as adrazar reported? I don't like guesses.
Yes.

And practically the same that made me comment #39, where i've not posted a binary (the effect is different but concept is the same).
ross is offline  
Old 27 October 2018, 20:31   #55
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 43
Posts: 22,109
I missed one extra condition: SPRxCTL write disables DMA state only if it was DMA access to SPRxCTL. Manual writes do not affect DMA state.
Toni Wilen is offline  
Old 27 October 2018, 20:33   #56
ross
Sum, ergo Cogito

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,347
Quote:
Originally Posted by Toni Wilen View Post
I missed one extra condition: SPRxCTL write disables DMA state only if it was DMA access to SPRxCTL. Manual writes do not affect DMA state.
Argh, this explain all the strange cases, everything!

EDIT: in truth not everything, one last detail is missing



Thanks Toni

Last edited by ross; 28 October 2018 at 10:00.
ross is offline  
Old 27 October 2018, 21:02   #57
adrazar
Registered User

 
Join Date: Feb 2017
Location: Oslo
Posts: 40
Quote:
Originally Posted by ross View Post
Argh, this explain all the strange cases, everything!
I still fail to see how the current set of rules explains that DMA could be stopped by writing the current line value to SPRxCTL.
It was clear from post #26 that DMA did not load any value into xCTL after you armed the sprite with your own data, because this data was displayed on the next line.
Now, since DMA didn't load xCTL, DMA should still be active. But it isn't (contradiction ).

Maybe Toni should have a look at the code in post #26 as well
adrazar is offline  
Old 27 October 2018, 21:22   #58
ross
Sum, ergo Cogito

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,347
Quote:
Originally Posted by adrazar View Post
I still fail to see how the current set of rules explains that DMA could be stopped by writing the current line value to SPRxCTL.
It was clear from post #26 that DMA did not load any value into xCTL after you armed the sprite with your own data, because this data was displayed on the next line.
Now, since DMA didn't load xCTL, DMA should still be active. But it isn't (contradiction ).

Maybe Toni should have a look at the code in post #26 as well
Yes, during dinner I thought the same thing and that I had been too enthusiastic..

I can suppose only that for condition
if (current vpos == sprite end) sprite DMA slots are used to load SPRxPOS and SPRxCTL

system is tricked to think that DMA has done its job..
ross is offline  
Old 27 October 2018, 21:58   #59
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 43
Posts: 22,109
Yes, same answer again, y-coordinate comparisons are active all the time so they don't care when or who changed the register.

SPRxCTL special trigger condition is a bit unexpected but it probably was needed to handle some special case.
Toni Wilen is offline  
Old 27 October 2018, 22:29   #60
ross
Sum, ergo Cogito

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 48
Posts: 1,347
So, the preceding phrase need to be:
if (current vpos == sprite end) sprite DMA slots are used to load SPRxPOS and SPRxCTL, special DMA idle case

Right?

EDIT: word *special* used because we have TRUE condition from two cases:
- a preceding value in SPRxCTL(EVx)==line so a DMA fetch for new SPRxPOS/CTL is done (a DMA write access, condition for sprite DMA idle state);
- a COPPER/CPU poke on SPRxCTL on this very same line that retroactively force a TRUE condition (setting EVx==line), the special case for a DMA idle state.
It's not so different from my post #39

Last edited by ross; 28 October 2018 at 10:02.
ross 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
Mani Pulite sprite problems (A500 mode) andreas support.WinUAE 17 22 January 2015 15:41
Start automatic.. Nightmare4k support.FS-UAE 8 08 November 2014 17:53
Automatic Savestates Another World request.UAE Wishlist 12 17 January 2009 20:55
'Warp Mode' broken in 'windowed mode' NoX1911 support.WinUAE 3 26 May 2007 02:05
REQ: Automatic resolution change ; automatic resolution detection Borg_Number_One request.UAE Wishlist 3 21 August 2004 15:16

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 16:50.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.09288 seconds with 15 queries