Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-11 - 43,50540/colors.mem
There are no other files named colors.mem in the archive.
                     CHANGING COLORS ON THE TEKTRONIX 4027

                                  D. N. Clark

                              Computer Sciences at
                         Oak Ridge National Laboratory*
                              Oak Ridge, TN  37830




                                    ABSTRACT

         COLORS makes it easy for a person using the Tektronix  4027  color
    terminal  to  change  the hue, lightness, and saturation values for any
    picture which is already drawn on the 4027 screen.  Instead of the user
    having  to type !MAP C0 320,50,100 etc., every time he wishes to change
    colors, he merely types in H, L, or S to  increment  or  decrement  the
    current  Hue,  Lightness,  or  Saturation  value for the current color.
    This makes it  simple  to  quickly  obtain  the  most  desirable  color
    combination for that particular picture.


















    *Operated  by  Union  Carbide  Corporation under contract W-7405-eng-26
    with the U.S. Department of Energy.
                                1.  INTRODUCTION

         A nineteen character command such as "!MAP C0  340,  50,100"  must
    normally  be  typed  into  a  Tektronix 4027 color terminal in order to
    change one of the displayed colors.  COLORS.EXE  is  a  PDP-10  FORTRAN
    program  which  changes  the  colors  with single letter commands, thus
    enabling the user to create pleasing color combinations with a  minimum
    of time and effort.

         The  Tektronix  4027  color  terminal  is  capable of displaying a
    maximum of eight different colors on its screen at any one time.  Those
    colors  can  be changed by typing commands to the terminal.  The format
    of one of the commands is:

                                !MAP Cx n1,n2,n3


         The exclamation point is normally the control character  (CC)  for
    the  4027.   It alerts the 4027 that a command is being entered.  "MAP"
    is one of several "change color" commands which the  4027  understands.
    "Cx"  refers  to  one  of  eight  "paint pots" which contain the colors
    displayed on the screen.  The "x" represents an integer from 0  through
    7  and  identifies  which  paint  pot is being referenced.  The numbers
    "n1,n2,n3" refer to the Hue, Lightness, and Saturation  values  of  the
    referenced "paint pot."

         Unfortunately,  the  user must type in the whole command each time
    he wishes to change any one color  which  is  being  displayed  on  the
    screen.   If  the  user  wishes  to  experiment  with the colors of his
    picture, he is forced to laboriously type the "MAP"  command  over  and
    over   until  he  obtains  the  desired  colors.   This  can  be  quite
    time-consuming and tedious.

         The program COLORS was developed to reduce  the  time  and  tedium
    resulting from this activity.  Once the user has a picture displayed on
    the 4027 screen, he runs the COLORS program.  Then he  can  change  the
    hue  of  the current paint pot by repeatedly typing the letter "H".  If
    he types H eighteen times, he will have incremented the hue  completely
    around the "color wheel" and will end up with the same color he started
    with.  Thus the user can rapidly change and  view  the  colors  on  his
    picture  without  typing  the Tektronix 4027 command "!MAP Cx n1,n2,n3"
    each time.  Sets of eight colors can be stored in user named files  and
    can  be  read  back into the COLORS program with simple commands.  This
    enables the user to keep files of  pleasing  color  combinations.   The
    user  can also store sets of colors in the Tektronix 4027 function keys
    F1 through F9.  Once they have been stored, the  user  can  change  the
    colors  of  any displayed picture by pressing one of the function keys,
    even while executing another program.
                           2.  THE INTERNAL HELP FILE

         COLORS has an internal HELP file which documents the  use  of  the
    program.   It  is  reproduced here in its entirety as an explanation of
    the program.

         This program makes it easier for you to change the hue, lightness,
    or  saturation  values  (H,L,S)  of  any  of  the  eight colors which a
    Tektronix 4027 color terminal is capable of displaying at one time.  To
    change colors you must normally type:

                               !MAP C0 80,50,100

    (The  numbers will vary of course.)  "COLORS" enables you to change the
    H,L,S values of the eight paint pots (C0 through  C7)  using  a  single
    keystroke.   This makes it easy to adjust the colors of a picture which
    has already been displayed on the Tektronix 4027 screen without  typing
    out the entire command each time.

         This program recognizes thirteen characters.  They are:

    H    The  hue  will  be  changed.   The  hue (color) will change as the
         numbers vary from 0 to 360 degrees.
         EX.  !MAP C0 0,50,100   !MAP C0 340,50,100


    L    The lightness will be varied.  The amount of black or white  added
         to  the  hue will vary from all black (0) to all white (100).  The
         program allows seven values.  0, 20, 40, 50, 60, 80, and 100.
         EX.  !MAP C0 180,20,100   !MAP C0 180,80,100


    S    The saturation of the hue will  be  varied.   At  zero  saturation
         there  is  no  color present at all (gray).  At 50% saturation all
         colors look muted.  At 100% saturation,  all  hues  are  at  their
         brightest.
         EX.  !MAP C0 120,50,0   !MAP C0 120,50,100


    C    Changes  the  color pot which you are modifying.  You must enter a
         number from 0 to 7 to complete the command.  In the first  example
         "C5" was entered.  In the second example "C2" was entered.
         EX.  !MAP C5 120,50,100   !MAP C2 120,50,100


    E    The  program  will exit.  You can also type CTRL-C (control-C) and
         get the same effect.  The picture on the Tektronix 4027  will  not
         be affected.


    T    You  can  see the values of the current paint pot without changing
         them by typing "T".


    P    If you enter "P" all of the paint pots will be changed to  default
         values.   The  default  colors  in  C0 through C7 are: white, red,
         green, blue, yellow, cyan, magenta, and black.


    +    H, L, and S values will be incremented by some amount.  The effect
         of "+" will remain until you type in "-".


    -    H, L, and S values will be decremented by some amount.  The effect
         of "-" will remain until you type in "+".


    R    Reads a file which (hopefully) contains eight Tektronix 4027 color
         commands.   You  will  be  asked for a filename.  The picture will
         change to the colors contained in the file.


    W    Writes a file which contains eight Tektronix 4027 color  commands.
         You will be asked for a filename.  Be careful not to give the name
         of a file which already exists, because it  will  be  overwritten.
         You can read the file later with the "R" command.


    F    The  current  color values will be stored in one of the first nine
         Tektronix 4027 Function keys (F1-F9).  You  must  enter  a  number
         from  1  to  9  to  finish the command.  Then, when you press that
         function key, your display will change  to  the  colors  which  it
         contains.  Note that pressing the function key does NOT change the
         current colors stored in this program; it changes the  DISPLAY  to
         the colors stored in the function key.


    ?    Types out this help file.  If you have any further questions, call
         Dennis Clark at 576-7384.
                    3.  EXAMPLE RUN OF THE PROGRAM "COLORS"

         The program COLORS.EXE is in the systems area [1,4] on the  Fusion
    Energy  Division  PDP-10.  Copies of the file are available on the ORNL
    PDP-10 also, but are not available on the systems area.   The  appendix
    containing  the  example  run  should  be  used in conjunction with the
    following explanation.  The user invokes the program by typing:

                                   .R COLORS

    It responds with  a  brief  message  telling  him  what  characters  it
    recognizes.   If  he types in "?" he will get the first of three levels
    of help.  The first level is a two  line  list  of  the  single  letter
    commands  and  the word which each letter represents.  If the user then
    types in one of those single letter commands he  will  get  the  second
    level  of  help  which  is  a  two  line explanation of that particular
    command.  If the user types in "?" he will be asked if he wants to  see
    the large help file which is listed above.  It represents the third and
    most comprehensive level of help available.

         In this example, he types in "r" which tells COLORS that he  wants
    to  read  a  file  containing eight Tektronix 4027 color commands.  The
    user types in "second" when the program asks him  what  file  to  read.
    The program will actually read the file "second.dat" since the user did
    not explicitly specify a null extension by inserting a period after the
    filename.   Since  the  user did not type in "second." the program then
    reads the file SECOND.DAT and types the commands which will change  all
    eight of the paint pots to the colors contained in the file SECOND.DAT.
    After it finishes changing all eight colors, it  types  out  its  brief
    help  message  again.  The user then types in "t" which shows him which
    paint pot he is able to change at this moment.  It is  "C0".   He  then
    types  in "l" and the lightness value "wraps around" from 100 to 0.  He
    types in "l" several more times and the lightness value is  incremented
    to  one of seven allowable values (0, 20, 40, 50, 60, 80, 100).  Notice
    that each time the user types "l" the program types out  the  Tektronix
    COMMAND  which  actually  changes  the color on the 4027 screen, and it
    also types out the TEXT which allows the user to see  what  command  is
    being  sent to the 4027.  If the user were actually on a Tektronix 4027
    terminal, he would not see the command at all, but would merely see the
    text  describing  the  command.   He then types in "F3" and the program
    types out a command which  "teaches"  the  4027  function  key  F3  the
    current  values  of  the  eight  paint pots.  If the user susbsequently
    presses the F3 function key (as opposed to pressing the two  characters
    "F"  and "3") the colors on the screen will change to the values stored
    in the function key.  However, presing the function key does NOT change
    the  H,L,S  values contained in the COLORS program; it only changes the
    DISPLAY.  This can cause confusion if the user presses a  function  key
    while  running  the  program  COLORS.   In that case the colors he sees
    displayed will not necessarily be the colors he would store if he  were
    to  then  use  the W (write) command.  Once the function keys have been
    loaded  with  COLORS,  they  can  be  used  while  running  MAPPER   or
    TELL-A-GRAF without affecting the programs.

         In  our  current  example the user next types in "h" several times
    which changes the hue of the C0 paint pot.  He then types in "-"  which
    means  that subsequent "h", "l" and "s" commands will decrement instead
    of incrementing.  He then types in "h" and you will notice that the hue
    (n1)  portion  of the color command is now decrementing.  Lightness and
    saturation would also decrement if he typed in "l"  or  "s".   He  then
    types  "w"  which  indicates  that he wishes to have whatever the eight
    paint pots (C0 through C7) currently contain to be written  to  a  disk
    file  which he names "test.dat." He then resets the eight paint pots to
    their default values by typing "p".  He then types "e" and  exits  from
    the COLORS program.

         Note  that  on a Tektronix 4027 terminal, normal text is displayed
    using C0 which is usually white (h,l,s of 0,100,100).   The  background
    is  displayed with C7 which normally contains black (h,l,s of 0,0,100).
    The paint pots C1 through C6 may or may not be mapped onto  the  screen
    depending  on  how many colors have been used in the picture.  So it is
    possible for the user to change the color of a paint pot  and  not  see
    any  colors  on  the  screen change because that paint pot has not been
    mapped onto the screen anywhere.  It is also possible for him to change
    the color of the text and background, and if he chooses, can change the
    text to be the SAME color as  the  background,  which  makes  the  text
    invisible.

         The  COLORS  program  can  significantly reduce the time needed to
    obtain pleasing color combinations on the Tektronix  4027  screen.   In
    addition,  once  pleasing color combinations have been discovered, they
    can be used for other pictures as well.  Once  the  color  combinations
    have been written to disk files, the user does not even need to run the
    COLORS program but can change the color of displayed pictures simply by
    typing the monitor level command "TYPE FILE.EXT," where FILE.EXT is the
    name of one of the files containing the 4027 commands.
                            APPENDIX A.  EXAMPLE RUN
    .R COLORS


    (H, L, S, C, P, E, ?, T, +, -, R, W, F) FOR HELP (?)  r
    WHAT FILE (CONTAINING COLOR COMMANDS) DO YOU WANT TO READ?  second
    !MAP C0,  0,100,100
    !MAP C1,120, 50,100
    !MAP C2,  0, 50,100
    !MAP C3,  0, 80,100
    !MAP C4,360,100,100
    !MAP C5,300, 20,100
    !MAP C6,160, 40,100
    !MAP C7,  0,  0,100
    (H, L, S, C, P, E, ?, T, +, -, R, W, F) FOR HELP (?)  t
    MAP C0,  0,100,100  l
    !MAP C0,  0,  0,100
    MAP C0,  0,  0,100  l
    !MAP C0,  0, 20,100
    MAP C0,  0, 20,100  l
    !MAP C0,  0, 40,100
    MAP C0,  0, 40,100  l
    !MAP C0,  0, 50,100
    MAP C0,  0, 50,100  F3
    !LEARN F3/!MAP C0   0, 50,100/-
    /!MAP C1 120, 50,100/-
    /!MAP C2   0, 50,100/-
    /!MAP C3   0, 80,100/-
    /!MAP C4 360,100,100/-
    /!MAP C5 300, 20,100/-
    /!MAP C6 160, 40,100/-
    /!MAP C7   0,  0,100/13
    (H, L, S, C, P, E, ?, T, +, -, R, W, F) FOR HELP (?)  h
    !MAP C0, 20, 50,100
    MAP C0, 20, 50,100  h
    !MAP C0, 40, 50,100
    MAP C0, 40, 50,100  h
    !MAP C0, 60, 50,100
    MAP C0, 60, 50,100  -h
    !MAP C0, 40, 50,100
    MAP C0, 40, 50,100  h
    !MAP C0, 20, 50,100
    MAP C0, 20, 50,100  +h
    !MAP C0, 40, 50,100
    MAP C0, 40, 50,100  w
    THE CURRENT COLORS WILL BE WRITTEN INTO A FILE.
    WHAT DO YOU WANT THE FILE'S NAME TO BE? test
    (H, L, S, C, P, E, ?, T, +, -, R, W, F) FOR HELP (?)  p
    !MAP C0,  0,100,100
    !MAP C1,120, 50,100
    !MAP C2,240, 50,100
    !MAP C3,  0, 50,100
    !MAP C4,180, 50,100
    !MAP C5,300, 50,100
    !MAP C6, 60, 50,100
    !MAP C7,  0,  0,100
    e
    STOP

    END OF EXECUTION
    CPU TIME: 0.16  ELAPSED TIME: 1:43.47
    EXIT

    .
                        APPENDIX B.  FORTRAN SOURCE CODE

	IMPLICIT INTEGER(A-Z)
	DOUBLE PRECISION FILNAM
	COMMON /AREA/HLS(8,3),LITNES(7),LETRS(13),CPP,PP,HUEINC,SATINC,
     &  SIGN,VALUE

