 
TWW
Registered: Jul 2009 Posts: 543 
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) 

 
chatGPZ
Registered: Dec 2001 Posts: 11334 
just calculate cycles per frame and you have the exact numbers. it differes a little bit from the regular PAL/NTSC refresh 
 
TWW
Registered: Jul 2009 Posts: 543 
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? 
 
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 
 
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. 
 
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. 
 
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 :) 
 
TWW
Registered: Jul 2009 Posts: 543 
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 
 
Stryyker
Registered: Dec 2001 Posts: 467 
TOD does not use the kernal. 
 
chatGPZ
Registered: Dec 2001 Posts: 11334 
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 shorttime measurements. 
 
TWW
Registered: Jul 2009 Posts: 543 
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 