English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General > Coders. Tutorials

 
 
Thread Tools
Old 22 January 2011, 17:38   #1
Lonewolf10
AMOS Extensions Developer
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 41
Posts: 1,924
Hardware Scroll tutorial?

Hi,

Does anyone have a hardware scroll tutorial?

I am trying to scroll a 5 bitplane screen and I'm guessing that it'd take forever using the blitter, so I am attempting to do it using the hardware. The problem is I seem to only be moving bitplane 0 by 1 pixel to the left and then it stops.

I have set BPLCON1 as $0001, which I assume is why bitplane 0 has moved 1 pixel to the left. How do I move all of the bitplanes?

The Hardware Reference manual also mentions "setting the delay bits", but doesn't mention where they are! Can anyone point me in the right direction?


Regards,
Lonewolf10
Lonewolf10 is offline  
Old 22 January 2011, 17:47   #2
pmc
gone
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Hey Lonewolf10

From memory: don't you just sequentially set the delay bits to scroll up to 16 pixels (which is the max you can scroll using only the delay bits IIRC) and then update the bitplane pointers to start displaying the bitplane data at the next or previous word depending on scroll direction...?

Keep doing that and you're scrolling.

Delay is set in bplcon1 IIRC.

I think you also have to do something with modulos too...?

EDIT: delay is bits 0 - 7 in bplcon1 (0 to 3 for odd bitplanes, 4 - 7 for the even ones)

Last edited by pmc; 22 January 2011 at 17:52. Reason: added info...
pmc is offline  
Old 22 January 2011, 18:00   #3
frank_b
Registered User
 
Join Date: Jun 2008
Location: Boston USA
Posts: 460
From memory.
You need to fetch an extra word with display dma. You need to set up the modulus registers to skip at least a word (the one which will be scrolled on screen) then set the fine scroll bits.

Something like

where x = pixels scrolled

set fine scroll (delay) inverse of x AND $f duplicated for odd, even planes.

ie $f is 0. Use a look up table to map x AND $f to set scroll for odd/even planes.

Hope this helps.
frank_b is offline  
Old 22 January 2011, 18:52   #4
deicidal
Registered Insane

deicidal's Avatar
 
Join Date: Feb 2010
Location: Ununited Kingdom
Posts: 792
Kreator / Anarchy wrote one I think many moons ago it would be in one of the early issues of Stolen Data
deicidal is offline  
Old 22 January 2011, 19:48   #5
frank_b
Registered User
 
Join Date: Jun 2008
Location: Boston USA
Posts: 460
Quote:
Originally Posted by deicidal View Post
Kreator / Anarchy wrote one I think many moons ago it would be in one of the early issues of Stolen Data
http://amigadev.elowar.com/read/ADCD.../node008B.html

You need to set the odd and even delay to the same value in bplcon1
From memory a delay of $ff means no scroll and $00 means scroll playfield left by 15 pixels. You're only setting one of the values.
frank_b is offline  
Old 22 January 2011, 21:59   #6
pmc
gone
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Quote:
Originally Posted by frankb
From memory a delay of $ff means no scroll and $00 means scroll playfield left by 15 pixels.
This would be the other way round wouldn't it...?

Normally the delay bits are not set so $00 == no scroll and the maximum settable value $ff == 15 bits of scroll.

You'd either decrement or increment the delay bits and bitplane pointers depending on the scroll direction required of course.
pmc is offline  
Old 22 January 2011, 22:09   #7
frank_b
Registered User
 
Join Date: Jun 2008
Location: Boston USA
Posts: 460
Quote:
Originally Posted by pmc View Post
This would be the other way round wouldn't it...?

Normally the delay bits are not set so $00 == no scroll and the maximum settable value $ff == 15 bits of scroll.

You'd either decrement or increment the delay bits and bitplane pointers depending on the scroll direction required of course.
Possibly. It's been 15 years since I did any amiga hw scrolling code and I'm 1000 miles away from my amiga

I remember it being the opposite way around compared to the STE.
0 is no scroll on the STE and $f is view area scrolled right 15 pixels.
I have a fuzzy memory of using a look up table for the scroll values on the Amiga. Maybe I used a look up to set both values to save converting $f -> $ff when setting both playfield fine scroll settings after getting the fine scroll modulus via AND. My memory could be hazy though

http://amigadev.elowar.com/read/ADCD.../node02D0.html should clear it up

Last edited by frank_b; 22 January 2011 at 22:35.
frank_b is offline  
Old 23 January 2011, 00:40   #8
Lonewolf10
AMOS Extensions Developer
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 41
Posts: 1,924
Quote:
Originally Posted by deicidal View Post
Kreator / Anarchy wrote one I think many moons ago it would be in one of the early issues of Stolen Data
Does anyone know if the issues of Stolen Data are stored in one place somewhere?
Googling amiga "Stolen Data" revealed multiple sites with some issues on them (e.g. most are scattered all over the internet). I'm not going to download them tonight, as I am tired.


pmc and frank_b,

I have spent the afternoon coding a simple scroll routine that moves the screen left and right by adding/subtracting 1 byte from each of the BPLxPTL pointers until the right/left edge of the screen was reached. Then it scrolls back the other way.
I should be able to add in code to use BPLCON1 now and make it a smoother scroll. Thanks for guidance. The phrase "delay bits" threw me, I was thinking in terms of time delay (e.g. set the delay bits, set BPLCON1 and the hardware would automatically scroll it every X VBL ).

FYI, the screen contains the logo for my demo group (is it a group if there is only one member?!), which was kindly created by Greyfox a few months back.


Regards,
Lonewolf10
Lonewolf10 is offline  
Old 23 January 2011, 04:18   #9
Codetapper
2 contact me: email only!

