[stella] Re: Atari non-interlaced frame rate = ca. 59.922751 Hz?

Subject: [stella] Re: Atari non-interlaced frame rate = ca. 59.922751 Hz?
From: SeaGtGruff@xxxxxxx
Date: Sun, 21 Aug 2005 15:29:48 -0400
ericball@xxxxxxxxxxxx wrote:

> Yes, the frame & line rates of an NTSC VCS are slightly out of spec.
[...]

I suppose this also applies to other gaming and computer systems, with the 
actual numbers depending on their CPU speeds, etc. And I haven't tried to work 
out the numbers for a PAL VCS yet, at least partly because some of the 
information on the PAL numbers (for TVs) seems a bit vague, or seems to conflict 
slightly from source to source, so I've had to make some SWAGs. For example, I'm 
not sure how many "phantom" lines there are in the PAL vertical flyback. NTSC 
seems to be much better documented on the internet, at least as far as 
information that I can understand, or regarding some issues. (The actual PAL *signal* 
is quite well documented.) I *think* the following PAL numbers are correct:

Total lines (per field) -- 262.5 (NTSC) -- 312.5 (PAL/SECAM)
"Phantom" vertical flyback lines -- 20 (NTSC) -- 22.5 (PAL/SECAM)
"Active" lines* -- 242.5 (NTSC) -- 290 (PAL/SECAM)
Closed caption lines -- 1 (NTSC) -- 1 (PAL/SECAM)
"Truly active" lines -- 241.5 (NTSC) -- 289 (PAL/SECAM)
Cropped active lines -- about 1.5 (NTSC) -- about 1.5 (PAL/SECAM)
Visible active lines -- about 240 (NTSC) -- about 287.5 (PAL/SECAM)
Total visible lines (per frame) -- about 480 (NTSC) -- about 575 (PAL/SECAM)

* By "active" I mean the non-phantom lines which *don't* occur during the 
vertical flyback, even though one or more of them are actually "inactive" or 
blanked.

I know the exact frame rate doesn't really matter, except in situations where 
we're using the frame rate to drive a "real time clock," and want the Atari 
to keep precise time without losing or gaining seconds. It's just that all of 
the VCS docs mention a frame rate of 60 Hz, or 59.94 Hz, and it dawned on me 
that this couldn't be correct. The ~59.92 Hz frame rate doesn't seem to be 
mentioned anywhere, so I wondered if I was missing something.

> And a ideal NTSC VSC game has 262 lines or a frame rate of 59.92 Hz,
[...]

That's a good point; the frame rate would end up being slightly different if 
the game doesn't have the standard 262 lines.

> Your idea for a 3:1 interlaced screen is interesting, but I'm not
> sure whether it would work.

It would probably be a bit ugly, even if it did work-- the flickering would 
be annoying, and the colors probably wouldn't blend as well as one might hope, 
or might blend between adjacent triplets (or groups of RGB lines) in an 
unwanted fashion. But it might be interesting to try. Similarly, we could try 4:1 or 
higher ratios (at least in theory), which of course would flicker even more.

> You'd first have to time the VSYNC to occur 1/3rd of the way through
> the line,

If I understand correctly how 2:1 interlacing works on the Atari, that should 
be easy, at least as far as issuing the commands to the Atari. For 2:1 
interlacing, you issue every other VSYNC 114 color clocks, or 38 machine cycles, 
later than "normal," right? So for 3:1 interlacing, you'd issue the first VSYNC 
about 25 machine cycles late, then issue the second VSYNC about 51 machine 
cycles late, and then issue the third VSYNC "on time" (or actually 76 machine 
cycles late).

> and even then I'm not sure whether anything but a pure analog TV
> wouldn't try to compensate and fudge it back to a 2:1 interlace.

I see what you mean-- I think. The normal TV signal is constructed so a VSYNC 
can occur at the end of a line, or in the middle, but not in other places, 
right? However, if the Atari is sending a non-standard signal to the TV anyway, 
why couldn't you issue the VSYNC anywhere on the line?

To clarify, in the old posts where interlacing the Atari was first discussed, 
and then achieved, didn't the people who were working on that get the timing 
a little bit off at first, such that the lines of the odd and even fields 
weren't exactly halfway between each other? And by getting the timing better, they 
succeeded in separating the lines by the correct distance? So if 2:1 
interlaced lines can be knocked out of kilter by not getting the timing just right 
(i.e., if the TV didn't just fudge them back into place), why couldn't they be 
knocked out of kilter enough to get 3:1 interlacing?

Although, now that I think about it, wouldn't the shadow mask interfere? But 
perhaps it might work on a Trinitron TV? (Forgive me if I'm being stupid; I 
haven't studied TV technology before!)

And now that I think about it even more-- assuming that the shadow mask 
wouldn't interfere, and that the oddly-timed VSYNCs would work successfully on the 
TV-- we might be able to group the line triplets closer together, and separate 
the adjacent triplets from each other, by timing the VSYNCs as if we were 
using 4:1 interlacing, but then skipping the fourth field, as follows:

-------------------- < line of red pixels, first field
-------------------- < line of green pixels, second field
-------------------- < line of blue pixels, third field
                     < gap caused by skipping the fourth field
-------------------- < line of red pixels, first field
-------------------- < line of green pixels, second field
-------------------- < line of blue pixels, third field
                     < gap caused by skipping the fourth field
-------------------- < line of red pixels, first field
-------------------- < line of green pixels, second field
-------------------- < line of blue pixels, third field
etc.

First VSYNC -- on time
Second VSYNC -- delayed by 19 machine cycles
Third VSYNC -- delayed by 38 machine cycles
Fourth VSYNC -- on time
Fifth VSYNC -- delayed by 19 machine cycles
Sixth VSYNC -- delayed by 38 machine cycles
etc.

Of course, I've suggested using red for one field, green for the next, and 
blue for the next, but we could use any colors on any fields. For instance, we 
can get 15 shades of gray by flickering between two of the 2600's 8 shades of 
gray:

0/0, 0/2, 2/2, 2/4, 4/4, 4/6, 6/6, 6/8, 8/8, 8/A, A/A, A/C, C/C, C/E, E/E.

So by using three-way flickering (with or without interlacing), we should be 
able to get 22 shades of gray:

0/0/0, 0/0/2, 0/2/2, 2/2/2, 2/2/4, 2/4/4, 4/4/4, etc.

If my 2600 hadn't been stolen years ago, or if my 7800 still worked, and if I 
had the other things needed to try this on a real Atari and a TV, then I'd 
give it a whirl. I guess I could try it on my 65XE, but it's kind of 
dysfunctional, and I've never tried to get an interlaced screen on it. Right now I'm 
focusing on the 2600, using emulators, so I can't try out anything that the 
emulators aren't designed to do.

But if anyone is interested, I could write some code and post it, with the 
binaries, so that some of you could try running it on a real Atari.

Michael Rideout
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://stella.biglist.com

Current Thread