C	THIS PROGRAM MAKES IT EASY FOR A PERSON USING THE TEKTRONIX 4027
C	TO CHANGE THE HUE, LIGHTNESS, AND SATURATION VALUES ON ANY PICTURE
C	WHICH IS ALREADY DRAWN ON THE 4027 SCREEN.  INSTEAD OF THE USER 
C	HAVING TO TYPE "!MAP C0,150,50,100" ETC., EVERY TIME HE WISHES TO
C	CHANGE COLORS, HE MERELY TYPES IN  H, L, OR S TO INCREMENT OR
C	DECREMENT THE CURRENT HUE LIGHTNESS OR SATURATION VALUE FOR THE
C	CURRENT COLOR.  THIS MAKES IT EASIER TO GET THE MOST DESIRABLE
C	COLOR COMBINATION FOR THAT PARTICULAR PICTURE.

C
C	INITIALIZE ALL OF THE ARRAYS 
C
	CALL INITL
C
C	TYPE A BRIEF HELP MESSAGE FOR THE USER'S BENEFIT
C

10	TYPE 15
15	FORMAT(' (H, L, S, C, P, E, ?, T, +, -, R, W, F)',
     &  ' FOR HELP (?) ')
C
C	WE COME HERE TO PICK UP A CHARACTER FROM THE USER'S TERMINAL.
C	THAT CHARACTER DETERMINES WHAT GETS DONE.
C
50	I=IKHAR(DUMY)
C
C	CHECK FOR LOWER CASE LETTERS
C
	IF(I.GT.96) I=I-32
