The C64 has two Time of Day (TOD) clocks, one in each of its 6526 CIA chips U1 and U2. These calculate time based on a 60 Hz or 50 Hz input to the TOD pin (pin 19); the clock input frequency assumed by the CIA is selected via programming bit 7 (TODIN) of CRA (Control Register A) to 0 for 60 Hz or 1 for 50 Hz.
According to the C64/C64C Service Manual, 50 Hz or 60 Hz input to both TOD pins is generated from the 9 V AC power input converted to a TTL signal using one of the AND gates of a 74LS08 (U27). Though the schematic on page 21 claims that this is a 60 Hz signal, this will surely be 50 Hz in regions of the world where AC mains power is 50 Hz, since as far as I know the external power supply always generated unregulated 9 V AC from the from the region's AC mains via a transformer. (The schematic for a newer version of the board on page 32 does say "50 Hz OR 60 Hz" at the AND gate output/U2 input, though it still says just "60 Hz" at the U1 input.)
It doesn't seem possible to conclusively tell whether the input is actually 50 Hz or 60 Hz. Not only might someone run a PAL C64 in a 60 Hz mains power region (using that region's external power supply or via a step-down transformer), but the NTSC C64 was also sold in Japan, where consumers might have either 50 Hz or 60 Hz mains power, depending on region.
Did the Commodore-supplied software (Kernal, BASIC, other programs) have any facilities to set TODIN, or was that just always set to 60 Hz, causing the TOD clock to run 17% slow outside of North America, western Japan and other 60 Hz regions? (And did the software set the bit for both CIAs, or was there one that was considered the standard one to use?) How did third-party programs that relied on the TOD clock deal with this?
Bonus points if you can give the implications of all this for popular emulators. For example, Codebase 64's has an article "Initializing TOD clock on all platforms" which explains how to count screen cycles against a TOD clock set for 60 Hz input in order to figure out what the actual input should be. But it also says:
When running this in Vice, it will always end up detecting the Vice TOD Clock as 60Hz clocked and it will always be counting correct despite of this. In other words: Vice seems to ignore bit 7 of $dc0e and just always clock correctly.
Here are some related questions for even further bonus points. (I include these here since the answers are likely to be turned up during research for this question.)
- Did C64 BASIC use one of the TOD clocks, or can one check if the TOD clock is accurate only with PEEK/POKE or machine language?
- Were there any other components of the C64 that might also be affected by the 50 Hz vs. 60 Hz difference in the 9 V AC power supply?