Wanted to start a topic on this subject since I don't think it's really well-covered here, and to pick up any tips/tricks that other people know. Apologies in advance for anything you might consider "common knowledge" or obvious; I want to get it all down in one place.
There are two aspects to detecting PAL and NTSC: ANTIC and GTIA. In a stock PAL system, we all know that ANTIC runs at approx. 50Hz, NTSC-style hires artifacting does not work, and PAL multi-line color artifacting is in effect. And in an NTSC system, ANTIC runs at approx. 60Hz, NTSC artifacting works, and PAL artifacting doesn't.
However, another common system configuration is an NTSC system with a PAL ANTIC in it, meaning 50Hz but *with* NTSC artifacting (maybe) and *without* PAL colors. And though I have never heard of anyone actually doing it, it is also theoretically possible to fit an NTSC ANTIC into a PAL machine.
Thus I think it is really important to break down these items into separate considerations - especially when designing games.
ANTIC Considerations
Detecting a 50Hz ANTIC basically amounts to watching VCOUNT to see if it ever exceeds 131. The only way to know for sure is to disable IRQ and NMI and record VCOUNT: if VCOUNT is greater than 131 at that time then it's definitely 50Hz; else wait for it to either exceed 131 (50Hz) or cycle back to 0 (60Hz).
This simple technique should be used when you're considering timing for movement speed, music tempo, and other frame rate related items, and can even affect things like SIO and keyboard rates, so this is not necessarily limited to games.
GTIA Considerations
Detecting a PAL GTIA is really easy. Just read the PAL register ($D014) and check whether it reports PAL ($1) or NTSC ($F).
When a PAL GTIA is detected, it's a safe bet that you have PAL artifacting available (see
http://en.wikipedia....Colour_encoding for info; basically each line only encodes half of the color information and the other half is copied pixel for pixel from the previous line, which makes special modes like RIP/TIP possible but only nice-looking on PAL displays).
If an NTSC GTIA is detected, you will not have PAL color tricks available, however you may have NTSC hi-res artifacting available (in which single hires pixels take on either orange/blue or green/purple color depending on what GTIA you have and whether the pixel is in an even or odd column). However, many SVideo-equipped NTSC Ataris actually suppress this artifacting; for this reason (and for the reason that the actual colors vary depending on the GTIA), you may want to use caution before relying too heavily on this trick.
Another important consideration is that there is a subtle CPU clock speed difference between NTSC and PAL systems. An NTSC GTIA generally means your clock will be running at 14.31818÷8=1.78977 MHz. A PAL GTIA means 1.77344 MHz. This is a very small difference but it may be significant for your application, so it is important to know about it.
So...
It would be nice for every PAL game to run on NTSC systems which are equipped with a PAL ANTIC. For this reason it is important to have separate detection of 50/60Hz ANTIC versus PAL/NTSC GTIA. Granted there are many, many games which simply only work on NTSC or PAL, which is very unfortunate, but hopefully that time is in the past.
I would be very interested to hear anyone else's tricks and techniques related to this topic. Thanks!