C
C	CHECK THE CHARACTER TO SEE IF IT REPRESENTS A VALID OPTION
C
	DO 60 J=1,13
	  IF(I.EQ.LETRS(J)) GOTO 90
60	CONTINUE

C
C	WE DIDN'T RECOGNIZE IT, SO PRINT THE BRIEF HELP MESSAGE AGAIN.
C
	GOTO 10
C
C	WE GOT A VALID OPTION, SO BRANCH TO THE APPROPRIATE CODE
C	      H   L   S   C   P   +   -   E   ?   T    R    W    F
90	GOTO(100,200,300,400,500,600,700,800,900,1000,1100,1200,1300)J
	STOP 'THIS SHOULD NEVER BE TYPED OUT'
C
C	CHARACTER ENTERED WAS "H".  THE HUE WILL BE CHANGED.
C
100	HLS(CPP,1)=HLS(CPP,1)+HUEINC*SIGN
	IF(HLS(CPP,1).GT.360) HLS(CPP,1)=HUEINC
	IF(HLS(CPP,1).LT.0) HLS(CPP,1)=360-HUEINC
	GOTO 10000
C
C	CHARACTER ENTERED WAS "L".  THE LIGHTNESS VALUE WILL CHANGE.
C	FIND OUT WHAT THE CURRENT LIGHTNESS VALUE IS FIRST, THEN
C	EITHER INCREMENT IT, OR DECREMENT IT.
C
200	DO 210 J=1,7
	  IF(HLS(CPP,2).EQ.LITNES(J)) GOTO 250
