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 > Facts about CIA and... question.
2015-02-12 17:04
Flavioweb

Registered: Nov 2011
Posts: 463
Facts about CIA and... question.

Obviously, correct me if i'm wrong.
- I know that CIA's counters $DC04..07, $DD04..07 never reach the value $00 during countdown, but $01 is repeated twice (EDIT: not $01, but the reset value is repeated twice).
- After that, i know that CIA's TOD alarm 1/10 seconds register, can't be set at value $00 otherwise the alarm does not work.
- Then i know that, if ICR is readed 1 or 2 cycles just before an IRQ generated by Timer B occur, then IRQ don't occur at all..
But... what are "the differences" between CIA revisions?
Not all of these bugs occur on all revisions or there are other differences?
 
... 3 posts hidden. Click here to view all posts....
 
2015-02-13 19:42
Flavioweb

Registered: Nov 2011
Posts: 463
Quote:
IIRC timer B doesn't double count either, only timer A.

Strange...
If this is correct, and no value is "doubled", means that a cycle is lost every countdown.
If i understand your sentence ...
2015-02-13 19:58
tlr

Registered: Sep 2003
Posts: 1790
Quote: Quote:
IIRC timer B doesn't double count either, only timer A.

Strange...
If this is correct, and no value is "doubled", means that a cycle is lost every countdown.
If i understand your sentence ...


to be clear: this is for all revisions of the chip. Timer B doesn't feature the counting anomaly of timer A.
2015-02-13 20:29
Flavioweb

Registered: Nov 2011
Posts: 463
Sorry, you will definitely clear for who knows more than me.
But i can't understand what you mean with "counting anomaly".
Are you talking about the fact that is impossible to read value zero from timers (A in this case) but, instead, reset value is used twice?
Or the meaning is different?
2015-02-13 20:43
tlr

Registered: Sep 2003
Posts: 1790
Quote: Sorry, you will definitely clear for who knows more than me.
But i can't understand what you mean with "counting anomaly".
Are you talking about the fact that is impossible to read value zero from timers (A in this case) but, instead, reset value is used twice?
Or the meaning is different?


That's what I ment, but thinking about it, it may only apply in chained (Timer B counts Timer A) situations.

I fiddled around with it a lot to get make r-load 0.3 working but can't remember the details at the moment.
Anyone has this fresh in memory?
2015-02-13 20:51
Flavioweb

Registered: Nov 2011
Posts: 463
Quote:
it may only apply in chained (Timer B counts Timer A) situations

This make sense now.
I'm pretty sure that both Timer A/B suffer from the "counting anomaly", but making Timer B counts Timer A, CIA could handle "zero" properly...
2015-02-14 12:41
Flavioweb

Registered: Nov 2011
Posts: 463
There is a strange thing i noticed.
I tested this only in Vice, not on RH, but seems if CIA has some problems handling "1 cycle" events.
Now i try to explain.
If we set Timer B to count Timer A with this:
    LDA #%00010000
    STA $DD0E
    STA $DD0F
    LDA #$01
    STA $DD04
    LDA #$00
    STA $DD05
    LDA #$04
    STA $DD06
    LDA #$00
    STA $DD07
    LDA #%01100001
    STA $DD0F
    LDA #%00000001
    STA $DD0E

then $DD06 reaches zero.
But if we set
    LDA #$00
    STA $DD04
    LDA #$00
    STA $DD05

$DD06 never reaches zero, but the "counting anomaly" appears.
This should be in relation with the time taken by CIA to clear and reset the counter: 1 cycle is probably not enough...
2015-03-05 02:14
White Flame

Registered: Sep 2002
Posts: 136
It's been a long time since I wrote that detection code, but this is what I remember:

Between the two CIA versions, if you set a timer for N cycles in continuous mode, both revisions will have that same exact number of cycles between IRQs, but at a 1-cycle "phase offset" compared to the other revision. IIRC, one will trigger the interrupt while transitioning to zero, the other will trigger after it has transitioned to zero. Both count through the same sequence of numeric states internally.

I use this for syncing the NMI to the screen for raster splits and DMA delay, while the IRQ is used from the VIC-II for sprite multiplexing. The same timer values are used regardless of the CIA revision, but which cycle the NMI timer is started depends on the revision.
2015-03-05 13:24
enthusi

Registered: May 2004
Posts: 677
I remember this being a pain for Hawkeye2 at X-Party ;-)
(there still is some bug-fixed-smile pic of yours somewhere)
2015-03-05 18:33
White Flame

Registered: Sep 2002
Posts: 136
That pain was that the demo machine ended up having 1 cycle of jitter more in its initial interrupt than I supported, or had seen before in VICE. It was a pain to figure out what was going on, but fortunately relatively easy to fix.

Inside my interrupt handler, I used the jitter value as an offset to INC some unused area and was able to build up a histogram of actual jitter observed. Using timer interrupts for cycle-accurate effects is nice because you can directly read the jitter amount from the CIA timer registers.

If I remember correctly, it's not that it had a 1-cycle phase offset to what I was expecting, but had a legitimately larger range of jitter possibilities for whatever reason.
2015-03-09 10:02
enthusi

Registered: May 2004
Posts: 677
That very moment:
Previous - 1 | 2 - 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
Trap/Bonzai
WVL/Xenon
MWR/Visdom
Unlock/Padua/Albion
REBEL 1/HF
Freeze/Blazon
Steffan/BOOM!
Didi/Laxity
sln.pixelrat
csabanw
Guests online: 113
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
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 Triad  (9.3)
5 Censor Design  (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.048 sec.