| |
Copyfault
Registered: Dec 2001 Posts: 475 |
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.... |
| |
WVL
Registered: Mar 2002 Posts: 899 |
@ 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! |
| |
Ninja
Registered: Jan 2002 Posts: 411 |
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. |
| |
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? :)
|
| |
Hoogo
Registered: Jun 2002 Posts: 105 |
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. |
| |
Ninja
Registered: Jan 2002 Posts: 411 |
@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? |
| |
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 :))
|
| |
chatGPZ
Registered: Dec 2001 Posts: 11360 |
@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. |
| |
Ninja
Registered: Jan 2002 Posts: 411 |
@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? |
| |
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)
|
| |
Oswald
Registered: Apr 2002 Posts: 5086 |
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 |