210	CONTINUE
	J=4
250	VALUE=J
	VALUE=VALUE+SIGN
	IF(VALUE.LT.1) VALUE=7
	IF(VALUE.GT.7) VALUE=1
	HLS(CPP,2)=LITNES(VALUE)
	GOTO 10000
C
C	CHARACTER ENTERED WAS "S". THE SATURATION WILL CHANGE
C
300	HLS(CPP,3)=HLS(CPP,3)+SATINC*SIGN
	IF(HLS(CPP,3).GT.100) HLS(CPP,3)=0
	IF(HLS(CPP,3).LT.0) HLS(CPP,3)=100
	GOTO 10000
C
C	CHARACTER ENTERED WAS "C". CHANGE FROM ONE PAINT POT TO ANOTHER.
C	THERE ARE 8 PAINT POTS LABELED C0 THROUGH C7.
C	CHECK THE VALUES TO BE CERTAIN THAT THEY ARE IN THE VALID RANGE.
C
400	I=IKHAR(DUMY)
	I=I-48
	IF((I.GE.0).AND.(I.LE.7)) GOTO 450
	TYPE 410
410	FORMAT(' AFTER ENTERING "C" YOU MUST ENTER A NUMBER FROM 0 TO 7')
	GOTO 10
450	PP=I
	CPP=PP+1
	GOTO 10000
