English Amiga Board


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

 
 
Thread Tools
Old 21 March 2024, 23:49   #1
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
AGA scrolling

I've lost the evening on this


Fetch mode = 3 (64 bit bitplane fetch, ECS sprites)


Code:
    move.w    #0x30,d5
    
    move.w    d5,d6
    and.w    #0xF,d6        | 16 original bits
    and.w    #0x30,d5    | 2 remaining bits
    lsl.w    #6,d5        | position in 10-11

    or.w    d5,d6   | this is the bplcon value

I can't seem to apply 48 of scroll shift. 47 seems to work ok (2F) but 48 fails. Any idea?
jotd is offline  
Old 22 March 2024, 00:26   #2
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
Quick look at my crystal ball: DDFSTRT is 'misaligned'.
But it's very late, we'll think about it tomorrow
ross is offline  
Old 22 March 2024, 07:53   #3
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
probably but I have tried several values since and no luck

Code:
    move.w #0x0020,ddfstrt(a5)   <- read that on demoscene, was using 30 earlier, no luck either just different results
    move.w #0x00B8,ddfstop(a5)
    move.w	#-8,d0

    move.w #0,bplcon1(a5)
    move.w #-8+(64-40),bpl1mod(a5)
there must be a combination of modulo & ddf but that's beyond me.

There are virtually no examples for AGA. I had done ECS scrolling before without issues, and also AGA scrolling but vertical
jotd is offline  
Old 22 March 2024, 09:47   #4
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
Yep, the DDFSTRT is 'wrong' (neither $20 nor $30 can work as you intend), try $18.

But more info please.
What is the framebuffer you have in memory? (those values you used requires 384 pixels on the x)
Do you want to use sprites? if yes, how many?
What video window are you going to use (values for DIW)?

Unfortunately, even my crystal ball has limits..
ross is offline  
Old 22 March 2024, 13:26   #5
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,039
Not an AGA expert, but just in case...
I see 64, that's total width 512px. I see 40, that's diplayed width 320px. -8 is compensation for 64px scrolling (4+2 bits, bottom 2 bits are zeroes). Am I right?
Normal (no scrolling) fmode=3 dma is $38-$a0. To extend that with extra 64x pix on the left for scrolling, start should be moved to $18:
($a0-$38+8+48)*2=320
($a0-$18+8+48)*2=320+64
(end-start+8)*2 is the OCS/ECS math for dma (fmode=0), fmode=3 fetches extra 48 bits (64 vs. 16). Is this correct (never did AGA scrolling :P)?
a/b is online now  
Old 22 March 2024, 15:07   #6
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
that looks correct indeed. All those calculations are beyond me though. thanks a lot both of you, will try tonight.
jotd is offline  
Old 22 March 2024, 15:22   #7
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,039
Let me try to clarify with a simplified example...

Say you have an 8bpl display. With fmode=0 the fetch looks like:
8 8 8 8... 8
Now when you enable fmode=3 you get 4x speed, you know that, and you might think it works like this:
2(*4) 2(*4) 2(*4) 2(*4)... 2(*4)
But this is *not* how it works, it's actually like this:
8(*4) 0 0 0 8(*4) 0 0 0... 8(*4) 0 0 0
As you see, it's 25% active/burst and 75% inactive, on *average* that's 4x faster.

This is critical e.g. if you are planning on having max speed copper (8 cycles per move) at all times with 5+ bpls by using fmode > 0. It won't work due to bursty nature of fmode, copper will still get slowed down during bursts (7bpl ocs trick ).

So if you want to extend your display to compensate for scrolling, you cannot only include the 25% active part (-$8), you also have to include the 75% inactive part (-$18), giving you a total of -$20 -> $18.
$18 8*4 (will be scrolled iin), $20 0, $28 0, $30 0, $38 8*4, ...

Something like that :P.
a/b is online now  
Old 22 March 2024, 15:36   #8
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
Interesting point of view, you eventually come to the correct conclusion, even if in fact the hadware doesn't 'think' that way

It all boils down to when BPL1DAT is 'written' and when BPLCON1 value match Lisa's counter.

In fact the writing of BPL1DAT is 'early' due to the FMODE burst and the match bits are 6 (8 if we consider the sub-pixels) and therefore the 'comparison window' widens and remains 'valid' for the values from 0 to $3F for the low bits of Lisa's counter (this require a proper DDFSTRT to write to BPL1DAT 'before' the 0 point).

ross is offline  
Old 22 March 2024, 20:14   #9
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
that $18 value fixed it! now I have a lot to do with DIWSTART/STOP on both playfields to make sure they match, but that I can manage

thanks again!
jotd is offline  
Old 22 March 2024, 23:29   #10
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
so it works but there's a strange phenomenon on the bottom of the screen

If I set DDFSTRT at $18 as instructed, the ground strip (with moonbase) seems to have shifted bitplanes, but the upper panel uses the exact same drawing routine (if I draw the panel in the bottom the same phenomenon appears too)

Click image for larger version

Name:	003.png
Views:	100
Size:	7.1 KB
ID:	81896

With DDFSTRT as $30 (old crap value that made scroll glitchy because unaligned), the bottom tiles are perfect and the moonbase displays properly

Click image for larger version

Name:	002.png
Views:	94
Size:	6.5 KB
ID:	81895

Thing is: I'm setting bitplane pointers for the blue mountains different from panel (as mountains scroll horizontally but also vertically), then I re-set the bitplanes for the ground strip (green mountains are on another playfield with the jeep, no hardware scroll, just blits, like ECS version)

