CHAPTER 7    TV MODULES





            7.1 TVSTART SUBROUTINE



                 This subroutine assigns a channel to the Grinnell.



            Call:



                  CALL TYSTART(CHANNL,STATUS)



            where:



            NAME      I/O  TYPE         DESCRIPTION

            NAME      I/O  TYPE         DESCRIPTION

            CHANNL     R    I2    is the channel assigned tothe Grinnell.



            STATUS     R    I4    is the status returned by the system.











            7.2 TVSTOP SUBROUTINE



                 This subroutine deassigns the channel to the Grinnell.



            Call:



                  CALL TVSTOP(CHANL,STATUS)



            where:



            NAME      I/O  TYPE         DESCRIPTION

            NAME      I/O  TYPE         DESCRIPTION

            CHANL      C    I2    is the channel assigned to the Grinnell.



            STATUS     R    I4    is the status returned by the system.


                                                                Page 2





            7.3 TVSEND SUBROUTINE



                 This subroutine sends the contents of BUFFER to the Grinnell

            driver.



            Call:



                  CALL TVSEND(CHANNL,BUFFER,NBYTES,STATUS)



            where:



            NAME      I/O  TYPE         DESCRIPTION

            NAME      I/O  TYPE         DESCRIPTION

            CHANNL     C    I2    is the channel assigned to the Grinnell.



            BUFFER     C    LOG1  is the array containing machine code to  be

                                  sent to the Grinnell.



            NBYTES     C    I4    is the number of bytes to be sent.



            STATUS     R    I4    is the status returned by the system.











            7.4 TVERAS SUBROUTINE



                 This subroutine erases the  Grinnell  picture  and  graphics

            frames.



            Call:



                  CALL TVERAS(CHANNL,BUFFER,NBUFFER,TOT,STATUS)



            where:



            NAME      I/O  TYPE         DESCRIPTION

            NAME      I/O  TYPE         DESCRIPTION

            CHANNL     C    I2    is the channel assigned to the Grinnell.



            BUFFER     C    I2    is the array containing machine code to  be

                                  sent to the Grinnell.



            NBUFFR     C    I4    is the dimension of the array  BUFFER.   It

                                  is usually equal to 2048.



            TOT        C    I4    is a key such that when equal  to  0,  only

                                  the  picture frame is erased; when equal to

                                  1,  the  picture  and  overlay  frames  are

                                  erased.



            STATUS     R    I4    is the status returned by the system.




                                                                Page 3





            7.5 TVFIRST SUBROUTINE



                 This subroutine takes  the  Grinnell  through  its  internal

            tests,  erases  the  screen,  and  sets  the zoom, pan, and video

            lookup table.



            Call:



                  CALL TVFIRST(CHANNL,BUFFER,NBUFFR,TVREGD,TVREGC,

                  TVREGN,STATUS)



            where:



            NAME      I/O  TYPE         DESCRIPTION

            NAME      I/O  TYPE         DESCRIPTION

            CHANNL     C    I2    is the channel assigned to the Grinnell.



            BUFFER     C    I2    is the array containing machine code to  be

                                  sent to the Grinnell.  It is loaded in this

                                  subroutine.



            NBUFFR     C    I4    is the dimension of the array  BUFFER.   It

                                  is usually equal to 2048.



            TVREGD     C    I2    is the array for  default  values  for  the

                                  Grinnell.



            TVREGC     C    I2    is the array for  comment  values  for  the

                                  Grinnell.



            TVREGN     C    I4    is the dimension of the above  two  arrays.

                                  It is usually equal to 12.



            STATUS     R    I4    is the status returned by the system.


                                                                Page 4





            7.6 TVREAD SUBROUTINE



                 This subroutine reads the contents of the  buffer  from  the

            Grinnell driver.



            Call:



                  CALL TVREAD(CHANNL,BUFFER,NBYTES,STATUS)



            where:



            NAME      I/O  TYPE         DESCRIPTION

            NAME      I/O  TYPE         DESCRIPTION

            CHANNL     C    I2    is the channel assigned to the Grinnell.



            BUFFER     C    LOG1  is the array containing the data sent  from

                                  the Grinnell.



            NBYTES     C    I4    is the number of bytes requested  from  the

                                  Grinnell.



            STATUS     R    I4    is the status returned by the system.


                                                                Page 5





            7.7 TVCONVLT SUBROUTINE



                 This subroutine receives information on the position of quad

            cursor #4 and then directs one of various  subroutines to rewrite

            the video  lookup  table  under  the  F, J, L, K, U, V, W, and  X 

            commands of IP option.



            Call:



                  CALL TVCONVLT(CHANNL,BUFFER,NBUF,NTIMES,NX,NY,G,SCF,AMIN,

                  STATUS)



            where:



            NAME      I/O  TYPE         DESCRIPTION

            NAME      I/O  TYPE         DESCRIPTION

            CHANNL     C    I2    is the channel assigned to the Grinnell.



            BUFFER     C    I2    is the array this subroutine uses  to  send

                                  machine code to the Grinnell.



            NBUF       C    I4    is the dimension of the array BUFFER.



            NTIMES     C    I4    is the  number  of  times  this  subroutine

                                  loops  to  read  cursor   4.  IMAGROC calls

                                  this subroutine with NTIMES = 500.



            NX         R    I4    is the X location of  the  cursor  measured

                                  from the center of the screen.



            NY         R    I4    is the Y location of  the  cursor  measured

                                  from the bottom of the screen.



            G          C    I4    is the key to  select  the  desired  lookup

                                  table subroutine.



            SCF        C    R4    is the intensity scale factor  in  physical

                                  units per input memory address.



            AMIN       C    R4    is the physical intensity corresponding  to

                                  the lowest value stored in the memeory.



            STATUS     R    I4    is the status returned by the system.










                                                                Page 6





            7.8 TVBWVLT SUBROUTINE



                 This subroutine writes  new  values  to the Grinnell virtual

            lookup table  according  to the  location   of quad  cursor #4 as 

            controlled by the quad  cursor joystick.  The X  location  shifts 

            the assignment of  12-bit  LUT  values with respect to the 10-bit 

            input  values  (either  up or  down  the  1024  input addresses).  

            Increasing  Y  location  increases  the  number  of  10-bit input 

            addresses which are  assigned  the  same  12-bit  LUT  word.  The 

            picture is  displayed  in  black and white.  The entry TVLOGBWVLT 

            expesses  the  log  of the input values  as  a  black  and  white 

            picture.



            Call:



                  CALL TVBWVLT(CHANNL,BUFFER,NBUF,NX,NY)



            where:



            NAME      I/O  TYPE         DESCRIPTION

            NAME      I/O  TYPE         DESCRIPTION

            CHANNL     C    I2    is the channel assigned to the Grinnell.



            BUFFER     C    I2    is the array containing machine to be  sent

                                  to the Grinnell.



            NBUF       C    I4    is the dimension of the array BUFFER.



            NX         C    I4    is the X location of  the  cursor  measured

                                  from the center of the screen.



            NY         C    I4    is the Y location of  the  cursor  measured

                                  from the bottom of the screen.


                                                                Page 7





            7.9 TVJVLT SUBROUTINE



                 This subroutine writes new values to  the  Grinnell  virtual

            lookup  table  according  to  the  location  of quad cursor  1 as

            controlled by the quad cursor joystick.  The  x  location  shifts

            the  assignment  of  12-bit LUT values with respect to the 10-bit

            input values (either up or down the 1024  input  addresses).   An

            increasing  y  location  increases  the  number  of  10-bit input

            addresses which are assigned the  same  12-bit  LUT  word.   When

            x=256 to 381, increasing addresses (or input values) are assigned

            mixtures of magenta, blue, cyan,  green,  yellow,  and  red  with

            rollover.   For  x=382 to 511, the sequence of colors is reversed

            relative  to  the  addresses.   When  x=255  to  128,  increasing

            addresses  are assigned mixtures of magenta, green, blue, yellow,

            cyan, and red with rollover.  For x=127 to  0,  the  sequence  of

            colors is reversed relative to the addresses.  The entry TVLOGVLT

            expesses the log of the input values as a sequence of colors.



            Call:



                  CALL(CHANNL,BUFFER,NBUF,NX,NY)



            where:



            NAME      I/O  TYPE         DESCRIPTION

            NAME      I/O  TYPE         DESCRIPTION

            CHANNL     C   I2     is the channel assigned to the Grinnell.



            BUFFER     C   I2     is the array containing machine code to  be

                                  sent to the Grinnell.  It is loaded by this

                                  subroutine.



            NBUF       C   I4     is the dimension of the array BUFFER.



            NX         C   I4     is the X location of  the  cursor  measured

                                  from the center of the screen.



            NY         C   I4     is the Y location of  the  cursor  measured

                                  from the botton of the screen.











            7.10 TVUMPHYS SUBROUTINE



                 This subroutine calls the various subroutines  dealing  with

            the  Grinnell picture display system in the Physics Dept.  at the

            University of Michigan.  Internal tests can be run,  pictures  in

            the  SAD  format  displayed (one or more at a time), and overlays

            written and erased.  This subroutine is called by  TV,  which  is

            called by MIIPSOPT.


                                                                Page 8





            7.11 GRENDELS SUBROUTINE



                 This subroutine sends data from a SAD file to  the  Grinnell

            memory.   It is used by the "I" command of the "TV" option and by

            other options which require loading of  an  image.   This  object

            code of this subroutine should go in the PAN library.



            RETURNS:

                    XLOC    Starting X location on TV in Grinnell pixels

                    YLOC    Starting Y location on TV in Grinnell pixels

                    NPTSX   Number of Grinnell pixels in the X direction

                    NPTSY   Number of Grinnell pixels in the Y direction

                    SCF     Scale factor for grayscale

                    AMIN    Lowest intensity

                    AMAX    Highest intensity

                    DX      Grinnell pixels per map pixels in the X direction

                    DY      Grinnell pixels per map pixels in the Y direction

                    ADX     Starting column in map

                    ADY     Starting row in map



            Call:



                  CALL GRENDELS(KEY)



            where:



            NAME      I/O  TYPE         DESCRIPTION

            NAME      I/O  TYPE         DESCRIPTION

            KEY        C    I4    is the flag for whether the file name is to

                                  be  requested  from the user (=0), or is to

                                  be obtained from  the  common  block  DNAME

                                  (=1).









            7.12 GRIMAGPROC SUBROUTINE



                 This subroutine allows one to  manipulate  pictures  on  the

            Grinnell  display  system in the Physics Dept.  at U of Michigan.

            After the picture has been loaded with  option  TV,  this  option

            allows  reading  of  cursor  locations,  reading of pixel values,

            computation of statistics, and alteration of look  up  table  and

            color gun logic.  This subroutine is called by IMAGPROC, which is

            called by MIIPSOPT.