C
C	CHARACTER ENTERED WAS A "P". ALL OF THE COLOR PAINT POTS WILL
C	BE RETURNED TO THEIR DEFAULT PRIMARY COLORS.
C
500	CALL INITL

	DO 550 J=1,8
	JJ=J-1
	TYPE 540,JJ,HLS(J,1),HLS(J,2),HLS(J,3)
540	FORMAT(' !MAP C',I1,',',I3,',',I3,',',I3,'  ')
550	CONTINUE
	TYPE 560
560	FORMAT(' ')
	GOTO 50
C
C	CHARACTER ENTERED WAS "+". VALUES WILL BE INCREMENTED.
600	SIGN=+1
	GOTO 50
C
C	CHARACTER ENTERED WAS "-". VALUES WILL BE DECREMENTED
700	SIGN=-1
	GOTO 50
C
C	CHARACTER ENTERED WAS "E". EXIT FROM THE PROGRAM.
C
800	STOP
C
C	CHARACTER ENTERED WAS "?".  TYPE OUT DETAILED INSTRUCTIONS
C
900	CALL HELPME
	GOTO 50
C
C	CHARACTER ENTERED WAS "T".  TYPE OUT WHAT YOU HAVE
C	WITHOUT CHANGING ANYTHING.
C
1000	TYPE 1010,PP,HLS(CPP,1),HLS(CPP,2),HLS(CPP,3)
1010	FORMAT(' MAP C',I1,',',I3,',',I3,',',I3,'  ')
	GOTO 50
C
C	CHARACTER ENTERED WAS "R".  READ A FILE CONTAINING
C	COLOR COMMANDS WHICH WILL FILL EACH OF THE EIGHT PAINT POTS.
C
1100	TYPE 1110
1110	FORMAT(' WHAT FILE (CONTAINING COLOR COMMANDS) DO',
     &  ' YOU WANT TO READ? '$)
	ACCEPT 1120,FILNAM
1120	FORMAT(A10)
	IF(FILNAM.EQ.'          ') GOTO 10
	OPEN(UNIT=20,ACCESS='SEQIN',FILE=FILNAM,ERR=1190)
	DO 1150 M=1,8
	  READ(20,1130,ERR=1194,END=1196) I,J,K
1130	  FORMAT(8X,3I)
	  HLS(M,1)=I
	  HLS(M,2)=J
	  HLS(M,3)=K
	  JJ=M-1
	  TYPE 1140,JJ,I,J,K
1140	  FORMAT(' !MAP C',I1,',',I3,',',I3,',',I3)
1150	CONTINUE
	GOTO 10
1190	TYPE 1191,FILNAM
1191	FORMAT(' COULD NOT FIND THE FILE "',A10,'"')
	GOTO 10
1194	TYPE 1195,FILNAM
1195	FORMAT(' HAD TROUBLE READING THE FILE "',A10,'"')
	GOTO 10
1196	TYPE 1197
1197	FORMAT(' ENCOUNTERED END-OF-FILE BEFORE READING ALL OF THE',
     &  ' NEEDED VALUES.')
	GOTO 10
C
C	CHARACTER ENTERED WAS "W".  WRITE THE CURRENT COLOR VALUES
C	INTO A USER NAMED FILE.
C
1200	TYPE 1210
1210	FORMAT(' THE CURRENT COLORS WILL BE WRITTEN INTO A FILE.'/
     &  ' WHAT DO YOU WANT THE FILE''S NAME TO BE? '$)
	ACCEPT 1220,FILNAM
1220	FORMAT(A10)
	IF(FILNAM.EQ.'          ') GOTO 10
1230	OPEN(UNIT=20,ACCESS='SEQOUT',FILE=FILNAM)

	DO 1290 J=1,8
	  JJ=J-1
	  WRITE(20,1240) JJ,HLS(J,1),HLS(J,2),HLS(J,3)
