Extracting Composite Video (Atari 2600)
The best way to generate the absolute best composite video signal from the Atari 2600 is to simply reconstruct the entire composite signal from the raw digital signals coming from the TIA.
The TIA provides the LUM0/1/2 pins (brightness), the SYNC pin for frame/line sync, and the CHROMA pin (color), which is all we need to form the composite signal.
NOTE: S-Video is just the COL pin attenuated to 600mVPP, and the LUMA+SYNC pins merged to 2VPP like the composite signal. So basically, the LUMA+SYNC and the COL signals separately, prior to being mixed together. Once connected to a 75 Ohm receiver like a TV that will half the signal levels to 300mVPP and 1VPP respectively, in accordance with the IRE specifications.
The SYNC pin stays at 5V and pulses to 0V when the frame or line start. This is already timed to be the SYNC signal of the composite signal so all we need to do is block the high 5V going into the final signal and only allow it to sink low.
We can do this with a diode or transistor. Just remember if using a diode, you won't be able to pull the line fully to 0V due to the voltage drop over the diode.
The LUMA Pins
The LUMA pins are 3 pins forming a 3-bit level of brightness about the video signal.
They are all 5V digital signals that pulse high and low during the pixel data section of the signal, and in order to for them into the analog voltage level we just combine them through a resistor-ladder.
Once we combine the 3 pins into a single output of analog voltage, we will have a 0 to 5V analog signal which indicates the 8 possible levels of brightness as a voltage level between 0 and 5V.
The composite video standard requires a range of 0.3V to 1V for the brightness level (so 0.6 to 2V disconnected voltage level). Using some additional pull-up resistors, buffers and voltage dividers you can form the signal into the desired level range.
The COL pin on the TIA is the Chroma information. It stays high 5V and then after the SYNC goes low, at the right time it pulses out the color burst information (a series of pulses between 0.3 and 4.2V amplitude).
If there is a game inserted, then the color information during the pixel data section of the signal is also output.
Removing DC Bias and DC Offset
In order to mix the color information into the composite final signal we must remove the DC aspect of the signal so only the bursts sit on top of the signal.
This is a little more tricky than a single pass, as we are basically 5V and pulled low, and we want the overall AC wave to sit central without a DC bias. The first step is to convert the 5V then low pulses, to having the pulses rest on top of a DC bias, and then after that removing that bias.
We want to basically move this DC offset to the center of the AC signal, without affecting the AC amplitude.
The first step we can do using a high pass filter of around 47pF followed by a pull-up resistor of around 1k.
The lower the resistor, the less the AC will be able to influence the DC bias = Low amplitude / wave shape distortion.
The higher the resistor, the more the AC will be able to influence the DC bias = Still has DC offset.
The lower the capacitor, the less the AC will be able to influence the DC bias = Still has DC offset.
The higher the capacitor, the more the AC will be able to influence the DC bias = Low amplitude / wave shape distortion.
As you can see, you need to balance the capacitor/resistor combination until the original signal gets filtered enough to keep a good central DC offset level and have the original AC signal ride on top of that wave, without the capacitor being too high that there is no filtering at all (output signal is identical to input, or AC is not fully central to DC offset), or too little (AC wave sits on DC bias but is attenuated so lower voltage than the original signal)
You will notice this is exactly how the Atari 2600 does this step.
This converts the COL pin now at the point where the capacitor and resistor meet, to the follow waveform where the original waveform sits on top of the 5V rail.
Next we want to remove this 5V DC offset, which can be done by using a capacitor. The easiest way to work out the best capacitor size is to lower the capacitance while using an oscilloscope to check the output vs input amplitude of the AC signal.
The lower the capacitor, the less the AC will be able to influence the final signal = Low amplitude.
The higher the capacitor, the more the AC will be able to influence the final signal = Adds DC bias.
Again, similar to the first stage, it is important to get the balance correct.
Improving Color Saturation On Original Atari 2600 Output
The Atari 2600 actually has an undersized capacitor which means the output signal is slightly attenuated compared to the input signal.
The above shows in yellow the original signal before DC bias removal, and in green after the 22pF filter. As you can see, the Vpp has dropped from 3.28V to 2.28V, meaning the signal is over-attenuated.
To fix this, add a 56pF or 68pF capacitor instead. This brings the output signal to very close to the input signal, meaning it is just enough but not over-saturated with an DC bias.
This will fix the final Chroma levels to be more accurate for the output.
Finally, to attenuate this voltage level down before mixing into the RF signal, the Atari 2600 just adds a resistor (in this case 6.8k) which reduces the amplitude. The higher the resistor, the lower the amplitude of the final signal prior to mixing into the LUMA+SYNC data. This resistor value can be chosen by monitoring the final mixed signal on an oscilloscope and adjusting until it has the perfect amplitude.
Again, the Atari 2600 (at least the PAL version) over-attenuates this value, and you can in-fact simply remove this resistor all together and replace it with a short, to improve color saturation. If you find the colors are too bright with a short, just lower the resistance from 6.8k until a value that works for your console. A great trick here is to use a 10k potentiometer instead of the fixed 6.8k resistor, to tune the saturation to your liking.
Final Chroma Signal
Once we have a pure AC signal with no DC offset, the final step is to get the signal down to 600mVPP signal level we can merge it into the LUMA+SYNC signal to form composite, before sending this signal out on the C pin of S-Video, along with the LUMA+SYNC signal on the Y pin of the S-Video to form S-Video.
To get the AC down to 600mVPP it is as simple as adding a resistor inline before combining with the LUMA+SYNC or S-Video output.
Constructing Composite Video
The signals from the TIA so far look like this:
And here is what the final composite video signal needs to look like:
As you can see, we need to go from a 0-5V digital logic signal to an analog mixed signal.
The first step is to mix the LUMA pins together through a resistor-ladder to form the brightness values (seen here labelled Luminance, and in purple).
Once we resistor-ladder the 0-5V signals into one, we then want to voltage divide them from 0-5V down to 0-2V signal, so a 2.5:1 ratio voltage divider.
After that we need to add back the 0.6V offset (blank level), which we can do by adding a pull-up resistor balanced with the resistor-ladder so that when the resistor-ladder is fully pulled low, the pull-up resistor has the correct strength to pull back up to 0.6V.
After that we must mix the SYNC pin back into the signal through a MOSFET setup in an open-drain configuration, to do nothing to the final signal when high, and sink to ground fully when low. This will allow the 0.6V offset and the LUMA signals to remain unaffected by anything except the low pulse.
Next, we need to add the CHROMA signal into the final signal. To do this we must first convert the COL pin as mentioned above into a pure AC signal and then simply mix it into this final signal pin.
Now the signal looks correct we must set the resistance of the final signal.
This is easily done by passing the output signal through a high-speed buffer or BJT transistor to make the signal low impedance, and then adding the correct 75-ohm resistor to the final output signal.