Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CIA timing incorrect and/or inaccurate #816

Open
M3wP opened this issue Jul 30, 2024 · 0 comments
Open

CIA timing incorrect and/or inaccurate #816

M3wP opened this issue Jul 30, 2024 · 0 comments

Comments

@M3wP
Copy link
Contributor

M3wP commented Jul 30, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant