clock frequency + some strange observation

Started by hannenz, January 26, 2008, 07:34 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

hannenz

hi. i am working on my extlib library for the Power-C environment (nearly finished) and converted the clock() function from c64 to c128. now i forgot to adjust the correct constant for the CLOCKS_PER_SECOND constant, which is 0.9852484e+6 - FOR THE C64 (PAL). As i mentioned i just kept with this constant, ported everything to c128, and.... strange. it still shows correct timing values although Power-C programs run in 2Mhz mode. Now if i count clock cycles between two events and divide the amount of elapsed cycles by CLOCKS_PER_SECOND shouldn't i get always "half" results if the CLOCKS_PER_SECOND constant is half as big as it should be???! Where is my error, where do i think wrong?? or does the CIA (which is used as timer) counting in 1Mhz cocks even if the proc. runs in 2Mhz mode???
and btw. what would be the exact clock frequency for a c128 running in 2 MHz mode?

hannenz

according to this article i found at http://www.floodgap.com/retrobits/ckb/display.cgi?444 my assumption that the CIA "counts at 1 Mhz" seems to be right... that's quite ok, so i can stick with just two defines, one for PAL and one for NTSC and don't have to mess with 1/2 MHz modes on c128.

Quote
The C-128 8502 in 2 MHz mode doesn't always run at 2 MHz.  VIC generates
the 2 MHz signal (dot clock divided by 4), and also a 1 MHz signal (dot clock
over 8).  The 1 MHz signal is fed to the CIA's and SID, so the timers and tones
are always correct.