PAL and NTSC
"How to get confused"
Special thanx to AlphaSys
There have been some troubles with compatibility between Atari 8-bit computers with TV system PAL (Europe) and the ones with TV system NTSC (USA). During my adventure trough the world of Atari 8-bitters, I've never seen ANY clear article about the difference of these two systems.
After a little research and digging into old magazines I got more and more confused about PAL/NTSC.
Somewhere I read a clock frequency of 1.79 Mhz for NTSC and 2.21 for PAL.
In some Polish books/magazines they also claimed that our European Atari 8-bitters are 2.21 Mhz computers.
But in an old ATARI USER magazine they were talking about 3 Mhz for both systems and said that the difference was only in cycle stealing from ANTIC.
WHAT OTHER PEOPLE SAID
"Mapping the Atari" and "The Re-Atari" mention a clock frequency of 1.79 MHz. "Mapping" also says that European Ataris use one CPU clock at three MHz, so the 6502 runs at 2.217 MHz which is 25% faster than the American systems (I wonder where they got that info). The revised version of "Mapping" speaks of 1.78979 MHz (As you can read later, this is almost the correct number).
"Atari 600XL/800XL Intern" talks about a clock frequency of 1.773477 MHz (!).
Actually this book is a very good source for experienced programmers, because everything is explained in a very detailed and technical way.
The "Atari system reference manual" from Bob DuHamel mentiones the 3.579545 MHz clock crystal which gives 1.7897725 MHz if you divide it by two.
Then I got the bright idea of taking a look at the crystals inside my computer. Two crystals! This made the confusion complete for me.
ALPHASYS! PLEASE HELP! (I yelled)
PAL/NTSC TECHNICAL FACTS
PAL uses 50Hz netfrequency while NTSC works on 60Hz. This means that PAL TV's generate 25 pictures in one second on your TV screen.
And indeed, NTSC produces 30 pictures in one second.
Also, NTSC has 525 scanlines, while PAL has 625 scanlines! (100 more!)
Nice, but does it matter? Yes, this difference is fatal for some programs. Fortunately Atari was so smart to support both NTSC and PAL systems in their Operating System, so the normal (mostly not very spectacular) programs will work.
The old 400/800 models have different operating systems for NTSC and PAL. The new XL/XE series use only one O.S. for both systems. The O.S. itself figures out which system is used.
For example, there are timing tables for both systems, so there won't be troubles with communications.
Because of the scanlines difference, the O.S. adds lines to the Display List if it detects PAL.
Detecting PAL? How? There's one address in the GTIA chip at $D014 which holds a flag to determine NTSC or PAL.
Bit 1-3 clear (xxxx000x) : PAL
Bit 1-3 set (xxxx111x) : NTSC
It took me one phonecall with AlphaSys (the hardwarian) to find out about the real clock frequency of the European Atari 8-bit computers.
According to him it's 1.773447 Mhz!
So forget about all the nonsense of 3Mhz or 2.21Mhz. Ofcourse there also are NOT any illegal opcodes that make your computer run at 3Mhz (maybe you heard this from XL-soft?).
THE REAL CLOCK FREQUENCIES ARE:
PAL : 1.7734470 MHz
NTSC: 1.7897725 MHz
But why has a European (PAL) computer TWO crystals in stead of one???
Well, actually it's quite simple: (according to AlphaSys everything suddenly seems to be simple) In the NTSC-computers the color-clock can be devided out of the system-clock. This is impossible with the PAL-version: It would require a division by 2.8! As this is not possible, the computer got a second crystal-clock.
TIPS FOR PROGRAMMERS
As told before, you can read address $D014 to find out if it's a PAL or NTSC Atari. Use this as a flag to activate different routines for both systems, or just show a message on the screen if you made your program for just one system.
When using VBI's, remember that a VBI will be executed every 1/50 of a second on PAL systems and every 1/60 of a second on NTSC.
For example, VBI music will be played slightly faster on NTSC Atari's.
Also when using VBI's, keep this in mind: When programming on an european computer you have more time (read clock-cycles) for your VBI than you have on an american system.
PAL : 35468 clock-cycles/VBI
NTSC : 29829 clock-cycles/VBI
This means that the duration of a VBI in America can only be 84% of the duration of a VBI in Europe.
Don't worry about POKEY timing or sample playing in the main loop. The POKEY timers are almost independant from the screen frequency.
Concerning the display differences, as seen in the 'hardware manual' (Atari tm), scanline 0 will be positioned on screen at the same place for both systems (PAL/NTSC).
I hope it's all clear now.