Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Smooth horizontal bitmap scroller ($d016)
2011-01-16 22:55
8bitforever
Account closed

Registered: Oct 2009
Posts: 48
Smooth horizontal bitmap scroller ($d016)

8bitforever is back after a 14 month coding break.
I´m trying hard to develop a $d016 bitmap (koala pic) scroller. But it flickers sporadicly.
The jitter/flicker is a 1 char movement of the bitmap.

<-<-<-<-<-
__________
|JJOKOKOK|
|JJOKOKOK|
|JJOKOKOK|
|JJOKOKOK|
__________

JJ=Jitter or flicker area. This can happen in 15-25% of the screen area.
OK=Perfect smooth scrolling of the bitmap (koala pic).
<-=Horizontal Scroll direction.

No VSP/HSP suggestions please.
1) Why do I have jitter/flicker in 15-25% of the screen area ?
2) Suggestions on how get rid of the jitter/flicker ?

2011-01-17 00:28
FATFrost
Account closed

Registered: Sep 2003
Posts: 211
Did you check codebase64 for infos? maybe something there, if not just rip it and cred the original author, should be cool.

Also optimising will help a lot, and it will also help to look at other peoples scroller code to see what tricks are performed. ;)
2011-01-17 05:47
JackAsser

Registered: Jun 2002
Posts: 1995
Stupid question, but I must ask since you drew that IJJOK-picture so nice: Have you set the display to 38-column mode? (bit 3 of $d016)
2011-01-17 06:02
turtle
Account closed

Registered: Mar 2005
Posts: 44
remember to not let the rutine eat ratertime there you scroll ($d016)

that was my problem then i made my bitmap scroller
2011-01-17 06:57
8bitforever
Account closed

Registered: Oct 2009
Posts: 48
Yes, Jackasser,
the display is set to 38-column mode (bit 3 of $d016).
I only touch the last bits 0-2 of $d016 to smooth scroll.
2011-01-17 07:16
SIDWAVE
Account closed

Registered: Apr 2002
Posts: 2238
copy the chars+colors at the correct time ?

also, use an unrolled loop.
2011-01-17 08:22
JackAsser

Registered: Jun 2002
Posts: 1995
Quote: Yes, Jackasser,
the display is set to 38-column mode (bit 3 of $d016).
I only touch the last bits 0-2 of $d016 to smooth scroll.


Ok good, also please notice that you can't scroll a full bitmap without glitches using only the CPU unless you double buffer it. remeber lda+sta = 8c. 8*10000 = 80000 cycles. So what you need to do is to copy 1/8 of that amount each frame and on the 8th frame switch buffer ($dd00). During the 8th frame you must also copy the whole $d800 memory in one quick go properly synced to the raster line otherwise you'll get color-glitches.
2011-01-17 09:09
Ed

Registered: May 2004
Posts: 173
Quote: Ok good, also please notice that you can't scroll a full bitmap without glitches using only the CPU unless you double buffer it. remeber lda+sta = 8c. 8*10000 = 80000 cycles. So what you need to do is to copy 1/8 of that amount each frame and on the 8th frame switch buffer ($dd00). During the 8th frame you must also copy the whole $d800 memory in one quick go properly synced to the raster line otherwise you'll get color-glitches.

And it is even possible to load during meanwhile if you do it proper. I used to load demo parts with a 1-bit loader when I scrolled my bitmaps in Courtesy of Soviet....
2011-01-17 10:10
8bitforever
Account closed

Registered: Oct 2009
Posts: 48
Jackasser,
Actually it´s only a four char high bitmap.
So I don´t undeerstand why I cannot get rid of the jitter/flicker ?
2011-01-17 10:17
JackAsser

Registered: Jun 2002
Posts: 1995
Quote: Jackasser,
Actually it´s only a four char high bitmap.
So I don´t undeerstand why I cannot get rid of the jitter/flicker ?


