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 > Excact Vertical Frequency / Refresh Rate
2017-07-18 21:22
TWW

Registered: Jul 2009
Posts: 545
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
chatGPZ

Registered: Dec 2001
Posts: 11386
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: 545
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: 490
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: 498
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: 545
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: 468
TOD does not use the kernal.
2017-07-19 20:39
chatGPZ

Registered: Dec 2001
Posts: 11386
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: 545
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
Flashback
Fred/Channel 4
morphfrog
hedning/G★P
iAN CooG/HVSC
wil
Wolk/Software of Swe..
zscs
Paladin/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 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 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (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 Fullscreen Graphicians
1 Joe  (9.7)
2 Sulevi  (9.6)
3 The Sarge  (9.6)
4 Veto  (9.6)
5 Facet  (9.6)

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