Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in 
CSDb User Forums


Forums > C64 Coding > Excact Vertical Frequency / Refresh Rate
2017-07-18 21:22
TWW

Registered: Jul 2009
Posts: 476
Excact Vertical Frequency / Refresh Rate

I am making a clock by using a CIA timer. Basically I calculate how many cycles are executed each second by calculating lines x cycles/line x vertical refresh rate.

I then want to make the clock run correct on all systems (NTSC/PAL/DREAN/NTSC_Old) and in this context, I was wondering what is the EXACT vertical refresh rates for these systems (50 and 60 plus 3 decimals or more)?

(I've found conflicting information around the web so that's why I'm asking)
2017-07-18 21:25
Groepaz

Registered: Dec 2001
Posts: 9534
just calculate cycles per frame and you have the exact numbers. it differes a little bit from the regular PAL/NTSC refresh
2017-07-19 06:33
TWW

Registered: Jul 2009
Posts: 476
GPZ: Maybee I missunderstood you but I already have calculated cycles / frame for all formats by doing:

Cycles/Line X Lines

Following example illustrate the PAL calculation:

    // PAL:
    //   Lines:                            312
    //   Cycles each Line:                  63
    //   Total Cycles each frame:       19.656
    //   Frames each second:                50,125
    //   Total cycles each second:     985.257


The framerate would impact the calculation quite a bit so it must be as exact as possible or is it as simple as PAL = 50,0000 Hz and NTSC = 60,0000 Hz?
2017-07-19 07:14
AmiDog

Registered: Mar 2003
Posts: 97
The framerate is the system clock divided by the number of cycles each frame, thus:

PAL: 985248/(63*312)=50.12454212
NTSC old: 1022727/(64*262)=60.99278387
NTSC new: 1022727/(65*263)=59.8260895
DREAN: 1023443/(65*312)=50.46563116
2017-07-19 08:59
oziphantom

Registered: Oct 2014
Posts: 409
Umm if you want 1 Second, use the TODs that will count 1 second on all the machines without any code changes.
2017-07-19 10:45
Style

Registered: Jun 2004
Posts: 496
Quote: The framerate is the system clock divided by the number of cycles each frame, thus:

PAL: 985248/(63*312)=50.12454212
NTSC old: 1022727/(64*262)=60.99278387
NTSC new: 1022727/(65*263)=59.8260895
DREAN: 1023443/(65*312)=50.46563116


are the clocks accurate? I can imagine there being some variation.
2017-07-19 11:15
AmiDog

Registered: Mar 2003
Posts: 97
I have no idea how accurate the crystals used in the C64 are, or what effects aging and temperature may have, or if all crystals used had the exact same frequency. I'm just using the best figures I've been able to find online :-)
2017-07-19 12:03
TWW

Registered: Jul 2009
Posts: 476
Thanks Amidog, that should be sufficient. Any variance is impossible to take into account and shouldn't matter much anyway.

Ozi: No KERNAL and special time trickery ;-)

EDIT:

For sake of good order:

    // PAL:        985.248 / (63 * 312) = 50,12454212
    // NTSC new: 1.022.727 / (65 * 263) = 59,8260895
    // NTSC old: 1.022.727 / (64 * 262) = 60,99278387
    // DREAN:    1.023.443 / (65 * 312) = 50,46563116
    //
    // PAL:
    //   Lines:                            312
    //   Cycles each Line:                  63
    //   Total Cycles each frame:       19.656
    //   Frames each second:                50,12454212
    //   Total cycles each second:     985.248
    //
    // NTSC New:
    //   Lines:                            263
    //   Cycles each Line:                  65
    //   Total Cycles each frame:       17.095
    //   Frames each second:                59,8260895
    //   Total cycles each second:   1.022.727
    //
    // NTSC Old:
    //   Lines:                            262
    //   Cycles each Line:                  64
    //   Total Cycles each frame:       16.768
    //   Frames each second:                60,99278387
    //   Total cycles each second:   1.022.727
    //
    // DREAN:
    //   Lines:                            312
    //   Cycles each Line:                  65
    //   Total Cycles each frame:       20.280
    //   Frames each second:                50,46563116
    //   Total cycles each second:   1.023.443


Edit2: Which then exactly translates to the system clock ;-) LOL
2017-07-19 19:45
Stryyker

Registered: Dec 2001
Posts: 465
TOD does not use the kernal.
2017-07-19 20:39
Groepaz

Registered: Dec 2001
Posts: 9534
more relevant: to make an actual clock - use the CIA TOD, it has excellent long term stability (more than the system clock). CIA timer is useful only for short-time measurements.
2017-07-19 22:37
TWW

Registered: Jul 2009
Posts: 476
Ah yeah, I mixed up TOD with the KERNAL TI... Totally forgot about it.

I chained two timers on CIA #2 to trigger a NMI which incremented the second counter. Guess I could just as easily use the TOD.

Just to confirm, is the TOD correct on all systems (PAL/NTSC/DREAN)?
 
... 20 posts hidden. Click here to view all posts....
 
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
Didi/Laxity
kezax
Bones99
Ghost/Excess
XTRO/Whoop
tlr
The Sarge/Fairlight
Guests online: 104
Top Demos
1 Uncensored  (9.7)
2 Edge of Disgrace  (9.6)
3 Coma Light 13  (9.6)
4 Memento Mori  (9.6)
5 Unboxed  (9.6)
6 Comaland 100%  (9.6)
7 The Shores of Reflec..  (9.6)
8 Lunatico  (9.6)
9 Remains  (9.5)
10 C=Bit 18  (9.5)
Top onefile Demos
1 Dawnfall V1.1  (9.5)
2 Gumbo Revised  (9.5)
3 Smile to the Sky  (9.5)
4 Daah, Those Acid Pil..  (9.5)
5 Listen to Your Eyes  (9.5)
6 Bad Boy  (9.5)
7 Crystal Gazer  (9.5)
8 Cuarentenauta  (9.5)
9 Instinct  (9.5)
10 The Tuneful Eight [u..  (9.5)
Top Groups
1 PriorArt  (9.4)
2 Booze Design  (9.4)
3 Censor Design  (9.4)
4 Fossil  (9.4)
5 Performers  (9.3)
Top Logo Graphicians
1 Mermaid  (9.4)
2 Pal  (9.3)
3 Jailbird  (8.9)
4 Elko  (8.9)
5 Shine  (8.8)

Home - Disclaimer
Copyright © No Name 2001-2020
Page generated in: 0.046 sec.