Several techniques are available to programmers, as follows:
1) The XL OS (not the 400/800 OS) provides a flag called PALNTS at decimal memory location 98 (hex: $62). PALNTS indicates whether the CTIA/GTIA/FGTIA has reported itself to be NTSC or PAL/SECAM, where 0 means NTSC, or 1 means PAL/SECAM. In Atari BASIC, enter "? PEEK(98)" to determine the value of the PALNTS flag.
2) An approach which works on all 400/800/XL/XE systems is to use the same method used by the XL OS to set the value of the PALNTS flag described above. That is, to read and interpret the "PAL" memory flag, decimal location 53268 (hex: $D014). The value of PAL is provided by the CTIA/GTIA/FGTIA chip itself. Meanings are: Bit 1-3 clear (xxxx000x) = PAL/SECAM Bit 1-3 set (xxxx111x) = NTSC (Proper interpretation of the value returned by PEEK(53268) in Atari BASIC would thus be a bit of a programming challenge. This is left to the reader!)
3) Software may determine NTSC or PAL/SECAM by determining how many scan lines are being generated by ANTIC. This is done by monitoring the VCOUNT memory register. VCOUNT (54283 decimal, $D40B hex) is used by ANTIC to keep track of which line is currently being generated on the screen. Values reflect the line count divided by two. VCOUNT values range from zero to 130 for an NTSC ANTIC (131*2=262 scan lines), while VCOUNT values range from zero to 155 for a PAL ANTIC (156*2=312 scan lines).
|