Codetapper's Avatar
 
Join Date: May 2001
Location: Auckland / New Zealand
Posts: 3,165
Try here: http://bitworld.bitfellas.org/demo.php?id=14886
Codetapper is offline  
Old 23 January 2011, 08:19   #10
pmc
gone
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Quote:
Originally Posted by Lonewolf10
is it a group if there is only one member?!
Well... it works for me!

My "group" is me, myself and I. It's always nice to work with other people though.

Regarding the scrolling, it sounds like you're nearly there to be honest. Once you're using the delay bits to fine scroll as well it'll look fine.
pmc is offline  
Old 23 January 2011, 10:05   #11
TheDarkCoder
Registered User
 
Join Date: Dec 2007
Location: Dark Kingdom
Posts: 211
Quote:
Originally Posted by Lonewolf10 View Post



pmc and frank_b,

I have spent the afternoon coding a simple scroll routine that moves the screen left and right by adding/subtracting 1 byte from each of the BPLxPTL pointers until the right/left edge of the screen was reached. Then it scrolls back the other way.
I should be able to add in code to use BPLCON1 now and make it a smoother scroll. Thanks for guidance. The phrase "delay bits" threw me, I was thinking in terms of time delay (e.g. set the delay bits, set BPLCON1 and the hardware would automatically scroll it every X VBL ).

FYI, the screen contains the logo for my demo group (is it a group if there is only one member?!), which was kindly created by Greyfox a few months back.


Regards,
Lonewolf10
As far as I remember, the values stored in the bitplane pointers, should be even addresses. Usually ones add/subb 2 everytime the BPLMOD switches from $f to 0 (or the converse)

Shoudn't this thread go into the Coding Tutorial sub-forum ?

Last edited by TheDarkCoder; 23 January 2011 at 10:06. Reason: added question
TheDarkCoder is offline  
Old 23 January 2011, 10:42   #12
TCD
Registered User

TCD's Avatar
 
Join Date: Sep 2006
Location: Germany
Age: 43
Posts: 24,024
Quote:
Originally Posted by TheDarkCoder View Post
Shoudn't this thread go into the Coding Tutorial sub-forum ?
Your wish is my command
TCD is offline  
Old 23 January 2011, 11:56   #13
pmc
gone
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Quote:
Originally Posted by TheDarkCoder
As far as I remember, the values stored in the bitplane pointers, should be even addresses.
You're right, the pointers should point at even addresses (word aligned).
pmc is offline  
Old 23 January 2011, 13:26   #14
deicidal
Registered Insane

deicidal's Avatar
 
Join Date: Feb 2010
Location: Ununited Kingdom
Posts: 792
Quote:
Originally Posted by Lonewolf10 View Post
Does anyone know if the issues of Stolen Data are stored in one place somewhere?
Googling amiga "Stolen Data" revealed multiple sites with some issues on them (e.g. most are scattered all over the internet). I'm not going to download them tonight, as I am tired.
Just to add I am going to make an educated guess that it will be in one of the first 5 issues
deicidal is offline  
Old 24 January 2011, 00:08   #15
Lonewolf10
AMOS Extensions Developer
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 41
Posts: 1,924
Quote:
Originally Posted by TheDarkCoder View Post
As far as I remember, the values stored in the bitplane pointers, should be even addresses. Usually ones add/subb 2 everytime the BPLMOD switches from $f to 0 (or the converse)
That depends whether you fully use BPLCON1, hehe. Still not had a chance to add in the BPLCON1 code today, will hopefully do that tomorrow - unless I get distracted by Dune II (EAB/Lemon Amiga competition)


Quote:
Originally Posted by TheDarkCoder View Post
Shoudn't this thread go into the Coding Tutorial sub-forum ?
Yes, I was a douche and started it in the wrong forum

Quote:
Originally Posted by pmc View Post
You're right, the pointers should point at even addresses (word aligned).
Maybe I got it wrong and I did it every 2 bytes. I'll check tomorrow.


Quote:
Originally Posted by deicidal View Post
Just to add I am going to make an educated guess that it will be in one of the first 5 issues

I will check them first, thanks.


Added, 24th Jan 2011:

TheDarkCoder and pmc,

I just checked my code, and you guys were right. I was sticking to even addresses - I got it wrong, despite it being my own code!!
I'm still struggling with using BPLCON1 though - I can still only shift bitplane 0, instead of planes 0-4. I will read up on the guides mention in previous replies.


Added later on 24th Jan:

Quote:
Originally Posted by frank_b View Post
You need to set the odd and even delay to the same value in bplcon1
From memory a delay of $ff means no scroll and $00 means scroll playfield left by 15 pixels. You're only setting one of the values.
Urgh! How did I miss this the first time? Nevermind. I have got the scrolling working properly now


Added on 22nd March:

Quote:
Originally Posted by Codetapper View Post
Thanks for the link. I have just started reading through the issues
The examples in issue 2 don't seem to work. I have managed to get the examples from issues 1 and 3 to work though.
Already learnt quite a bit, now to read the other issues


Regards,
Lonewolf10

Last edited by Lonewolf10; 22 March 2011 at 22:59. Reason: Added additional info
Lonewolf10 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 with the mouse? BarrySWE support.Apps 14 29 May 2012 22:16
CD32 flickering scroll Akira support.Hardware 7 17 February 2012 15:03
Need a fluent scroll in WB dirs VoltureX support.Apps 6 29 November 2011 11:01
help me smooth scroll rusty71 support.WinUAE 7 21 November 2011 15:36
Games that didn't scroll smoothly - why not? crabfists Retrogaming General Discussion 89 19 February 2011 02:04

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 10:47.


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