-------------------------------- VIDEO V 0.7 --------------------------------
-----------------------------------------------------------------------------
--------- routines to access the Video-Blaster and compatible cards ---------
-------------------------------------- (C) 1994-97 Bernhard Schwall ---------

Contents:

1.  Introdution
2.  Compilation of VIDEO
2.1  under Linux
2.2  under DOS
3.  Starting VIDEO
4.  VIDEO_SW
5.  VIDEO_X
6.  RECORD
7.  Where I got my information from
8.  Supported video cards
9.  Supported chipset
10.  Memory layout
11. Possible framerates
12. Tables
... ...
44. Tables
45. Author

1. Introdution

VIDEO is a program for using the VIDEO-BLASTER and videocards with the
C&T and Philips chipset, as ROMBO Media Pro+ under Linux and DOS without 
any driver.

It will only work with the original Video-Blaster from 1992 but not with
any newer like the SE100, FS200, RT300. See chapter 7 for more information
about this.

***************************************************************************
---IMPORTANT---IMPORTANT---IMPOTANT---IMPORTANT---IMPORTANT---IMPORTTANT---
***************************************************************************
To say this AGAIN: This program is ONLY for the original VB from 1992.
IT WILL NOT WORK WITH ANY OF THE NEWER VideoBalsters like SE100, FS200, RT300.
Don't ask me about them as I will never write any program for these cards
(I don't have any of them and don't have any infromation about them).
***************************************************************************
---IMPORTANT---IMPORTANT---IMPOTANT---IMPORTANT---IMPORTANT---IMPORTTANT---
***************************************************************************

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Caution !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
You use of this program on your own risk. There is no guarantee that this
program works correct and that it could not damage your Videocard or monitor.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

This program comes without any warranty. You are using it at your own risk.
The program is released into the public domain. You may use, modify, copy and
distribute this without restrictions but without charging money for it.


2. Compilation of VIDEO

To compile the program do the following steps:
Edit the file v_access.h if you want to enable the audio mixer for 
Media Pro Plus or SoundBlaster 16.

Uncomment the line 
#define MEDIA_PRO_PLUS_MIXER
if you have a Rombo Media Pro Plus and want to use it's audio mixer.

Uncomment the line
#define SB16_MIXER
if you have a Sound Blaster 16 and want to use it's audio mixer.

Comment out the line
#define MemAccess
if you have installed 16 MB ram or more. So you can see the live video but
can't save or load pictures.

Change the path in
#define ConfigPath "./"
to the path you would like to install the configuration file in.
Remeber to copy the file 'video.cfg' into this location.

If you have installed the libjpeg 6 (or 6a) and want to save the pictures as
JPG define
jpeg = 1
in line 9 of the Makefile. You also must set the path to the jpeg headers
and library if version 6 is not the standard version of your system (see
line 22 and 23 of the Makefile)


2.1 Compilation under Linux

If you don't have installed the vgalib or svgalib you have to do this before
compiling VIDEO. Then type "make" and the program should be made. If you get
into trouble edit the makefile and delete line 4 and 6. You have to compile
the program as root or you do not get permissions to the ports. After 
compilation you can start the program as non-root but be shure you only
start it once. There is no test for multiple execution.

Now rebuild the program and install it to the directory you want. Be shure to
copy the file VIDEO.CFG to the given dirctory.


2.2 Compilation under DOS

