P2 Tile Driver for PAL Composite Video?
in Propeller 2
Hi,
is there a simple
tile driver for a composite video signal for a PAL monitor for P2?
To hopefully be able to understand it and for the reason to have low memory hunger, I would be happy with black and white or greyscale.
My P2 is running at 200MHz.
Thanks a lot, Christof

Comments
I've got a VGA tile driver for 1080p. Suppose that could be converted to composite...
Usages is fairly simple, a bit like P1 tile driver.
But, the driver itself is not simple...
@rogloh 's video driver can do text mode with PAL output if you want something that just works, but that one's very complicated.
My VNG driver set (MegaVGA etc) also does PAL (60Hz variant only) and the code is slightly less complex, but it exclusively displays line buffers that another cog needs to be rendering.
Other than that I don't think anyone did PAL.
Putting together a basic driver yourself is only slightly more complex than e.g. VGA. (I think I posted an example of that ages ago? Anyways it's like 5 minutes trivial)
For the simplest case of non-interlaced non-color, you just need to generate the same old
...->active->front porch->hsync->back porch->..sequence for regular lines and a long sync pulse for the VSync lines. (though you technically can't call that PAL at all, it'll work). Just need to get the timing right.Color requires splitting the back porch into 3 segments: the breezeway, color burst and the remaining back porch that doesn't have a catchy name. The hardware does the modulation for you, you just need to send the right "color" during burst (see below). For PAL (as opposed to NTSC) you also need to alternate the CY register between two values. Slightly tricky because CSC register are NOT buffered like the streamer commands are, so you need to change it at a time where you know that you're in blanking. I recommend doing it shortly after putting the HSync pulse command into the streamer (this ensures the streamer is in front porch)
These are the CY/CI/CQ register settings I use for NTSC and PAL (slightly cleaned up for clarity). You can't actually reach the correct levels for the summed luma+chroma signal with the 75Ω DAC mode (
P_DAC_75R_2V), so these are designed for use withP_DAC_124R_3Vmode.This is partially result of trial and error to get good colors on a variety of monitors, but everyone else's values (especially on the NTSC side) just look worse or cause issues. And you all know my perfectionism...
(For monochrome only, you'd simply set the IQSCALE constant to zero, then it'll not bother you)
CON ' CSC constant calculation ONE_IRE = 255.0 / 180.0 BLANKING_LEVEL = ONE_IRE*40.0 PEDESTAL = 0.0 'ONE_IRE*7.5 ' NTSC only, other standards (including NTSC-J) don't have pedestal BLANK_LEVEL = round(BLANKING_LEVEL) B2W_NTSC = ONE_IRE*100.0 - PEDESTAL YSCALE_NTSC = 127.0*(B2W_NTSC/255.0) IQSCALE_NTSC = YSCALE_NTSC * 1.33 B2W_PAL = ONE_IRE*100.0 YSCALE_PAL = 127.0*(B2W_PAL/255.0) IQSCALE_PAL = YSCALE_PAL * 1.33 ' Can't set correct amplitude (around 1.47) because weird overflow? CY_NTSC = (round(0.299*YSCALE_NTSC)&$FF)<<24 + (round(0.587*YSCALE_NTSC)&$FF)<<16 + (round(0.114*YSCALE_NTSC)&$FF)<<8 + round(BLANKING_LEVEL+PEDESTAL) CI_NTSC = (round(+0.5959*IQSCALE_NTSC)&$FF)<<24 + (round(-0.2746*IQSCALE_NTSC)&$FF)<<16 + (round(-0.3216*IQSCALE_NTSC)&$FF)<<8 + round(BLANKING_LEVEL) CQ_NTSC = (round(+0.2115*IQSCALE_NTSC)&$FF)<<24 + (round(-0.5227*IQSCALE_NTSC)&$FF)<<16 + (round(+0.3112*IQSCALE_NTSC)&$FF)<<8 + 128 CY_PAL = (round(0.299*YSCALE_PAL)&$FF)<<24 + (round(0.587*YSCALE_PAL)&$FF)<<16 + (round(0.114*YSCALE_PAL)&$FF)<<8 + round(BLANKING_LEVEL) CI_PAL = (round(-0.147*IQSCALE_PAL)&$FF)<<24 + (round(-0.289*IQSCALE_PAL)&$FF)<<16 + (round(+0.436*IQSCALE_PAL)&$FF)<<8 + round(BLANKING_LEVEL) CQ_PAL_ODD = (round(+0.615*IQSCALE_PAL)&$FF)<<24 + (round(-0.515*IQSCALE_PAL)&$FF)<<16 + (round(-0.100*IQSCALE_PAL)&$FF)<<8 + 128 CQ_PAL_EVEN = (round(-0.615*IQSCALE_PAL)&$FF)<<24 + (round(+0.515*IQSCALE_PAL)&$FF)<<16 + (round(+0.100*IQSCALE_PAL)&$FF)<<8 + 128 COLOR_BURST_NTSC = $7C9900_01 COLOR_BURST_PAL = $D8A351_01To perhaps clarify and because I was looking through some old files and found this one again: The breezeway is the bit of blanking that goes between the sync pulse (left edge) and the color burst.
Thank you, @Wuerfel_21 and @Rayman, for your inputs.
Up to now I have never understood, how colour is coded into a video signal. I have a very rough idea, that it is sent at another time than brightness.
I have used and modified @ersmith 's VGA tile driver. I think, I was able to understand that. So if I restrict this to BW brightness only it must be possible somehow to use only one DAC and to mix in the sync pulses?
Hm, now I had a look into some PDF about my monitor, which is a Hyundai L17T. If I understand that right, that particular monitor can also process NTSC.
OK, found this https://forums.parallax.com/discussion/177879/composite-video-driver and in there @rogloh 's driver. Yes, that is not, what I would call simple....
>
The composite video signal does everything all at once. Sync pulses are just negative pulses between the active video (this is why black/blank level is at ~0.3V, so the sync pulse can go down to 0 V). Color is just a 3.58 / 4.43 MHz (NTSC/PAL) carrier wave that rides on top of the brightness. The amplitude determines color saturation and the phase determines the hue. This alternatively expressed as quadrature modulation (where I/Q (or U/V) are the carthesian equivalents to polar hue/saturation). As mentioned, the P2 hardware does it for you.
Aha! Thank You, this is very enlighting for me!