On 06/02/2023 16:22, Philippe Mathieu-Daudé wrote:
Hi Mark & Laurent,
In commit d811d61fbc6 Mark defined VIA_TIMER_FREQ as 4700000 / 6
(783333.33) and in commit 6dca62a0000 Laurent defined it as 783360.
What is the correct value?
Could we define it once in include/hw/misc/mac_via.h or
even include/hw/misc/mos6522.h?
Thanks,
Phil.
Hi Phil,
The 6522 VIA has a 16-bit counter which is driven by an external clock crystal which
is set to 783kHz for Macs. Commit 6dca62a0000 is the correct value since that was
given in the Macintosh hardware documentation, and needs to be accurate since it was
used for timing in older Macs. The value in commit d811d61fbc6 came from Ben, and it
may be that this is how it is implemented on real PMU hardware by dividing a 4.7MHz
clock for compatibility purposes: certainly newer Macs have a much more accurate
hardware timer that would be used by the OS instead.
ATB,
Mark.