1240	  FORMAT('!MAP C',I1,',',I3,',',I3,',',I3)
1290	CONTINUE

	CLOSE(UNIT=20)
	GOTO 10
C
C	CHARACTER ENTERED WAS "F".  THE CURRENT COLOR VALUES WILL
C	BE STORED IN A TEK4027 FUNCTION KEY (F1-F9)
C
1300	I=IKHAR(DUMY)
	I=I-48
	IF((I.GE.1).AND.(I.LE.9)) GOTO 1320
	TYPE 1310
1310	FORMAT(' AFTER ENTERING "F" YOU MUST ENTER A NUMBER',
     &  ' FROM 1 TO 9')
	GOTO 10
1320	IZ=0
	TYPE 1330, I,IZ,HLS(1,1),HLS(1,2),HLS(1,3)
1330	FORMAT(' !LEARN F',I1,'/!MAP C',I1,1X,I3,',',I3,',',I3,'/-')
	DO 1350 J=2,7
	JM1=J-1
	TYPE 1340,JM1,HLS(J,1),HLS(J,2),HLS(J,3)
1340	FORMAT(' /!MAP C',I1,' ',I3,',',I3,',',I3,'/-')
1350	CONTINUE
	IZ=7
	TYPE 1360, IZ,HLS(8,1),HLS(8,2),HLS(8,3)
1360	FORMAT(' /!MAP C',I1,' ',I3,',',I3,',',I3,'/13')
	GOTO 10
C
C	THIS IS THE OUTPUT ROUTINE.  IT IS AN ASCII INSTRUCTION STRING TO
C	THE TEKTRONIX 4027 TO CHANGE EITHER THE HUE, LIGHTNESS OR SATURATION
C	OF ONE OF THE EIGHT COLOR PAINT POTS C0 THROUGH C7.
C
10000	TYPE 10100, PP,HLS(CPP,1),HLS(CPP,2),HLS(CPP,3)
10100	FORMAT(' !MAP C',I1,',',I3,',',I3,',',I3,'  ')
	TYPE 10200, PP,HLS(CPP,1),HLS(CPP,2),HLS(CPP,3)
10200	FORMAT(' MAP C',I1,',',I3,',',I3,',',I3,'  ')
	GOTO 50

	END
	SUBROUTINE INITL
	IMPLICIT INTEGER (A-Z)
	COMMON /AREA/HLS(8,3),LITNES(7),LETRS(13),CPP,PP,HUEINC,SATINC,
     &  SIGN,VALUE
C		H
	LETRS(1)=72
C		L
	LETRS(2)=76
C		S
	LETRS(3)=83
C		C
	LETRS(4)=67
C		P
	LETRS(5)=80
C		+
	LETRS(6)=43
C		-
	LETRS(7)=45
C		E
	LETRS(8)=69
C		?
	LETRS(9)=63
C		T
	LETRS(10)=84
C		R
	LETRS(11)=82
C		W
	LETRS(12)=87
C	        F
	LETRS(13)=70

	LITNES(1)=0
	LITNES(2)=20
	LITNES(3)=40
	LITNES(4)=50
	LITNES(5)=60
	LITNES(6)=80
	LITNES(7)=100

	DO 400 J=1,8
	  HLS(J,2)=50
	  HLS(J,3)=100
