I have been working with the timing on the CIAs and have found that they are not giving the expected results.
For compatibility reasons, the CIA frequencies should be 1.022730MHz for NTSC and 0.985248MHz for PAL however, these are not the determined values. In fact, after testing the exact frequency when running in NTSC timing was indeterminate.
Using my program "Majere", I was able to generate metronome pulses and record these for analysis. The results are as follows:
The BPM values and associated ticks are accurate to approximately +/- 0.05bpm. Majere counts 48 pulses per quarter note ("beat"). The time per pulse is then 60000000 / BPM / 48 microseconds. The number of ticks required by the CIA for this period should be calculated by its frequency. For PAL, this seemed to be consistent but for NTSC, a constant factor could not be found.
It is likely that this timing issue affects other "devices" using the "1MHz" signal on the MEGA65, including the pitching of the SIDs. The NTSC timing likely requires some kind of correction however, if the timing cannot generally be changed, then the correct values should be formally published. If it is corrected, it is likely that some existing code will need to be patched.
I apologise for the code mess in Majere. I was intending on running it on VICE at some stage.
I have been working with the timing on the CIAs and have found that they are not giving the expected results.
For compatibility reasons, the CIA frequencies should be 1.022730MHz for NTSC and 0.985248MHz for PAL however, these are not the determined values. In fact, after testing the exact frequency when running in NTSC timing was indeterminate.
Using my program "Majere", I was able to generate metronome pulses and record these for analysis. The results are as follows:
NTSC
BPM CIA Ticks CIA Freq
110 $2BFF 0.991112 115 $2A13 0.991168 118 $2903 0.991126 120 $2854 0.991072 132 $24AA 0.991130
PAL
BPM CIA Ticks CIA Freq
110 $2B9F 0.982721 120 $27FD 0.982721 132 $245A 0.982721
Majere.zip
The BPM values and associated ticks are accurate to approximately +/- 0.05bpm. Majere counts 48 pulses per quarter note ("beat"). The time per pulse is then 60000000 / BPM / 48 microseconds. The number of ticks required by the CIA for this period should be calculated by its frequency. For PAL, this seemed to be consistent but for NTSC, a constant factor could not be found.
It is likely that this timing issue affects other "devices" using the "1MHz" signal on the MEGA65, including the pitching of the SIDs. The NTSC timing likely requires some kind of correction however, if the timing cannot generally be changed, then the correct values should be formally published. If it is corrected, it is likely that some existing code will need to be patched.
I apologise for the code mess in Majere. I was intending on running it on VICE at some stage.