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 > Horizontal d020 scroller
2015-02-04 21:15
xIII

Registered: Nov 2008
Posts: 210
Horizontal d020 scroller

I'm still learning ... and again I could use some advice.
I coded a d020 scroller that actually works :p

I'm having trouble with the stability (the scroller is jittering ?). I used the double IRQ routine but I just cannot get the timing correct.

If there's a coder out there who wants to help me by taking a look at the code, send me a msg with your email and I'll send you the kickasm code.

thanks.
2015-02-05 14:53
Oswald

Registered: Apr 2002
Posts: 5017
*if* the double irq is working you must have only 1 cycle jitter left. do this with the 1 cycle jitter:

lda $d012
sta $d020

by adding/removing nops bit $xx, etc. find the place (right edge of screen) where d020 color flickers, then you found the place where the raster counter is 'flickering' between two lines.

there you have to add this line:

lda $d012
cmp $d012 ;<- place of lda $d012 of prev code in timing
beq next
next

this adds +1 cycle when needed.

sometimes it was bne next, but never tought about it why, just hacked the code mindlessly. :o)
2015-02-05 14:57
Ninja

Registered: Jan 2002
Posts: 404
Double-check if all indexed addressing modes do not cross a page border. Also check if all branch instructions do not cross a page border. Especially the latter can easily slip through, so most people have a macro checking this for branches in timing sensitive code.
2015-02-05 21:47
xIII

Registered: Nov 2008
Posts: 210
Oswald: good tip. Double IRQ routine seems to be OK, this is confirmed by Flavioweb who was so kind to take a look at the code.

Flavio explained the problem and I'm trying to work out a solution.

I'm not sure if I understood it all very well but it seems that it has something to to with delaying cycles every frame.
2015-02-06 10:59
Flavioweb

Registered: Nov 2011
Posts: 447
Code is stable and works as it should.
The "glitch" is caused by a not complete "scroll" routine that, for now, -move- chars simply updating the "sta" for bgcolor in an "hardcoded" way, without modify the starting cycle for each frame.
This mean that the minimum step is 4 cycles, so 32 pixels, and this cause a poor scroll movement.
XIII should implement an "intermediate cycles delay" code, to cover 4 steps, each with 1 cycle difference from previous, to achieve a more "smooth" scroll fx.
I suppose this can be done with some self-modify code, that update itself, accordingly with a step-counter.
Same as is done with normal scroll routine, but done with cycles and for only 4 steps instead of 8...
I think is more simple to code that explain it...
2015-02-06 18:01
xIII

Registered: Nov 2008
Posts: 210
I came up with this routine:

		ldx timer1    // 3-2-1-0					2
		dex			// 2-1-0-ff					2
		bpl *+2			// taken-taken-taken-not	3-3-3-2
		dex			// 1-0-ff-fe				2
		bpl *+2			// taken-taken-not-not		3-3-2-2
		dex			// 0-ff-fe-fd				2
		bpl *+2			// taken-not-not-not		3-2-2-2
					// ------------------------>17-16-15-14


Later in the code:

		dec timer1
		bmi resettimer1 and do scroll
		jmp endirq



This helped for a smoother scoll but it still is not smooth enough.
2015-02-07 04:55
Flavioweb

Registered: Nov 2011
Posts: 447
You used this code just before "line1"?
Keep in mind that minimum "resolution" possible is 8 pixels, but this should give a decent scroll movement...
Ps: you have a mail. Give a look.
2015-02-09 21:32
xIII

Registered: Nov 2008
Posts: 210
Found this routine in Krestage which also does the trick (code is a little modified to my needs):

self_mod:	
		cmp ($00),y
	    jmp line1_entry                      // 59
    
delay:
		ldx timer1
		lda cycle,x
		sta self_mod
		rts

cycle: .byte $d1,$c9,$c5,$d5
2015-02-10 06:17
Flavioweb

Registered: Nov 2011
Posts: 447
Ok.
Nice way to do it.
With cycles in correct sequence, it should work as well...
2015-02-10 07:14
Oswald

Registered: Apr 2002
Posts: 5017
use this:

	sta timeit+1
timeit        bpl timeit+2
	.byte $a9,$a9,$a9,$a9,$a9,$a9,$24,$ea


by changing how far bpl jumps (sta timeit+1), you can change in a cycle exact way how much cycle is wasted. trick is that the last few bytes alternatively translate into bit $ea, or lda #$24 nop, giving one by one increments of extra cycles as you go.

code snippet from a 4x4 irq by ninja.
2015-02-10 13:40
Bitbreaker

Registered: Oct 2002
Posts: 500
take care of having a cia detection if you do things by timer though.
 
... 1 post hidden. Click here to view all posts....
 
Previous - 1 | 2 - Next
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
bOOZElEE
Flavioweb/🇮🇹HF..
Mr. Spock/T'Pau
Exile/Anubis
New Design/Excess
DjS/Silicon Ltd
Slaxx/Q/HF/MYD!
CA$H/TRiAD
Freestyle/Illusion
Tim/Silicon Limited
Low Spirit
encore
Clayboy
Guests online: 127
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Wafer Demo  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Logo Graphicians
1 Sander  (10)
2 Facet  (9.7)
3 Mermaid  (9.4)
4 Pal  (9.4)
5 Shine  (9.3)

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