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 > Stable Raster via Timer
2003-12-28 19:40
Copyfault

Registered: Dec 2001
Posts: 466
Stable Raster via Timer

Maybe some of you advanced coders can help me with the following oddity. I'll keep out the basic routine for stabilizing rasters with the timer method, as it is presumably known to everyone!

If we ignore Illegal Ops for the moment, the max. number of cycles occuring in the main prog is 7 (when executing an indexed RMW). When it comes to the different values the variance can take, there should also be 7 (0 to 6 cycles). I wrote some (working!) routines, but I always end up having 8 different variance values. Of course one can live with it, but I wonder where this 8th state comes from!

If necessary, I'll deliver more details. I'd be really happy to understand this behaviour!

Yours, Copyfault
 
... 65 posts hidden. Click here to view all posts....
 
2004-01-05 14:27
WVL

Registered: Mar 2002
Posts: 886
@ Graham :

I tried to send you some e-mail, but your old cruise-adress doesn't work anymore, can you contact me? werner@vanloo.org!
2004-01-06 13:30
Ninja

Registered: Jan 2002
Posts: 404
First, a great new year to all of you who didn't get stuck in those "flame-discussions" ;)

@copyfault: yup, i also get 8 values.

@groepaz: Doc Bacardi once used a method with 2 timers. Well, he's crazy enough :)

@raven: I prefer using a timer because it's faster than double interrupt and I never needed all 4 timers at the same time up to now. But it's a matter of taste, after all...

BTW what is now the "Xbow-Method"? Back then, when GO64! was a magazine, he described at least 6 methods.
2004-01-06 17:56
Cybernator

Registered: Jun 2002
Posts: 154
Having 2 timers makes the stuff slightly easier. One of them is used to generate IRQs, while the other (the auxilary) is used to sync the raster. The auxilary timer follows the main one with a difference of a few cycles. Why would one do this? Simple, when the main timer generates IRQ, it counts-down from the start value (62). The auxilary timer will then have values in range from 0-7. So having the value, you do this:

lda #7
sec
sbc $value in auxilary timer
and #7 ; just in case :)
sta delay+1
lda #0

delay: beq <doesn't matter where :)>

lda #$a9
lda #$a9
lda #$a9
lda #$a9
bit $ea

- Neat, eh? :)
2004-01-07 07:52
Hoogo

Registered: Jun 2002
Posts: 102
Another very simple way I remember: You place 8 Sprites on the screen, each 8 Pixel to the right, overlapping. Then you watch the collision-register with lda, beq *-3. You find the jitter in the number of set bits. Not elegant, but very easy to do.
2004-01-07 11:17
Ninja

Registered: Jan 2002
Posts: 404
@Cybernator: But why would one use a timer just to generate IRQs when you can use Raster-IRQs instead? Well, I can think of some special cases but in general the Raster-IRQ will do fine, no?
2004-01-07 15:53
Cybernator

Registered: Jun 2002
Posts: 154
Let's suppose you want to do a 4x4 mode. An IRQ is generated every 8th rasterline. To achieve this with raster-IRQ, you'd need to add 8 to $d012 every time an IRQ occurs. If you use timer, you can set it to generate IRQ every 8*63 cycles, and you don't have to do anything, as the counter will start from beginning after it generates an IRQ (assuming it's in continuous mode :))
2004-01-07 18:03
chatGPZ

Registered: Dec 2001
Posts: 11111
@ninja: hehe i used the 2 timer thingy too in the mongobong thingy :) (infact its using 2 timers and raster-irq aswell). two timers seem to be much more useful than just one to me actually.
2004-01-07 18:15
Ninja

Registered: Jan 2002
Posts: 404
@Cybernator: Heh, I never used 4x4 :) Nevertheless, have you ever tried this? I remember rasterline $000 being one cycle off, or does this count just for the Raster-IRQ in line $000?
2004-01-07 20:08
Cybernator

Registered: Jun 2002
Posts: 154
I've only used dithered 4x4, 'coz the normal one don't look sexy enough. :) But they are technically the same. I start the timer right before the paper area, and I stop it after 25 interrupts. So the timer is resync-ed each frame.

I just wrote another routine, which starts the timer once, and I use raster IRQ. It works as well, so rasterline $000 also has 63 cycles. But the IRQ is generated at cycle 2, unlike the other rasterlines where it's generated at cycle 1 (counting cycles from 1-63). I still haven't tested this on the real thing. I'll do it right away, but first I need to add visual control. Anyway, the chances that it will work are 99.9% :)

Btw, I noticed that when I start the timer, it takes a few cycles (3?) until it starts the countdown. Is there any detailed info about the CIA? (A doc that explains the inner details, like the VIC-article does for the VIC-II)
2004-01-08 08:28
Oswald

Registered: Apr 2002
Posts: 5017
btw.. :) I havent coded a stable raster using CIA timers myself but I have a source... Now... I would like to put sprites over the routine. Is this possible ? And how should I change the routine to get it work ? I've checked what happens if I do this, but even one sprite messes up the routine way too badly... Maybe the solution is to make the interrupt happen as many cycles earlier as much the sprites eat up ? But in this case I need 2 timers... hmm anyone?:)
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 - 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
rikib80
cba
mutetus/Ald ^ Ons
Apollyon/ALD
Xiny6581/Dees Produc..
TheRyk/MYD!
Guests online: 87
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 Bromance  (9.6)
10 Memento Mori  (9.6)
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 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (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 NTSC-Fixers
1 Pudwerx  (10)
2 Booze  (9.7)
3 Stormbringer  (9.7)
4 Fungus  (9.6)
5 Grim Reaper  (9.3)

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