Re: PET / cbm2 timing questions...

From: Ethan Dicks <ethan.dicks_at_gmail.com>
Date: Mon, 20 Dec 2010 15:38:31 -0500
Message-ID: <AANLkTi=V2PBFWsA4zezMDbKNFWFh66yyRv7QDX3B43ex@mail.gmail.com>
On Mon, Dec 20, 2010 at 1:36 PM, Groepaz <groepaz@gmx.net> wrote:
>
> hy!
>
> i am trying to fix some timing related stuff in vice... i don't know the pet

OK.

> - whats the exact cpu clock? is it really 1.0MHz ?

Yes.  Exactly (within the tolerance of the crystal).

The PET timing chain starts out with an higher-frequency crystal (8MHz
on a Static PET, 16MHz on a Dynamic PET) that's divided down through a
couple of stages to get a system 1.00MHz clock and some off-phase
clocks for various timing-related things (consult the schematics on
zimmers.net for specific destinations).

> i realise that according to the schematics it is

Exactly.

> however when i lower the clock to 0.999600Mhz, suddenly
> the "8296d diagnostics" program no more reports the 50Hz interrupt as bad (if
> editor rom 901474-04 (50Hz) is used) - which seems odd :)

That is odd.  This is on VICE, I take it.

Given that the system tick is *not* generated from mains (check the
PSU schematic - if it were, there'd be a diode between the mains-side
of the rectifiers and the 6502 IRQ line), "tick" is generated by one
of the VLSI chips (I forget which one right now).  The ROMs are
different for 60Hz and 50Hz machines, but the VLSI chips still
generate the interrupt pulse for the "jiffy" clock.  Perhaps there's
something subtly off with the 6520 or 6522 emulation?

> as a side node, above makes me wonder a bit on how accurate the timing of the
> 50Hz interrupt really is (or could be even, since the power line frequency
> isnt exactly stable)

From moment to moment, 50Hz (or 60Hz in the States) can be off by a
small amount due to load on the grid, but over 24 hours, in the States
at least, you should see something like 4320000 (5184000) total ticks
with close accuracy.  They do (here at least) tweak the total number
of ticks in one day to keep mains-powered alarm clocks accurate.
Without active compensation, system load would throw seconds or
minutes per day of inaccuracy into any clock that depended on mains
frequency.

> - ie why that diagnostic test can work properly (on a
> real machine) without considering a certain error, which would be well within
> the same that vice exposes for 1Mhz cpu clock (crtc setup ends up at sth like
> 50.025Hz or so). any ideas? :)

I would have to guess that it works fine on real hardware but some
aspect of the emulation isn't strictly conforming.

-ethan

       Message was sent through the cbm-hackers mailing list
Received on 2010-12-20 20:38:31

Archive generated by hypermail 2.2.0.