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 > Cycles to get into IRQ routine
2015-05-20 04:17
Hypnosis

Registered: Mar 2015
Posts: 36
Cycles to get into IRQ routine

How many cycles does it take from an IRQ trigger to the start of the IRQ routine, assuming the CPU finished the instruction when it triggers? It should be around 6-9 cycles but I'm not sure how many.
 
... 53 posts hidden. Click here to view all posts....
 
2016-03-21 12:03
Flavioweb

Registered: Nov 2011
Posts: 447
Seven cycles are used to "setup things" and then go to irq first opcode.
Your code seems that trigger the irq on the second cycle of first nop, so the next opcode will be executed (next nop in this case).
So: irq triggered on second nop cycle, plus 2 cycles of next nop, plus seven cycles of irq "setup code": the first cycle of your irq code is executed 10 cycles after irq is triggered...
Edit: the irq is triggered on second nop cycle, probably because you are using an old cia, where irq is triggered 1 cycle "after". Maybe if you use a new cia, only first nop will be executed...
2016-03-21 16:49
Hypnosis

Registered: Mar 2015
Posts: 36
Thanks for the input. I'll try the other CIA. This could be it.
2016-03-21 19:04
Hypnosis

Registered: Mar 2015
Posts: 36
Yep. I get the expected behavior using the new CIA.
2016-03-21 19:08
Oswald

Registered: Apr 2002
Posts: 5017
"Seven cycles are used to "setup things" "

from what I was told, irq is a hacked JSR inside the cpu, probably the +1 cycle is the status reg to stack.
2016-03-21 20:09
Copyfault

Registered: Dec 2001
Posts: 466
To work around that 1-cycle CIA-irq-trigger-latency between the different CIA revision I always use the combination of raster irq + CIA timer for dejittering.

But I know there are situations in which the double timer method is a must... doesn't Codebase have some example code for CIA type detection including the corresponding code adjustments ready to use?
2016-03-21 20:22
chatGPZ

Registered: Dec 2001
Posts: 11114
if not, there are plenty such routines in the VICE testrepo :)
2016-03-22 06:09
Hypnosis

Registered: Mar 2015
Posts: 36
I solved it by treating it as another jitter cycle.
2016-03-22 07:53
JackAsser

Registered: Jun 2002
Posts: 1989
Quote: I solved it by treating it as another jitter cycle.

My standard approach as well, unless you really really need that one extra cycle in your super optimised raster code.
2016-03-22 07:58
Bitbreaker

Registered: Oct 2002
Posts: 500
And how can a demo effect profit from all this knowledge? :-D
2016-03-22 08:23
lft

Registered: Jul 2007
Posts: 369
Typical application: 8-bit sample playback. NMI triggers a routine which must be cycle-exact, and it happens 156 times per frame so every saved cycle matters.

When using distributed jitter correction (different code variants in the 0100-08ff range), you have to take the CIA difference into account. However, you don't necessarily have to detect the CIA version, it can be enough to initialise the timer from within an NMI handler.
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 - 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
TheRyk/MYD!
Brittle/Dentifrice^(?)
Didi/Laxity
taper/ΤRIΛD
Guests online: 134
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 Memento Mori  (9.6)
10 Bromance  (9.5)
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 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Wafer Demo  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (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 Crackers
1 Mr. Z  (9.9)
2 S!R  (9.9)
3 Antitrack  (9.8)
4 Mr Zero Page  (9.8)
5 OTD  (9.8)

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