Re: [stella] TIA VSYNC and VBLANK

Subject: Re: [stella] TIA VSYNC and VBLANK
From: "Eric Ball" <ericball@xxxxxxxxxxxx>
Date: Wed, 6 Oct 2004 21:57:38 -0400
Eric Ball:
> > Almost.  VSYNC causes the horizontal sync pulse timing to change from a
single ~4.7uS pulse per line to two ~27.3uS pulses per line.  These are the
"serration pulses" which cause the vertical retrace to occur.  (NTSC timing)

Adam Wozniak:
> Ack.  How is all this derived?
> The NTSC colorburst frequency is 3.579545 MHz.
> Divide by 3 to get a horizontal counter frequency of 1.1931816... MHz.
> 228 counts total per line.
> 160 counts of displayed pixels, followed by 68 counts of blank.
> 1 line takes 191.08573855 uS.
> The blank lasts 56.99 uS.
> Where does 4.7 uS come from?  Does it happen at the beginning or end of
the blank?  Where does 27.3 uS come from?

Those are the standard NTSC timings.  Let me provide some more details and
translate it into TIA equivalents.

An NTSC video line starts with a 4.7uS synch pulse.  All timings are
measured to the falling (leading) edge of that pulse.  After the horizontal
synch pulse there is 4.5uS of blank (called the back porch), 52.855uS of
active video, followed by 1.5uS of blank (front porch).  Also, 9 cycles of
colorburst are generated 0.6uS into the back porch.

The NTSC TIA has a single 3.5795MHz (colorburst) clock.  (The CPU clock is
1.19MHz and has no bearing on the TIA.) Which means the video signal
generated by the TIA will be slightly out of spec.  I'm also doing this
based on some assumptions, so my numbers may not be 100% correct.

When VSYNC = 0 (normal video), the TIA generates
17 cycles of sync (blacker than black)
2 cycles of blank
9 cycles of colorburst (COLU=$10)
20  cycles of blank
160 cycles of active video (centered)
20 cycles of blank

Note: the 6502 is released from HSYNC before the actual start of the line.
This is actually good for the VSYNC case because it gives the code a chance
to do the update before the sync pulse ends.

When VSYNC = 1 then the TIA generates
97 cycles of sync
17 cycles of blank
97 cycles of sync
17 cycles of blank

(Don't ask me about PAL; it's similar but different.  It has one clock for
processing and another for color.  NTSC is easier to understand.)

Current Thread