400	CONTINUE
	HLS(1,2)=100
	HLS(8,2)=0
	HLS(1,1)=0
	HLS(2,1)=120
	HLS(3,1)=240
	HLS(4,1)=0
	HLS(5,1)=180
	HLS(6,1)=300
	HLS(7,1)=60
	HLS(8,1)=0

	HUEINC=20
	SATINC=50
	VALUE=4
	SIGN=1
	PP=0
	CPP=1
	RETURN
	END
	SUBROUTINE HELPX

         TYPE   10
  10     FORMAT(
     &   '                                                             '
     &  /' This program makes it easier for  you  to  change  the  hue,'
     &  /' lightness,  or saturation values (H,L,S) of any of the eight'
     &  /' colors which a Tektronix 4027 color terminal is  capable  of'
     &  /' displaying  at one time.  To change colors you must normally'
     &  /' type:                                                       '
     &  /' MAP C0 80,50,100                                            '
     &  /' (The numbers will vary of course.) "COLORS" enables  you  to'
     &  /' change  the H,L,S values of the eight paint pots (C0 through'
     &  /' C7) using a single keystroke.  This makes it easy to  adjust'
     &  /' the  colors of a picture which has already been displayed on'
     &  /' the Tektronix 4027 screen  without  typing  out  the  entire'
     &  /' command each time.                                          '
     &  /' This program recognizes thirteen characters.  They are:     '
     &  /'                                                             '
     &  /' H   The Hue will be changed.  The hue (color) will change as'
     &  /'     the numbers vary from 0 to 360 degrees.                 '
     &  /'     EX.  MAP C0 0,50,100 MAP C0 340,50,100                  '
     &  /'                                                             '
     &  )
         TYPE   20
  20     FORMAT(
     &   ' L   The lightness will be varied.  The amount  of  black  or'
     &  /'     white  added  to the hue will vary from all black (0) to'
     &  /'     all white (100).  The program allows seven  values.   0,'
     &  /'     20, 40, 50, 60, 80, and 100.                            '
     &  /'     EX.  MAP C0 180,20,100 MAP C0 180,80,100                '
     &  /'                                                             '
     &  /' S   The  saturation  of  the  hue  will  be varied.  At zero'
     &  /'     saturation there is no color present at all (gray).   At'
     &  /'     50%   saturation   all   colors  look  muted.   At  100%'
     &  /'     saturation, all hues are at their brightest.            '
     &  /'     EX.  MAP C0 120,50,0 MAP C0 120,50,100                  '
     &  /'                                                             '
     &  /' C   Changes the color pot which you are modifying.  You must'
     &  /'     enter  a number from 0 to 7 to complete the command.  In'
     &  /'     the first example  "C5"  was  entered.   In  the  second'
     &  /'     example "C2" was entered.                               '
     &  /'     EX.  MAP C5 120,50,100 MAP C2 120,50,100                '
     &  /'                                                             '
     &  /' E   The  program  will  stop.   You  can  also  type  CTRL-C'
     &  )
         TYPE   30
  30     FORMAT(
     &   '     (control-C) and get the same effect.  The picture on the'
     &  /'     Tektronix 4027 will not be affected.                    '
     &  /'                                                             '
     &  /' T   You  can see the values of the current paint pot without'
     &  /'     changing them by typing "T".                            '
     &  /'                                                             '
     &  /' P   If you enter "P" all of the paint pots will  be  changed'
     &  /'     to  default values.  The default colors in C0 through C7'
     &  /'     are: white, red, green, blue, yellow, cyan, magenta, and'
     &  /'     black.                                                  '
     &  /'                                                             '
     &  /' +   H,  L,  and S values will be incremented by some amount.'
     &  /'     The effect of "+" will remain until you type in "-".    '
     &  /'                                                             '
     &  /' -   H, L, and S values will be decremented by  some  amount.'
     &  /'     The effect of "-" will remain until you type in "+".    '
     &  /'                                                             '
     &  )
         TYPE   40
  40     FORMAT(
     &   ' R   Reads  a file which (hopefully) contains eight Tektronix'
     &  /'     4027 color commands.  You will be asked for a  filename.'
     &  /'     The  picture  will change to the colors contained in the'
     &  /'     file.                                                   '
     &  /'                                                             '
     &  /' W   Writes a file which contains eight Tektronix 4027  color'
     &  /'     commands.  You will be asked for a filename.  Be careful'
     &  /'     not to give the name of a  file  which  already  exists,'
     &  /'     because  it  will be overwritten.  You can read the file'
     &  /'     later with the "R" command.                             '
     &  /'                                                             '
     &  /' F   The current color values will be stored in  one  of  the'
     &  /'     first  nine Tektronix 4027 Function keys (F1-F9).  Then,'
     &  /'     when you press that  function  key,  your  display  will'
     &  /'     change  to  the  colors  which  it  contains.  Note that'
     &  /'     pressing the function key does NOT  change  the  current'
     &  /'     colors stored in this program; it changes the DISPLAY to'
     &  /'     the colors stored in the function key.                  '
     &  /'                                                             '
     &  )
         TYPE   50
  50     FORMAT(
     &   ' ?   Types out this help  file.   If  you  have  any  further'
     &  /'     questions, call Dennis Clark at 576-7384.               '
     &  )
	RETURN
	END
	SUBROUTINE HELPME
	COMMON /AREA/HLS(8,3),LITNES(7),LETRS(12),CPP,PP,HUEINC,SATINC,
     &  SIGN,VALUE
C
C	THIS SUBROUTINE CONTAINS THE HELP MESSAGES FOR EACH OF THE COMMANDS
C	OF THE MAIN PROGRAM.  IT ALSO CALLS THE SUBROUTINE CONTAINING THE
C	DETAILED HELP FILE WHICH IS  ABOUT 100 LINES LONG.
C
	TYPE 3
