Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user eightbitswide ! (Registered 2024-12-24) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Free cycles in raster line..
2005-09-16 11:32
Ben
Account closed

Registered: Feb 2003
Posts: 163
Free cycles in raster line..


Is there some sort of stable, line dense raster leaving some cycles per line free which can then be filled with instructions executed outside the IRQ?
 
... 15 posts hidden. Click here to view all posts....
 
2005-09-16 21:50
Ben
Account closed

Registered: Feb 2003
Posts: 163
Quote: That should be $0318/$0319, but it would be much better to use $fffa/$fffb.
Also the 7 cycles (or is it 6?) depend on the fact that the longest 6510 instruction is 7 cycles (eg "inc abs,x"). If you restrict which instructions you run, you will get less jitter. If you want it really stable you'll have to use the timer value to compensate, which won't leave many cycles at all for stuff to run in the background.


Damn.. I meant $0318/19 of course :: blush :: Where have I been with my mind!

Sure, I understand the source of the jitter.. Relying on $dc04/$dc05 would indeed get costly..
2005-09-16 21:58
WVL

Registered: Mar 2002
Posts: 902
also check out Ninja's routine from Real/The dreams+Resource. He wrote an article about it in some magazine. it's for a every-other-line-fli routine though, but you can use the basic ideas for your advantage!
2005-09-17 09:12
tlr

Registered: Sep 2003
Posts: 1790
Quote: Damn.. I meant $0318/19 of course :: blush :: Where have I been with my mind!

Sure, I understand the source of the jitter.. Relying on $dc04/$dc05 would indeed get costly..


Consider this: jmp ($dc04)
Set up one timer in cycle mode (presumably $3e cycles) to execute the jump. You might even be able to put $4c into $dc03 to run it from there.
Set up a separate timer that counts up. This will make the jump go to an address which will be one larger for every cycle you are late into the interrupt. You will have to restart this timer from each interrupt.
You could even try to start the up counting timer in the first raster line, and then layout one routine for each rasterline at addresses spaced $3e bytes appart. That way you wont have to restart the timer.
The penalty will be the jump + the 7-8 cycles of code to take up the jitter.
2005-09-17 09:39
Ben
Account closed

Registered: Feb 2003
Posts: 163
Quote: Consider this: jmp ($dc04)
Set up one timer in cycle mode (presumably $3e cycles) to execute the jump. You might even be able to put $4c into $dc03 to run it from there.
Set up a separate timer that counts up. This will make the jump go to an address which will be one larger for every cycle you are late into the interrupt. You will have to restart this timer from each interrupt.
You could even try to start the up counting timer in the first raster line, and then layout one routine for each rasterline at addresses spaced $3e bytes appart. That way you wont have to restart the timer.
The penalty will be the jump + the 7-8 cycles of code to take up the jitter.


Sounds like a clever piece of code. I really have to give this some thought :)
2005-09-17 09:44
tlr

Registered: Sep 2003
Posts: 1790
Quote: Sounds like a clever piece of code. I really have to give this some thought :)

I can't seem to find how to make the timer count upwards though, so maybe I mixed something up here. :P I'm pretty sure I saw someone do this using a jmp ($dc04) though.

2005-09-17 09:55
Ben
Account closed

Registered: Feb 2003
Posts: 163
Quote: I can't seem to find how to make the timer count upwards though, so maybe I mixed something up here. :P I'm pretty sure I saw someone do this using a jmp ($dc04) though.



Will (and if so when) $dc05 be reset?
I reckon that if the code you are executing is dynamic, you'd have to repeat this trick each line (rather than synchronizing it once for the whole raster).


2005-09-17 10:07
tlr

Registered: Sep 2003
Posts: 1790
Quote: Will (and if so when) $dc05 be reset?
I reckon that if the code you are executing is dynamic, you'd have to repeat this trick each line (rather than synchronizing it once for the whole raster).




Or duplicating your code for every rasterline evenly spaced in memory, which I was trying to say above.
But I'm not sure you can make it count upwards.
You could ofcourse do it with just one NMI timer set to cycle mode ($3e), and make a jump to ($dd03). This way you will get to a routine in a separate page depending on how late you are.
$dd03 is the data direction register for the user port, setting it to $00 would be safe because '0' means input.
Putting $4c into $dd02 could work also, but you will mess up stuff with the serial bus.
2005-09-17 10:58
Copyfault

Registered: Dec 2001
Posts: 478
Like Werner said: check out Ninja's 2x2-FLI-Routine in his and Oswalds Demo "Real". Ninja wrote some details about it in VN issue 43. The basic idea is to put $04/$dc in $fffe/$ffff and set timer A to lo=$4c hi=$xx. Then let Timer B trigger the NMI continously, starting with $3e. When the IRQ is called, the CPU reads some jmp $($3e-jitter)xx; now you just have to put 8 different jitter_correction_routines at the appropriate mem_areas. This way you get around the prob that timers do ALWAYS decrease; counting upwards sounds very new to me;)) And, ofcourse, it's the cheapest you can get concerning the "penalty cycles".

Check out VN#43 for details!
2005-09-17 11:06
Ben
Account closed

Registered: Feb 2003
Posts: 163
Quote: Like Werner said: check out Ninja's 2x2-FLI-Routine in his and Oswalds Demo "Real". Ninja wrote some details about it in VN issue 43. The basic idea is to put $04/$dc in $fffe/$ffff and set timer A to lo=$4c hi=$xx. Then let Timer B trigger the NMI continously, starting with $3e. When the IRQ is called, the CPU reads some jmp $($3e-jitter)xx; now you just have to put 8 different jitter_correction_routines at the appropriate mem_areas. This way you get around the prob that timers do ALWAYS decrease; counting upwards sounds very new to me;)) And, ofcourse, it's the cheapest you can get concerning the "penalty cycles".

Check out VN#43 for details!


Will do! Thanks!
2005-09-17 11:21
tlr

Registered: Sep 2003
Posts: 1790
Quote: Like Werner said: check out Ninja's 2x2-FLI-Routine in his and Oswalds Demo "Real". Ninja wrote some details about it in VN issue 43. The basic idea is to put $04/$dc in $fffe/$ffff and set timer A to lo=$4c hi=$xx. Then let Timer B trigger the NMI continously, starting with $3e. When the IRQ is called, the CPU reads some jmp $($3e-jitter)xx; now you just have to put 8 different jitter_correction_routines at the appropriate mem_areas. This way you get around the prob that timers do ALWAYS decrease; counting upwards sounds very new to me;)) And, ofcourse, it's the cheapest you can get concerning the "penalty cycles".

Check out VN#43 for details!


Putting the jump into $dc04/05 and trigger using timer B was a neat trick. Otherwise basically what I said in my last post.
Timers counting up... sorry for that. :P
It's been a really long time since I messed with this.
Previous - 1 | 2 | 3 - 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
Six/G★P
Guests online: 88
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 The Demo Coder  (9.6)
6 Edge of Disgrace  (9.6)
7 What Is The Matrix 2  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Cubic Dream  (9.6)
3 Party Elk 2  (9.6)
4 Copper Booze  (9.6)
5 X-Mas Demo 2024  (9.5)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Webmasters
1 Slaygon  (9.6)
2 Perff  (9.6)
3 Sabbi  (9.5)
4 Morpheus  (9.4)
5 CreaMD  (9.1)

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