You have to use the DJGPP 1.X (tested with version 2.5.7). You should also
use GNU's make. Otherwise you have to modify the makefile. DJGPP 2.X will
only work for the live overlay but not for saving/loading (it now uses
DPMI :-((((((((((((((( ).
Type make and the program should be compiled. If you get an errormessage you
have to edit the makefile. Delete the first 6 lines of the makefile and there
should be no problem to compile the program. Now edit the file VIDEO.CFG (see
Section 3) and start the program.
With some modifications it is possible to compile the routines with Borland
C++, but then you can't use the memory-access or you have to rewrite it
completely. I've used this routines under Windows with Borland Pascal 7.0,
using DPMI for memory-access.
You have to change the port access in v_access.h for using BCC under DOS.
Please don't ask me how to access the memory as I didn't try this but it
should be possible by using a DPMI server under DOS/Windows.


3. Starting VIDEO

To start the Program first edit the file VIDEO.CFG. If you get an error-
message while starting the program you either typed an unknown name or
you've added blanks to a line. Delete them and try again. Lines beginning
with a '#' are ignored. All numbers must be given in decimal values. Ignore 
the lines not usable for your card (especially the 'Volume'-setting).
Especially you must set the port-address of your videocard, the memoryaddress
and the H- and V-sync of your VGA-card for the standard VGA-mode 0x12, 
640x480x4. The settings are the same as used by the original software under
Windows. So you can use this settings if the default settings don't give
you a good picture.
The volume setting is only usefull if you have a ROMBO Media Pro Plus or if
your audio is connected to the line-in of a SB16.



After editing VIDEO.CFG you can start the program by typing 'VIDEO'. The
following command line options are available:
-d   delete the memory of the videocard while initialisation.
     This should only be used if you have less then 16 MB ram installed and
     you've compiled with the option 'MemAccess' (see above). Otherwise you
     will crash your system.
-s XRes YRes
     set the resolution of the video. Default is 368x286.
-f Name.jpg
     save one frame as jpeg file to disk and exit the program. The Overlay
     isnt activated and no video mode change if done. You should set the
     resolution with the '-s' option. You must have jpeg support compiled
     in vid_main to use this option.

If you get the program start and see the live-video you can press the 
following keys:
'2'     : display the video with 680x512 (only usefull for PAL)
          this is the maximum resolution the VB can handle. Therefore a new
          videomode is created to show the video at fullscreen. If you don't
          have a multi sync monitor don't use this function.
'3'     : display the video with 640x480
'4'     : display the video with 368x286 (half size PAL)
'5'     : display the video with 320x240 (half size NTSC)
's'     : freeze or unfreeze the video
'l','+' : louder (volume on Media Pro+ and SB16)
'q','-' : quieter (volume on Media Pro+ and SB16)
'm'     : switch sound off and on (on Media Pro+ and SB16)
'w'     : save the picture in the actually shown resolution as TARGA-file
          with the name picXXX.tga, where XXX is a number between 0 and 999.
          The number is selected so that no file will be deleted, even if you
          start the program a second time having previor saved pics in the
          directory.
'g'     : read saved pics with the name picXXX.tga and display them in the 
          original size. XXX is a number between 0 and 999. The pics are
          loaded in revers order, first the picture with the highest number,
          then the picture with a lower number, and so on.
'j'     : save the picture in the actual shown resolution as JPG-file.
'h'     : change the HSync
'v'     : change the VSync
'b'     : activate some filter for displaying the video
'n'     : set the original filter.
'ESC'   : leave the program

About the save and load options:
Use this options only if you have less than 16 MB ram installed and set up 
your config file correctly. Otherwise you meight crash your system.

About the pictures:
Under Linux you have to use XV version 3.10 or ZGV version 2.7.


4. VIDEO_SW

If you have no problems running VIDEO (especially with saving and loading)
you could try to compile VIDEO_SW. VIDEO_SW is a demonstration program on how
to implement a software video not using the overlay. To compile it type
'make video_sw'.
While running VIDEO_SW you can use the keys '2', '3' and '4' for scaling the
video. The keys for audio control (if compiled in v_access.o) are available.
By pressing 'b' you can switch between grey and color display. Be warned
that the color display really looks ugly as it uses a 3:3:2 color depth for
RGB conversion. (Hicolor isn't supported by svgalib with my Trio64 card)
If you find the video stopping sometimes you can adjust the framerate within
the main routine of vid_sw.c.
For linux you must have installed and configured the svgalib to run
video_sw. For DOS you don't need the libgrx but you need DJGPP version 1.X.

The main reason for this program was to find out the maximum framerate the 
VB is possible to grab and to display the video without using the feature
connector. 


5. VIDEO_X

If VIDEO_SW is running or you can save pictures with VIDEO you can use
VIDEO_X for displaying a software video under X in HiColor and TrueColor
mode. VIDEO_X will only run with 15/16 bit display depth and a color weight
of 555/565 or in 24 or 32 bit TrueColor mode.
video_x has the following command line options:
-s SizeX SizeY  the horizontal and vertical size of the video
-t FPS          the maximum number of frames displayed per second
-n Number       number of frames recorded with 'r' (see below)

While running video_x the following keys are used:
's'     : freeze or unfreeze the video
'l','+' : louder (volume on Media Pro+ and SB16)
'q','-' : quieter (volume on Media Pro+ and SB16)
'm'     : switch sound off and on (on Media Pro+ and SB16)
'#'     : switch between the last two displayed frames if the video is
          freezed
'w'     : save frame as TGA file.
'r'     : record 'Number' frames without displaying them into the memory.
          After recording the frames you can spool throo these frames by
          using the cursor keys and save the displayed frame by pressing
          'w'. With ESC you leave the recording mode and return to the live
          display.

As you can see there are two options that have to be explained:

'#' switches between the last two displayed frames if the video is freezed.
This is nececary as it takes some time to convert the video frame into a RGB
pictunre for display under X. Normally you press 's' for freeze while the
next frame is already grabbed and under conversion. So you wouldn't get the
frame you want to save while you've pressed 's' but get the next frame. So
video_x holds both the last and the next frame in memory and you can choose
which one to save.

'r' was implemented to grab a series of frames as fast as possible (without
displaying) and choose form these frames which to save. This can be usefull
if you want to grab a single frame out of the live video without having a
good slowmotion on your VCR.
If you press 'r' a sequence of 'Number' (can be set with the option -v)
frames is grabbed into memory. You can spool throo these frames by using the
cursor keys and save frames by pressing 'w'. The window title does display
the actual frame number. By pressing 'ESC' you leave the record mode and
return to live video.
Be aware that all frames are grabbed into the memory so you must have enough
free memory for all frames. The ammound of memory needed can by calculated by
the following formula:
SizeX*SizeY*1.5*Number
There is also approx. SizeX*SizeY*2*4 memory allocated for the live video so
don't try to grab more than 20 frames with 640x480.



6. RECORD

If VIDEO_SW is running you could try to compile RECORD. RECORD is a simple
program for recording AVIs in 'stamp-size' format (up to 320x240). To compile
it type 'make record'.
record has the following command line options:
-s SizeX SizeY  the horizontal and vertical size of the video
-t FPS          the number of frames per second
-n Number       number of frames recorded
-a Type         type the AVI is saved as (YVU9 or RGB24)
-f Name.avi     filename for the AVI

Now you'll see a grey software live video in the selected resolution. If you
see the video stop sometimes you must select a lower frame rate.

While running video_x the following keys are used:
's'     : freeze or unfreeze the video
'l','+' : louder (volume on Media Pro+ and SB16)
'q','-' : quieter (volume on Media Pro+ and SB16)
'm'     : switch sound off and on (on Media Pro+ and SB16)
'r'     : record the video
'p'     : play a recorded video
'w'     : write the video as AVI file to disk

With 'r' you record Number frames into the memory. So there must be enough
  real free memory to hold all frames. Fortunately it's possible to use more
  than 16 MB under Linux if you can activate a memory hole at MB15 with your
  mainboard (see chapter 10 for details).
With 'p' you can view the recorded video (in grey scale) before saving it to
  disk.
With 'w' you write the recorded video as Name.avi to disk. As Format you can
  either select YVU9 or RGB24.
  YVU9  needs SizeX*SizeY*1.25 byte per frame for recording
          and SizeX*SizeY*1.25 byte per frame for saving.
  RGB24 needs SizeX*SizeY*1.5 byte for recording
          and SizeX*SizeY*3 byte for saving.
  The color quality for RGB24 is slightly better then YVU9 but it requires
  more time for saving, too. So you should use RGB24 if you want to extract
  single frames out of the AVI but YVU9 if you want to keep the whole AVI.

The AVIs can be viewed with any AVI viewer (e.g. XAnim, Media Player under
Windows) and edited with a video editor under Windows. It's also possible
to convert the AVI to MPEG under linux ro save more disk space.

The default values are: -s 240 180 -t 12 -n 50 -a YVU9 -f test.avi

Usefull sizes and frame rates are (on my AMD 5x86/133):
160x120 with 25 fps
200x148 with 15 fps
240x180 with 12 fps (sometimes 12.5)
320x240 with 10 fps
The frame rate can be set in .5 fps steps (e.g. 12, 12.5, 13).
As you can see in chapter 11 these frame rates are different to those
measured with a 486DX33. So if you 'overclock' your ISA-bus and have a fast
Pentium it could be possible to get a slightly higher framerate.

Remember: this is only a demo program. The user interface is very bad and
unconfortable. But it does what it was written for: record short video
sequences out of a live video and save them as AVI to disk.


7. Where I got my information from

All information I have is taken from the german computer magazine TOOL 10/91
to 02/92. This was a hardware project with a description of a video card
similar the VB created by Chips & Technologies. Unfortunately the magazine
stoped publishing before the project was ended so I don't have the complete
project. All usefull (and available) information about programming of the VB
is included in my routines. The routines published in the article are written
by C&T in assembler. I've converted them into C to use them under Linux.
Because Creative Labs doesn't give any information about the VB I can't adapt
my routines to the new VBs or even add the possibility of accessing the memory
of the VB if you have installed more than 8MB ram in your PC (or 15 with a
suitable mainboard, see memory layout).


8. Supported video cards

Cards which are reported to run with my software:

ROMBO Media Pro Plus (from Dec. 1992)
TV Movie Blaster (CPS)
Video Blaster Plus
Video Blaster CT6000 (the original one)

If you have another card working with my routines please let me know (with 
exact name and date of purchase if possible).

If you have more information about the VB please contact me so I can improve
the routines. I've got some infos from the original VB programming guide.
Unfortunately this requires the DOS driver shipped with the VB so this docs
are useless for programming under Linux.

The new VBs (SE100, FS200 and RT300) wouldn't run with this routines as they 
use a different chipset.

Looks like the problem with the memory access on some VBs (or was it the
mainbaord?) is fixed. These VBs don't like the memory access via a simple
32 bit pointer (or the byte by byte access to the memory). So now a buffer
for the line is used which is copyed to the VB using memmove. Hope this will
solve the problem. Thanks to Patrick from France for his help.

BTW sorry for the big message at the beginning of this file but I got so much
mails about the newer VBs that I'm really sick of it. And I will not answer
any of these mails any more.

But of course feel free to mail me if you've got any question about my program
running (or not running) with an original VB (or clone with the chipset
mentioned in chapter 9).


9. Supported chipset

The VB is mainly controlled by three chips (of course there are more chips
but these are the user programmable ones):

Philips: SAA9051, TDA4680: decode and digitize the analog video signal.

For the configuration of the SAA9051 see section 12-42. It handles the
decoding of the video signal.
To change the configuration of the SAA9051 you can use the function
V_wr_i2c(0x8a, Index, Value);
The standard configuration can be found in the routine V_Initialize in
Config2[0] .. Config2[11].

Sorry, but I don't have any information about the TDA4680. It handles the
color setup of the decoding. 
To change it's configuration you could use the function
V_wr_i2c(0x88, Index, Value);
The standard configuration can be found in the routines V_Initialize in
Config2[12] .. Config2[27].

Chips & Technologies: 82C9001A used to display and scale the video.

For the configuration of the 82C9001A see section 11. To change the
configuration of the 82C9001A you can either use the functions provided by
V_ACCESS.C or use the function
V_SetRegister(Index, Value).
To read the setup of the 82C9001A you can use the function
V_GetRegister(Index).
The standard configuration can be found in the routine V_Initialize. This
standard setup is changed in V_Initialize acording to the configuration file
VIDEO.CFG.


10. Memory layout

The VB has 768 KB on board which are mapped onto one MB on the ISA bus. 
That's the reason why you can't access the memory of the VB if you have
installed 16MB ram. As the ISA bus only has 24 address bits it's impossible
to map the memory to a higher address than MB 15. If you mainboard is able
to create a memory hole (as the ASUS PVI-486 SP3) you can activate a memory
hole at address F00000 with size 1MB and you're able to access the VBs memory
when setting the memory address to MB 15. Due to some problems with the last 
64 Kb you have to activate a 2MB memory hole at E00000 if you want to save
the picture with a resolution of 680x512 (PAL). This method will work under
DOS and Linux (tested with 2.0.29).
After a lot of testing I've found a way for using more than 16 MB main
memory and accessing the VB's memory, too (you'll only loose 1MB of real
memory for your other programs). This will only work under Linux as there is
no way to tell DOS/Windows to not use one MB of the memory.
1) get the unofficial reserve-mem-2.0.30.patch (or what the actual kernel
   number is) from http://www.linuxhq.com/upatch20.html.
2) Apply the patch to your kernel source and build the new kernel.
3) add the following booting options to lilo.conf:
   mem=32M  (or what ever your real memory size is, autodetect doesn't work)
   reservemem=0xf00000,0x100000
4) install the new kernel and reboot your system
5) while rebooting you must enable a 1MB memory hole at MB 15 in the bios of
   your mainboard.
6) set the memory address for the VB (in VIDEO.CFG) to MB 15
That's it. Now you've one MB less of main memory under Linux but are able to
access the VB's memory and use more than 15 MB main memory. Be aware that
you only have 15MB main memory under DOS/Windows until you disable the
memory hole in the bios again.

The baseaddress (calles BA) of the memory is set with the function 
V_SetVideoAddress. Each scanline is 2048 byte long (where only the first 1536
byte are real memory). There is a maximum of 512 scanlines in the memory. The
picture is scaled before it is digitized into the memory so you will find the
picture in the size set by V_SetWindowSize. Each line has the following
layout (at least if the input is PAL):

Four pixels are packed together in 8 byte:

(byte) B7 B6 B5 B4 B3 B2 B1 B0   bits 7-0 in the memory

(1)    Y6 Y5 Y4 Y3 Y2 Y1 Y0 **   Y value pixel 1
(2)    U6 U5 V6 V5 ** ** ** **
(3)    Y6 Y5 Y4 Y3 Y2 Y1 Y0 **   Y value pixel 2
(4)    U4 U3 V4 V3 ** ** ** **
(5)    Y6 Y5 Y4 Y3 Y2 Y1 Y0 **   Y value pixel 3
(6)    U2 U1 V2 V1 ** ** ** **
(7)    Y6 Y5 Y4 Y3 Y2 Y1 Y0 **   Y value pixel 4
(8)    U0 ** V0 ** ** ** ** **

The U and V values must be interpreted as a 7 bit _SIGNED_ char.
The U and V values are used for all four Y values of the block. So you have
a color depth of 4:1:1.

To convert the YUV values to RGB you can use the following routines:

input:
  unsigned char U,V    // the U and V values of the block
    and
  int Y[4]             // the Y values of the block
    
output:
  int r[4],g[4],b[4]   // the RGB values of the block

routine:

  int u,v,z;

  u = (U * 226) / 127;
  v = (V * 179) / 127;

  for (z=0; z<4; z++){
    if ((r[z]=y[z]+v) < 0) r[z] = 0;
    else
      if (r[z]>255) r[z] = 255;
    if ((b[z]=y[z]+u) < 0) b[z] = 0;
    else
      if (b[z]>255) b[z] = 255;
    g[z] = ((y[z]*436L) >> 8) - ((r*130U) >> 8) - ((b*50U) >> 8);
    if (g[z]<0) g[z] = 0;
      else
        if (g[z]>255) g[z] = 255;
  }

To use only the black and white image of course you don't have to combine the
U and V values and convert them into RGB. You only have to grab the Y values.
See the file video_sw for example. The VB will capture the video into it's
memory as long as it is activated (V_Initialize is called). This is even done
if the live overlay is not active (V_DisableVideo is called). So it's possible
to make a 'software' video under X in every resolution.


11. Possible framerates

The memory is only accessable if the video is freezed. If you want to get the
maximum framerate (if grabbing motion pictures) you should turn off the live
video display. With this I get the following frame rates when making a grey
'software' video (on a 486DX33):
320x240: 7.5 frames / sec
240x180: 10  frames / sec
160x120: 25  frames / sec
If you try to grab more than the maximum framerate the VB hasn't enough time
to digitize the video and you will grab the old picture. For testing the speed
you could use video_sw if you are using Linux. Unfortunately the VB doesn't
create an interrupt after a new picture is grabbed (at least my Media Pro
Plus doesn't so I can't test it even if the VB would do it).
To get the maximum frame rate you shouldn't use V_WaitGrabbed(). This will
wait until a new picture really is grabbed but most of the time you can get
higher perfomance if you use the timer like I've done in video_sw.


12. Tables

Thanks to Casey Ryder for converting my original scans into an ASCII file. So 
it's much easier to read and use it.


13. The 48 Control registers of the 82C9001A

Register 	Group		Name			Index	R/W-Access
----------------------------------------------------------------------------
RX		--		Index Register		--	RW
--------------------------------------------------------------------
R00		CPU-Interface	R/W-Address		0x00	RW
R01		CPU-Interface	Memory Access		0x01	RW
R06		CPU-Interface	Memory-Base Address	0x06	RW
R07		CPU-Interface	Luminance Mask		0x07	RW
R08		CPU-Interface	Chrominance Mask	0x08	RW
R09		CPU-Interface	Interrupt Mask		0x09	RW
--------------------------------------------------------------------
R10		Gen.Purp. IO	GeneralPurpose IO 0	0x10	EXT
R11		Gen.Purp. IO	GeneralPurpose IO 1	0x11	EXT
R12		Gen.Purp. IO	GeneralPurpose IO 2	0x12	EXT
R13		Gen.Purp. IO	GeneralPurpose IO 3 	0x13	EXT
R18		Gen.Purp. IO	GeneralPurpose IO Ctrl	0x18	RW
--------------------------------------------------------------------
R20		Video		Video Acquisition mode	0x20	RW
R21		Video		Window Control		0x21	RW
R22		Video		Window X-Start low	0x22	RW
R23		Video		Window X-Start high	0x23	RW
R24		Video		Window Y-Start low	0x24	RW
R25		Video		Window Y-Start high	0x25	RW
R26		Video		Window X-End low	0x26	RW
R27		Video		Window X-End high	0x27	RW
R28		Video		Window Y-End low	0x28	RW
R29		Video		Window Y-End high 	0x29	RW
R2a		Video		Acquisition Adr. low	0x2a	RW
R2b		Video	 	Acquisition Adr. mid	0x2b	RW
R2c		Video		Acquisition Adr. high	0x2c	RW
R2d		Video		Horizontal Scale	0x2d	RW
R2e		Video		Vertical Scale		0x2e	RW
R2f		Video		Scaling Field Adj.	0x2f	RW
R30		Video		Input Video Start	0x30	RW
R38		Video		Scaling Control		0x38	RW
-------------------------------------------------------------------
R40		Display		Display Area Control	0x40	RW
R41		Display		Window X-Start low	0x41	RW
R42		Display		Window X-Start high	0x42	RW
R43		Display		Window Y-Start low	0x43	RW
R44		Display		Window Y-Start high	0x44	RW
R45		Display		Window X-End low	0x45	RW
R46		Display		Window X-End high	0x46	RW
R47		Display		Window Y-End low	0x47	RW
R48		Display		Window Y-End high	0x48	RW
R49		Display		X-Panning low 	 	0x49	RW
R4a		Display		X-Panning high 		0x4a	RW
R4b		Display		X-,Y-Panning high 	0x4b	RW
R4c		Display		MSB Column & Row Start 	0x4c	RW
R4d		Display		Sync Polarity/Zoom 	0x4d	RW
R4e		Display		Color Compare 		0x4e	RW
R4f		Display		Color Mask 		0x4f	RW
R50		Display		Interlace-out Control 	0x50	RW
--------------------------------------------------------------------
RFF		Misc.		Global Enable/Version	0xff	RW
--------------------------------------------------------------------


14. Configuration registers of the Multi-standard decoder SAA9051

Function           Subaddress    DataByte
			         D7    D6    D5    D4    D3    D2    D1    D0
--------------------------------------------------------------------------------
Increment Delay IDEL  	   00	 A07   A06   A05   A04   A03   A02   A01   A00
HSY start time		   01	 A17   A16   A15   A14   A03   A12   A11   A10
HSY stop time		   02	 A27   A26   A25   A24   A23   A22   A21   A20
HC start time		   03	 A37   A36   A35   434   A33   A32   A31   A30
HC stop time		   04	 A47   A46   A45   A44   A43   A42   A41   A40
HS start time (after PHI1) 05	 A57   A56   A55   A54   A53   A52   A51   A50
Horizontal Peaking	   06	 BY    PF    BP2   BP1   COR2  COR1  AP2   AP1
Hue control		   07	 A77   A76   A75   A74   A73   A72   A71   A70
Control 1		   08	 HPLL  FS    VTR   CO    ALT   YPN   CCFR1 CCFR0
Control 2		   09	 VNL   OEY   OEC   X     CI    AFCC  SS1   SS0
Control 3		   0a	 SYC   CT    YC    SS3   SS2   YDL2  YDL1  YDL0
SECAM delay compensation   0b	 X     SCDC6 SCDC5 SCDC4 SCDC3 SCDC3 SCDC1 SCDC0 
Reserved	 	0c-0f	 X     X     X     X     X     X     X     X
--------------------------------------------------------------------------------


15. Parameters for IDEL and the resulting timing  (CC=central counter)

Decimal        Delay Time                       Control Bits
Multiplier    (Step size= 2/13.5 MHz=148ns)     A07 A06 A05 A04 A03 A02 A01 A00
--------------------------------------------------------------------------------
-1 to -110    -148 ns (minimal value)            1   1   1   1   1   1   1   1
-1 to -110    -16.3 us (outside avail. range)    1   0   0   1   0   0   1   0
-111 to -214  -16.44 us                          1   0   0   1   0   0   0   1
-111 to -214  -31.7 us (max. val. if FS=1)       0   0   1   0   1   0   1   0
-215          -31.85 us (outside CC if FS=1)         0       0       1       0 
-216          -32 us (max. val. if FS=0)         0   0   1   0   1   0   0   0
-217 to -256  -32.148 us (outside CC if FS=0)        0       0       1       0
-217 to -256  -37.9 us (outside CC)              0   0   0   0   0   0   0   0
--------------------------------------------------------------------------------


16. Start Time control

Decimal       Delay Time                     Control Bits
Multiplier   (Step size= 1/13.5 MHz= 74ns)    A17 A16 A15 A14 A13 A12 A11 A10
--------------------------------------------------------------------------------
+191 to +1   -14.2 us (max. negative val.)     1   0   1   1   1   1   1   1
+191 to +1   -0.074 us                         0   0   0   0   0   0   0   1
0            0 us reference point              0   0   0   0   0   0   0   0
-1 to -64    -0.074 us                         1   1   1   1   1   1   1   1
-1 to -64    +4.7 us (max. positive val.)      1   1   0   0   0   0   0   0
--------------------------------------------------------------------------------


17. HSY signal stop-time control

Decimal       Delay Time                     Control Bits
Multiplier   (Step size= 1/13.5 MHz= 74ns)    A27 A26 A25 A24 A23 A22 A21 A20
--------------------------------------------------------------------------------
+191 to +1   -14.2 us (max. positive val.)     1   0   1   1   1   1   1   1
+191 to +1   -0.074 us                         0   0   0   0   0   0   0   1
0            0 us reference point              0   0   0   0   0   0   0   0 
-1 to -64    +0.074 us                         1   1   1   1   1   1   1   1 
-1 to -64    +4.7 us (max. positive val.)      1   1   0   0   0   0   0   0
--------------------------------------------------------------------------------


18. Start time range

Decimal       Delay Time                     Control Bits
Multiplier   (Step size= 1/13.5 MHz= 74ns)    A37 A36 A35 A34 A33 A32 A31 A30
--------------------------------------------------------------------------------
+127 to +1  -9.4 us (max. negative val.)       0   1   1   1   1   1   1   1
+127 to +1  -0.074 us                          0   0   0   0   0   0   0   1
0            0 us reference point              0   0   0   0   0   0   0   0
-1 to -128  +0.074 us                          1   1   1   1   1   1   1   1
-1 to -128  +9.5 us (max. positive val.)       1   0   0   0   0   0   0   0
--------------------------------------------------------------------------------


19. HC sync. stop time control

Decimal       Delay Time                     Control Bits
Multiplier   (Step size= 1/13.5 MHz= 74ns)    A47 A46 A45 A44 A43 A42 A41 A40
--------------------------------------------------------------------------------
+127 to +1  -9.4 us (max. negative val.)       0   1   1   1   1   1   1   1
+127 to +1  -0.074 us                          0   0   0   0   0   0   0   1
 0           0 us reference point              0   0   0   0   0   0   0   0
-1 to -128  +0.074 us                          1   1   1   1   1   1   1   1
-1 to -128  +9.5 us (max. positive val.)       1   0   0   0   0   0   0   0
--------------------------------------------------------------------------------


20. Start of HS relative to PHI1 clock signal (CC=central counter)

Decimal       Delay Time                     Control Bits
Multiplier   (Step size= 4/13.5 MHz= 296ns)   A57 A56 A55 A54 A53 A52 A51 A50
--------------------------------------------------------------------------------
+127 to +109  Forbidden; outside CC range          0       1        1      1
+127 to +109  Forbidden; outside CC range          0       1        1      0
+108 to +1    -32 us (max. neg. val.)          0   1   1   0   1   1   0   0
+108 to +1    -0.296 us                        0   0   0   0   0   0   0   1
0             0 us reference point             0   0   0   0   0   0   0   0
-1 to -107    +0.296 us                        1   1   1   1   1   1   1   1
-1 to -107    +31.7 us (max. pos. val.)        1   0   0   1   0   1   0   1
-108 to -128  Forbidden; outside CC range          1       0       0       1
-108 to -128  Forbidden; outside CC range          1       0       0       0
--------------------------------------------------------------------------------


21. .. and stop time; both depend on the FS-flag in register 0x08

Decimal       Delay Time                     Control Bits
Multiplier   (Step size= 4/13.5 MHz= 296ns)   A57 A56 A55 A54 A53 A52 A51 A50
--------------------------------------------------------------------------------
+127 to +107  Forbidden; outside CC range          0       1       1       1
+127 to +107  Forbidden; outside CC range          0       1       1       0
+106 to +1    -31.8 us (max. neg. val.)        0   1   1   0   1   0   1   0
+106 to +1    -0.294 us                        0   0   0   0   0   0   0   1
0             0 us reference point             0   0   0   0   0   0   0   0
-1 to -107    +0.294 us                        1   1   1   1   1   1   1   1
-1 to -107    +31.5 us (max. pos. val.)        1   0   0   1   0   1   0   1
-108 to -128  Forbidden; outside CC range          1       0       0       1
-108 to -128  Forbidden; outside CC range          1       0       0       0
--------------------------------------------------------------------------------


22. Switch between PAL- and NTSC color-carrier-frequency

PAL (4.43 MHz)          Control Bits	BY = 0   	YPN = 0
NTSC (3.58 MHz)         Control Bits	BY = 0   	YPN = 1
Bypass                  Control Bits	BY = 1   	YPN = X


23. Prefilter control      

ON                      Control Bit 	PF = 0
OFF                     Control Bit 	PF = 1


24. Centre frequency (type) of BandPass Filter

type 1 (4.1 MHz)        Control Bits	B2 = 0   	BP1 = 0
type 2 (3.8 MHz)        Control Bits	B2 = 0   	BP1 = 1
type 3 (2.6 MHz)        Control Bits	B2 = 1   	BP1 = 0
type 4 (2.9 MHz)        Control Bits	B2 = 1   	BP1 = 1


25. Set Squelch/Noise suppression threshold

coring off    		  Control Bits	COR2 = 0	COR1 = 0
coring on (-8 to 7 LSB)   Control Bits	COR2 = 0	COR1 = 1
coring on (-16 to 15 LSB) Control Bits	COR2 = 1	COR1 = 0
coring on (-32 to 31 LSB) Control Bits	COR2 = 1	COR1 = 1
--------------------------------------------------------------------------------


26. Set HUE Phase (only for NTSC)

HUE Phase (deg.)        Control Bits	A77 A76 A75 A74 A73 A72 A71 A70
-------------------------------------------------------------------------
+178.6 to 0           			 1   1   1   1   1   1   1   1
0                    			 1   0   0   0   0   0   0   0
0 to -180            			 0   0   0   0   0   0   0   0
--------------------------------------------------------------------------------


27. PLL control through Register 0x08

Horizontal clock PLL open, Hor. Freq. Fixed	Control Bit	HPLL = 1
Horizontal clock PLL closed                	Control Bit	HPLL = 0


28. Number of lines per full-frame

60 Hz; 525 lines 				Control Bit 	FS = 1
50 Hz; 625 lines 				Control Bit 	FS = 0


29. Switch between TV- and VTR usage

VTR mode 					Control Bit	VTR = 1
TV  mode 					Control Bit	VTR = 0


30. Switch color information On/Off in register with index 0x08

Color ON					Control Bit	CO = 1
Color OFF					Control Bit	CO = 0


31. Select video standard

alternate mode (PAL)				Control Bit	ALT = 1
non-alternate mode (NTSC)			Control Bit	ALT = 0


32. Set color carrier Frequency (Chrominance) ....

3.58 MHz					Control Bit 	YPN = 1
4.43 MHz 					Control Bit	YPN = 0


33. ... whose place also depends on the Video Standard set in register 0x08

 Color Carrier Frequency       		 	Control Bits  CCFR1   CCFR0
-----------------------------------------------------------------------------
4 433 618.85 Hz (PAL-B, G, H, 1; NTSC 4.43)	   	  	0  	0
3 575 611.49 Hz (PAL-M)						0  	1	
3 582 056.25 Hz (PAL-N)						1	0
3 579 545 Hz (NTSC-M)						1	1
--------------------------------------------------------------------------------


34. Use of the VNL sync. signal

VNL active					Control Bit	VNL = 1
VNL bypassed					Control Bit	VNL = 0


35. Control of SAA9051 Data output (Z-state = High-impendance)

outputs D1..D7, #BL, HS, VS active		Control Bit	OEY = 1
outputs D1..D7, #BL, HS, VS Z-state		Control Bit	OEY = 0


36. Control of the UV0..Uv3 connections

Function					Control Bit	 OEC	
-------------------------------------------------------------------------------
UV0..UV3 active; if CD=1, chrominacne output; CD=0, no signal     1
outputs UV0..UV3 HIGH-impendance Z-state		          0
--------------------------------------------------------------------------------


37. Color control (CL=1 -> CO controls color; CL=0 & CO=1 -> CD controls color)

Color (On/Off)					Control Bits	CL   CO   CD
------------------------------------------------------------------------------
color OFF							1    0    X
color ON							1    1    X
color OFF							0    0    X
color OFF							0    1    0
color ON							0    1    1
--------------------------------------------------------------------------------


38. Switch between High/Low AFCC spike ...

output AFCC = High				Control Bit	AFCC = 1
output AFCC = Low				Control Bit	AFCC = 0


39. .. and SS0..SS3

output SS0-SS3 = High				Control Bits	SS0..3 = 1
output SS0-SS3 = Low				Control Bits	SS0..3 = 0


40. Enable/Disable HSY and HC signals

HSY and HC output pulses disabled		Control Bit 	SYC = 1
HSY and HC output pulses enabled		Control Bit	SYC = 0


41. TriState control of the CVBS signal

CVBS Active					Control Bit	CT = 1
CVBS HIGH-Impedance Z-State			Control Bit	CT = 0


42. FBAS Input selection

Y/C seperate inputs				Control Bit	YC = 1
CVBS Input					Control Bit	YC = 0


43. Luminance processing Delay

Delay (N=)			Control Bits 	YDL2	YDL1	YDL0
------------------------------------------------------------------------------
   0						 0	 0 	 0
  +1 						 0	 0	 1
  +2						 0	 1 	 0
  +3						 0	 1	 1
  -4						 1	 0	 0
  -3						 1	 0	 1
  -2						 1	 1	 0
  -1						 1	 1	 1
--------------------------------------------------------------------------------


44. Chrominance Delay settings for the SECAM Standard

Programmabe Delay      Control Bits   SCDC6 SCDC5 SCDC4 SCDC3 SCDC2 SCDC1 SCDC0
--------------------------------------------------------------------------------
  0					0     0     0     0     0     0     0
  1					0     0     0     0     0     0     1
  2					0     0     0     0     0     1     0
  .                                     .     .     .     .     .     .     .
  4					0     0     0     0     1     0     0
  .                                     .     .     .     .     .     .     .
  8					0     0     0     1     0     0     0
  .                                     .     .     .     .     .     .     .
  16					0     0     1     0     0     0     0
  .                                     .     .     .     .     .     .     .
  32					0     1     0     0     0     0     0
  .                                     .     .     .     .     .     .     .
  63					0     1     1     1     1     1     1
  64					1     1     1     0     0     0     0
  65					1     1     1     0     0     0     1
  .                                     .     .     .     .     .     .     .
  79					1     1     1     1     1     1     1
--------------------------------------------------------------------------------
Max. delay selected by single Ctrl. Bit 
--------------------------------------------------------------------------------
					16    32    16    8     4     2     1
--------------------------------------------------------------------------------

45. Author

Bernhard Schwall
Broichstr.56
53227 Bonn
Germany

eMail: schwall@informatik.uni-bonn.de