4 char high bitmap with colors = (320+80)*4 = 1600. lda+sta = 8c => 1600*8 = 12800 ~= 69% cpu usage completly unrolled. Are you 100% sure you copy fast enough and also do it behind the raster beam?

1) Copy fast, really fast.
2) Start the copy just when the raster beam have passed those 4 chars.
3) update $d016 before you reach the chars again.
2011-01-17 10:52
8bitforever
Account closed

Registered: Oct 2009
Posts: 48
Thanks Jackasser,
going to check the code tonight again.
2011-01-17 12:25
Skate

Registered: Jul 2003
Posts: 492
it's been already said but problem is not about scrolling bitmap. you can have the same problem with a standard 1x1 char scroller as well. it's all about $d012. put a "inc $d020" before scroll routine and "dec $d020" after scroll routine and see if scrolling area is clean.

4 character lines (32 raster lines) are ideal for playing music. use that area for music and start scrolling from the bottom of that area.

if you try to scroll 4 char lines high bitmap using standard loops ( no unrolled code), you're gonna need 16410 cycles which takes %83.5 CPU. Since 4 character area means ~%10 CPU and it's enough for playing music, if you don't have much more things going on in the screen, you don't need to spend too much memory.
2011-01-17 15:25
TWW

Registered: Jul 2009
Posts: 541
You should/could still double-buffer it though if you are planning to do something more on that screen...


frame 1: Flipp buffer and scroll $d800 data

frame 2-7: Pull 2'nd buffer (bitmap & $0400 collors)

frame 8: flipp buffer and scroll $d800 data

frame 9-15: Pull 1'st buffer (Bitmap $ $0400 collors)

do from beginning!

You need to place out the graphics to scroll in both buffers aswell and in the correct time. Buit seeing your nice ascii gfx up there I'm sure you'll figgure it out 8-D

You should get away with a fraction of the raster time needed distributing it on 8 frames instead of doing it all on one.

Ofcourse it would eat more R-Time the faster the scroller goes (i.e scrolling 2 pixels at the time means you need to move the gfx faster)...

anyways, where was I....
2011-01-17 17:22
Digger

Registered: Mar 2005
Posts: 422
Or slow everything down (let's say you increment $D016 every 50 frames) and then trace carefully what happens in each shift. You'll get the point where the jitter appears and then it's easy to investigate further from there.
2011-01-17 22:35
8bitforever
Account closed

Registered: Oct 2009
Posts: 48
Thank you very much,
problem solved due to your excellent suggestions !
Thank you once again !
2011-01-19 14:24
Nitro
Account closed

Registered: Aug 2008
Posts: 13
About Digger's post: there's much better method, pressing ALT plus + enters pause mode, where you can step through individual frames by again using ALT and +.
Alt+Pause resumes normal work.
2011-01-22 17:20
Digger

Registered: Mar 2005
Posts: 422
@Nitro: Nice, is this in VICE?
2011-01-24 21:58
Zielok

Registered: Mar 2009
Posts: 6
Yes, this is in Vice.
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Proton/Finnish Gold
DKT/Samar
Mason/Unicess
icon/The Silents, Sp..
Monte Carlos/Cascade
Didi/Laxity
Isildur/Samar
DjS/Silicon Ltd
Airwolf/F4CG
Sentinel/Excess/TREX
Guests online: 95
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.7)
5 Edge of Disgrace  (9.7)
6 Aliens in Wonderland  (9.6)
7 Comaland 100%  (9.6)
8 Uncensored  (9.6)
9 No Bounds  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Rasterwave  (9.7)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Rainbow Connection  (9.5)
7 It's More Fun to Com..  (9.5)
8 Dawnfall V1.1  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Birth of a Flower  (9.5)
Top Groups
1 Nostalgia  (9.4)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 SHAPE  (9.3)
Top Original Suppliers
1 Black Beard  (9.7)
2 Derbyshire Ram  (9.5)
3 hedning  (9.2)
4 Baracuda  (9.1)
5 Jazzcat  (8.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.047 sec.