3	FORMAT(/' H=Hue L=Litness S=Saturation C=Change P=Primary'
     &  ,' E=Exit T=Type ?=Help'/' +=Increment',
     &  ' -=Decrement R=Read W=Write F=Function key'
     &  ,' ...TYPE ONE '$)
C
C	GET A CHARACTER AND CHECK TO SEE IF IT IS ONE WE KNOW ABOUT
C
	I=IKHAR(DUMY)
	IF(I.GT.96)I=I-32
	DO 5 J=1,13
	  IF(I.EQ.LETRS(J))GOTO 8
5	CONTINUE
C
C	WE DIDN'T RECOGNIZE IT, SO JUST RETURN
C
6	TYPE 7
7	FORMAT(/' (H, L, S, C, P, E, ?, T, +, -, R, W, F)',
     &  ' FOR HELP (?) ')
	RETURN
C
C	WE RECOGNIZED THE CHARACTER, SO BRANCH TO THE APPROPRIATE MESSAGES.
C
C	     H  L  S  C  P  +  -  E  ?   T   R   W   F
8	GOTO(10,20,30,40,50,60,70,80,90,100,110,120,130),J
10	TYPE 11
11	FORMAT(/' Typing H causes the HUE of the current paint'
     &  ,' pot to be incremented or'/' decremented depending',
     &  ' on whether the + or - is in effect. ')
	RETURN
20	TYPE 21
21	FORMAT(/' Typing L causes the LIGHTNESS of the current color to',
     &  ' be incremented'/' or decremented depending on whether the +'
     &  ,' or - is in effect. ')
	RETURN
30	TYPE 31
31	FORMAT(/' Typing S causes the SATURATION of the current hue to',
     &  ' be incremented or'/' decremented depending on whether the',
     &  ' + or - is in effect. ')
	RETURN
40	TYPE 41
41	FORMAT(/' Typing Cn (n=0-7) changes the current paint pot to',
     &  ' one of the'/' eight paint pots C0 through C7. ')
	RETURN
50	TYPE 51
51	FORMAT(/' P causes all of the paint pots C0-C7 to'
     &  ,' revert to their initial values.'/'  white, red, green, ',
     &  'blue, yellow, cyan, magenta, and black. ')
		RETURN
60	TYPE 61
61	FORMAT(/' Typing + causes the H, L, and S values to be'/
     &  ' incremented by some amount. ')
	RETURN
70	TYPE 71
71	FORMAT(/' Typing - causes the H, L, and S values to be'/
     &  ' decremented by some amount. ')
	RETURN
80	TYPE 81
81	FORMAT(/' Typing E causes you to Exit from the program.',
     &  ' The picture on the screen'/' will not be affected.',
     &  '  You can also type a control-C to exit. ')
	RETURN
90	TYPE 91
91	FORMAT(/' If you want to see the entire set of instructions,'/
     &  ' (about 100 lines of information) type Y.  '$)
	I=IKHAR(DUMY)
	IF(I.GT.96) I=I-32
	IF(I.EQ.89)GOTO 97
93	TYPE 94
94	FORMAT(/' (H, L, S, C, P, E, ?, T, +, -, R, W, F)',
     &  ' FOR HELP (?) ')
	RETURN
97	CALL HELPX
	RETURN
100	TYPE 101
101	FORMAT(/' Typing T causes a message to be printed.  It tells',
     &  ' what the current'/' paint pot is, (C0-C7) and what H, L,',
     &  ' and S values it contains. ')
	RETURN
110	TYPE 111
111	FORMAT(/' Typing R causes the program to read a file ',
     &  'which you name.'/' You can create files with the',
     &  ' W (Write) command. ')
	RETURN
120	TYPE 121
121	FORMAT(/' Typing W causes the program to write the values',
     &  ' of the current colors'/' into a file which you name.',
     &  '  Read them later with the R command. ')
	RETURN
130	TYPE 131
131	FORMAT(/' Typing Fn (n=1-9) causes the current colors of all',
     &  ' eight paint pots'/' to be stored in one of the first nine',
     &  ' (F1-F9) function keys. ')
	RETURN
	END


;THIS ROUTINE IS FORTRAN CALLABLE AND IS USED BY
;CALLING IT LIKE THIS:
;	I=IKHAR(DUMMY)
;IT RETURNS A SINGLE CHARACTER
	ENTRY IKHAR
IKHAR:	INCHRW	
	POPJ 17,
	END