The Shell Parser
================
The SMParser is first and foremost a programming example for the API. It was developed to test the functionality of the API. It was never intended to be a robust application. Nevertheless it is the easiest way to get started. All you need is a terminal and the smp executable. It is also possible to use this program over a network (login in from remote and start the executable).
Note: Beware, the hardware address of the Screen Machine II is hardcoded into the SMParser source. This is due to the fact that it is software setable and has to be specified in the smInit() call. 


How to use
~~~~~~~~~~
Start the executable with two arguments, the width and height of your current screen resolution:
   %smp 640 480
You will get the following prompt:
   SM(-1):
A -1 means that no Screen Machine II have been initialized yet. Type info to find out how many Screen Machine II have been detected in your system. You should see:
   There is 1 Screen Machine board.
Now you should open and choose the first Screen Machine II:
   SM(-1):open 0       // Open and initialize first board
   SM(-1):board        // Choose first board to receive commands
   SM(0):mix of        //  Turn mixer off
   SM(0):window %0 %50 %50 %50  //  Set window to be a quarter
                                    screen on the top left 
   SM(0):input 0       //  Select the black composite input
   SM(0):system pal    // Choose PAL as the video system
   SM(0):video on      // Turn video on

If you are at a 640x480 resolution and have a video source connected you should see live video on your screen. (or at least a black rectangle if no video is connected). If you have a higher resolution chances are that you will have erratic lines jumping across your screen. In this case you should do the following:
   SM(0):hscale 2
This should stabilize the video. You can use the setup functions (pll, xoff, yoff, interlaced, hscale) to further adjust the video. See the Setup Chapter for more details.


Image Aquisitition & Display
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Images can be acquired using the read command. When issued a single image is digitized and stored in the specified file. This image is in the FLM file format as a YUV Mode 6 image. The size of the image is determined by the size of the overlay, although it can never exceed the size of the digitized image in the SM's memory (Set by video frame). This means that for PAL with just even or odd fields the maximum size is 736X280 and both fields 736X560. 
The FLM images can be converted into TIFF images using the flm2tiff conversion program.
It is also possible to display images in 24bit color using the overlay of the SM. The display command can display any FLM image file with YUV Mode 6 data. To avoid unnecessary scaling of the image it suggested that the window frame is adjusted to the size of the image or some ration thereof.
To obtain a FLM image file with YUV Mode 6 data use the tiff2flm conversion program.


Functions
~~~~~~~~~
Basic
board <boardnum>               Choose board
brightness <0-63>              Brightness of overlay
chromainstensity <-50 - +50>   Input signal chroma intensity
clear                          Removes all clips
contrast <0-63>                Contrast of overlay
display <name>                 Display file name in overlay
fields <odd|even|both>         Number of fields display
gain <red|green|blue> <0-63>   Red/Green/Blue color of overlay
help [<command>]               Print out help on command
hue <0-255>                    Hue of input
info                           Print out general settings info
input <black|red|yellow|svhs>  Select input
lumaintensity <-50 - +50>      Input signal luma intensity
mixer <on|off>                 Overlay mixed/not mixed 
move <x> <y>                   Change position of overlay
open <0-3>                     Initialize board
prefilter <on|off>             Turn prefiltering on or off
quit                           Quit parser
read <name>                    Grab and image and save it as name
remove <clipnum>               Remove clip with number clipnum
saturation<0-63>               Saturation of overlay
setclip <x> <y> <width> <height> <num>    Mask out a region (x, y, w, h)
                                 from overlay and assign it number (num)
sharpness <0-63>               Sharpness of overlay
size <width> <height>          Sizes window to width, height
start                          Set overlay to live
stop                           Set overlay to still
system <pal|secam|ntsc>        Choose input video system
vframe <x> <y> <width> <height>     Set the video frame (Region of 
                                    input signal that is digitized)
video <on|off>                      Turn overlay on or off
window <x> <y> <width> <height>     Set size and position of overlay
zoom <x> <y> <width> <height>       Specify a zoom frame (in %)

Setup
pll <0-1024>                   Alters ration of width/height,
                               higher values for a narrower overlay,
                               lower values for wider overlay
xoff <0-256>                   Moves overlay left or right
yoff <0-256>                   Moves overlay up or down

Arguments
on = 1
off = 0

Numeric arguments can be specified relative to set value. For example a move +10 -10 would move the current window +10 in the x direction and -10 in the y, where as move 10 10 would move the window to the 10,10 position.
