| |
Barbarossa
Registered: May 2007 Posts: 31 |
Sprite synchronisation
I am trying to get a stable raster with the help of sprite timing. I've read the articles in C=hacking about it, but it is not explained in full detail there. That is, when I look at the examples Missing Cycles and TechTech, I don't quite get it.
I've tried the timing of those examples in an emulator. I have found out that when the INC ends within the cycles that BA goes low, the intruction ends exactly after the sprite fetch. This would mean that the interrupt cannot be more off than 3 cycles and we all know that we have to deal with 2-9 cycles (7 cycles variance). So how can this trick be stable?
If someone could explain this to me (an article about this in Codebase would be really neat) I would be very grateful.
John
|
|
... 22 posts hidden. Click here to view all posts.... |
| |
Barbarossa
Registered: May 2007 Posts: 31 |
Quote: try this instead:
http://codebase64.org/doku.php?id=base:double_irq
shortly: the first irq it initiates a 2nd one, while the 1st irq executes nops the 2nd one will hit => only 1 cycle jitter left which is ironed by watching $d012 wether its in the current or the next line.
Oswald,
I already know and understand the double IRQ methode. It is the sprite synchronisation I don't understand. |
| |
QuasaR
Registered: Dec 2001 Posts: 145 |
Try this one: http://codebase64.org/doku.php?id=magazines:chacking3#the_demo_..
And no, just one sprite instead of all eight is enough to make the raster stable. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
the theory on how it works is pretty simple... as you probably know sprites steal cycles from the cpu (for details check the vic article). now the basic idea is to execute RMW instructions in the rasterline(s) where said sprites are displayed. the "missing" cycles will force those instructions to get executed in the "gaps" left by the sprites, which in turn will magically stabilize the whole thing. now how many sprites you use and what kind of instructions you execute in what order to stabilize is up to you (there are many ways to make this work). |
| |
Cybernator
Registered: Jun 2002 Posts: 154 |
@Barbarossa: As far as I can tell, you know how the method works, but you don't understand how it is possible to achieve this with just a single sprite and a single INC instruction.
This is Pasi Ojala's border routine, no? I think it just happens by accident that the jitter is small. Try scrolling the screen by hold crsr-down for a while and watch that strange flicker in the letters. :) |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
yeah with sprites you often get stable behaviour "by accident" ... like tlr said, this was quite common on the old days when coders often didnt quite exactly know what they were doing =) |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
I guess the main question here is, is it actually possible to achieve a stable raster within one scanline using only one sprite? I'm skeptical. If so, somebody please explain thoroughly. :) |
| |
Radiant
Registered: Sep 2004 Posts: 639 |
Krill: I've done it, but only with deterministic jitter (jmp *). Makes it kinda pointless. :-) |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
hmm maybe it is possible to make faster stabilization with sprites than with cia? :) |
| |
Radiant
Registered: Sep 2004 Posts: 639 |
Krill: Of course, if by "within one line" you mean "within the same line as the raster IRQ occurs", then it's impossible (no possible write cycle when BA is low until cycle 59 or something).
Now, if you use timer IRQ's... |
| |
Barbarossa
Registered: May 2007 Posts: 31 |
Quote: @Barbarossa: As far as I can tell, you know how the method works, but you don't understand how it is possible to achieve this with just a single sprite and a single INC instruction.
This is Pasi Ojala's border routine, no? I think it just happens by accident that the jitter is small. Try scrolling the screen by hold crsr-down for a while and watch that strange flicker in the letters. :)
Yes, I already noticed that. :-)
But this was on CCS64. I got real sinuses there instead of letters. When I tried it in Vice it was a lot more stable so I blamed the emulator. :-)
I also noticed that the IRQ-entry was always around the same point, which make sense since the only activity in the demo is a blinking cursor. But I thought Pasi would have taken more jitter into account of his routine (I thought it was a universal routine).
@Quasar
I have read that article. My question is based upon it. Although it is clear theoretically. He is not clear in explaining his own program.
So basically it is not possible to get a stable raster with one sprite on one line? You need more than one sprite and several rasterlines. |
Previous - 1 | 2 | 3 | 4 - Next |