| |
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.... |
| |
chatGPZ
Registered: Dec 2001 Posts: 11360 |
mmmh yeah i'd be interisted about "xbows method" too :)
afaik there are generally 4 ways... 1) dividing and busy waiting (bad, needs several rasterlines to sync) 2) double irq (prolly the way of choice for general use) 3) lightpen register fiddling (also bad, since it fucks up when pressing space) and last not least 4) double timers (might look more tricky than double irq, but has some neat properties and needs even less time to sync). the latter seems to be a little bit underestimated on c64 (on some other systems its the only way for stable raster)....hcl seems to like it however :o) |
| |
chatGPZ
Registered: Dec 2001 Posts: 11360 |
mmmh forgot... anyone tried to come up with a (preferably simple and reliable) way to detect if the cia delays one additional cycle or not then? :) |
| |
Graham Account closed
Registered: Dec 2002 Posts: 990 |
groepaz: there's a 5th way to achieve a stable irq, you can use a badline to correct the timing. this will mess up a few colors but in some cases this might be a good way to do.
and a 6th way: using sprites and well placed instruction you can have self-correcting timing. the earliest stable irqs accidently used that, for example in the old sideborder demos by 1001 crew. |
| |
Copyfault
Registered: Dec 2001 Posts: 475 |
Oops-I'm sorry, maybe I should have been more precise when I started this topic! I don't use double timers but a raster IRQ for the main interrupt and *one* timer to sync! Maybe there is another delay when combinig it that way???
Now about those "old" delaying CIA's: does this additional cycle only occur when triggering a timer IRQ, or do I get different timer values on entering an IRQ *in general*??? This would confuse me...
Did someone test this INC-BPL-BMI-loop? Like to know if I'm totally wrong with my assumption or not... |
| |
chatGPZ
Registered: Dec 2001 Posts: 11360 |
mmmmh...i remember the sprite thingy (never thought about using it for stable raster though...peacey used it for scrolling fli gfx around :=P) but could you explain what you mean by the "use a badline" thing? |
| |
Cybernator
Registered: Jun 2002 Posts: 154 |
The timer is triggered once each frame, rite? Do you trigger it _exactly_ at the same cycle each frame? If not, this could make additional cycle later. (According to my theory ;) |
| |
Copyfault
Registered: Dec 2001 Posts: 475 |
No, not once per frame! Before *any* IRQ occurs, I sync the timer so that it'll give me the same variance values on every non-bad-line Raster-IRQ! But unfortunatly these values lie within a range of 8! Also don't have a clue what other delay sources there might be... Isn't it possible that every *additional cycle* (those ones occuring when pagecrossing with a branch-instruction or pagecrossing with an indexed MW-instruction or when a branch-condition is fulfilled) cannot be interrupted? This would explain it at least... |
| |
MagerValp
Registered: Dec 2001 Posts: 1074 |
So maybe that's the problem then - you have a 0-1 cycle jitter in your timer stabilization routine, which together with 0-6 cycles of instruction jitter gives you 0-7 cycles jitter in the raster code.
|
| |
Cybernator
Registered: Jun 2002 Posts: 154 |
I've tested this on CCS and there's 8 cycle variance, too! The type of the CIA has nothing to do with this, because a raster-irq is used. Having the possibilities to freeze the program and check the position of the beam, I've placed a breakpoint at the IRQ. The cycle (Beam-X) was moving in range from $0B - $12.
Ok, let's count them (: $0B, $0C, $0D, $0E, $0F, $10, $11, $12. Something definitely ferments here. :)
And this is definitely the most interesting topic I've even seen.
@MagerValp: Forget my theory. ;-))) |
| |
Graham Account closed
Registered: Dec 2002 Posts: 990 |
whatever i do, i only get 7 variance values, even with that INC Bcc code. |
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 - Next |