So the copperlist sets panel bitplanes (and they display OK), then sets mountains bitplanes (seem strange vs real pic but it can be something else) then sets ground strip bitplanes. I've tried to sub/add 8 but it doesn't work. I suspect that doing that bitplane set, I'm breaking the fetch. I'm sure it can be done but the values seem wrong with that ddfstrt... This is really obscure.

In theory this is really awesome, as there are very few blits involved, blue mountains & ground strip share the same playfield, but with different scroll values, and the separation is made with the green mountain which has priority (and I'll use color 0 as green to finish the job, but just not now...). Since blue mountains never get lower than the ground strip, it works.

I understand that games like Jim Power use dual playfield and even change playfield/sprite priority so they can have objects in the foreground too (bottom part) where the upper parts are the background mountains. Clever.

Last edited by jotd; 22 March 2024 at 23:43.
jotd is offline  
Old 23 March 2024, 09:42   #11
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
Probably at this point a test version is required, the causes could be various
Is it downloadable somewhere?

Are you 100% sure that all AGA fetches in memory are 8-byte aligned?

Then I have doubts about the sprites... if you want to use some of them you have to 'move' forward with DDF and at that point manage the video shift differently (even if I see that the view is 'narrow' so it shouldn't be a problem).
ross is offline  
Old 23 March 2024, 09:51   #12
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
Quote:
Originally Posted by ross View Post
Probably at this point a test version is required, the causes could be various
Is it downloadable somewhere?
source of AGA driver is here:

https://github.com/jotd666/mpatrol/b.../aga/amiga.68k

There are a lot of constants that assembler computes, maybe it's not going to be helpful for you.

Quote:

Are you 100% sure that all AGA fetches in memory are 8-byte aligned?
When I reposition the bitplanes, I always add a multiple of 64 so it should work.

Quote:

Then I have doubts about the sprites... if you want to use some of them you have to 'move' forward with DDF and at that point manage the video shift differently (even if I see that the view is 'narrow' so it shouldn't be a problem).

I'm using sprites, but if I have to drop them I think it will be possible given the saved bandwidth not blitting 2 big layers. I'll check that later.


Zoned a test version. Useless for anyone that doesn't want to debug it

insert coin & start game to see shifted moonbase. In the intro screen it's not as blatant (the blue mountains have the same issue, probably, as if I blit them on the top, overwriting panel, they're okay, else they're really strange but since it's repetitive and only 2 colors it's more difficult to tell)

One thing is sure: changing bitplane pointers using the copperlist caused the problem. But I have to do that to add the 0,8,16,24 byte offset required to scroll my 512 pixel wide image on the 512 pixel wide display

Last edited by jotd; 23 March 2024 at 10:08.
jotd is offline  
Old 23 March 2024, 14:36   #13
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,039
It looks like the problem is that there isn't enough time to load all the bitplane pointers before dma becomes active ($18 is rather early). I changed the wait from $dc01 to $dbd1 and the problem was gone.
a/b is online now  
Old 23 March 2024, 19:15   #14
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
Yes @a/b that's probably the problem. But ross suggested a radical approach: drop FMODE=3 and go for FMODE=1 to be able to use sprites. Seems to work pretty well. Thank you both.
jotd is offline  
Old 23 March 2024, 19:55   #15
Galahad/FLT
Going nowhere
 
Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,994
Not withstanding a/b's help, but I often wonder what life was like before Ross joined EAB.

Yikes, they were dark times!
Galahad/FLT is offline  
Old 23 March 2024, 22:03   #16
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
Quote:
Originally Posted by Galahad/FLT View Post
.. I often wonder what life was like before Ross joined EAB.
Definitely better because we were younger

Seriously, I blushed a bit
Thanks Sir Galahad.

Last edited by ross; 24 March 2024 at 11:22.
ross is offline  
Old 23 March 2024, 23:34   #17
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,196
ross was definitely a big help. This "new" hardware is hard to master
jotd is offline  
Old 24 March 2024, 09:49   #18
TCD
HOL/FTP busy bee
 
TCD's Avatar
 
Join Date: Sep 2006
Location: Germany
Age: 46
Posts: 31,603
Quote:
Originally Posted by Galahad/FLT View Post
Not withstanding a/b's help, but I often wonder what life was like before Ross joined EAB.

Yikes, they were dark times!
Well put One day I must find out where ross was hiding all those years
TCD is online now  
Old 24 March 2024, 11:20   #19
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,474
Quote:
Originally Posted by TCD View Post
One day I must find out where ross was hiding all those years
I was just doing other things.

Then you get kicked out of the house by your woman, you have a mid-life crisis, you start to feel old and sick, and eventually you start using the Amiga again
A very normal common story..
ross is offline  
Old 24 March 2024, 11:24   #20
TCD
HOL/FTP busy bee
 
TCD's Avatar
 
Join Date: Sep 2006
Location: Germany
Age: 46
Posts: 31,603
Quote:
Originally Posted by ross View Post
Then you get kicked out of the house by your woman, you have a mid-life crisis, you start to feel old and sick, and eventually you start using the Amiga again
A very normal common story..
Yep
TCD is online now  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
AGA FMODE & BPLCON1 Scrolling DanielAllsopp Coders. Asm / Hardware 13 17 May 2022 13:51
Jurrasic Park AGA (WHDLoad) - slow scrolling PopoCop support.Games 4 08 September 2020 12:56
Parallax Scrolling timg Coders. Blitz Basic 5 29 January 2020 00:36
Indivision 1200 AGA MK2cr scrolling question schneidas support.Hardware 46 16 January 2018 20:20
TV's with proper scrolling with RGB or Indivision ECS/AGA MK1 Yulquen74 support.Hardware 5 06 February 2017 18:10

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 14:12.

Top

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