C VIZIKLUGE MAIN PROGRAM
C SPREAD SHEET DRIVER PROGRAM
C Created as a gift to the world by G. Everhart because our installation
C can't affort $4000 for a commercial one. PUBLIC DOMAIN.
C with thanks to the DECUS library which provided the calculator
C program on which this is based.
	INCLUDE 'VKLUGPRM.FTN'
C	PARAMETER MXCOLS=6,MXROWS=20
C	PARAMETER RRW = 32
C	PARAMETER RCL = 32 ! REAL ROWS, COLS
C	PARAMETER DRW = 8
C	PARAMETER DCL = 8 ! DISPLAY MAX ROWS, COLS.
C	PARAMETER RRCL = 1024
C PARAMETER RRCL=RRW*RCL
C NOTE: THROUGHOUT, ROWS ARE ACTUALLY DOWN, COLUMNS ACROSS ON
C SCREEN. ROW 0 IN DISPLAY IS THE 27 ACCUMULATORS A-Z AND %, WITH
C % BEING THE LAST-COMPUTED VALUE FROM THE CALC PROGRAM, WHICH
C KNOWS HOW TO ACCESS THE DATA BUT IS JUST PASSED COMMAND STRINGS
C FROM THE DISK BASED FILE HERE.
C
C	VT100 DISPLAY CONTROL PARAMETER DEFINITIONS
C
      PARAMETER CUP = 1, CUU = 2, CUD = 3, CUF = 4, CUB = 5, DECDWL = 6
     $, DECDHL = 7, DECRC = 8, DECSC = 9, DECSWL = 10, ED = 11, EL = 12
     $, SGR = 13, NEL = 14, SCS = 15, SM = 16, RM = 17, ANSI = 18
C      PARAMETER TMREFN = 1
	INTEGER*2 PRL(6)
      BYTE NOWRAP ( 2 )
	LOGICAL*1 FORM,FVLD,CMDLIN(132)
	INTEGER*4 VNLT
	DIMENSION FORM(128),FVLD(RRW,RCL)
C FVLD FLAG 0 = NO FORMULA, -1= DISPLAY FORMULA ITSELF, NOT VALUE
C 1=VALID ACTIVE FORMULA THERE TO EVALUATE. INITIALLY ALL 0'S
C SO INITIALLY IGNORE.
C
C ROUTINE IN2AS COMPUTES ASCII CHARACTER NAMES OF SUBSCRIPTS IN1,IN2
C SO DISPLAY CAN HAVE THEM. IT MUST BE THE INVERSE OF VARSCN.
	INTEGER*2 PROW,PCOL,DROW,DCOL,DRWV,DCLV
	COMMON/DCTL/PROW,PCOL,DROW,DCOL,DRWV,DCLV
	DIMENSION NRDSP(DRW,DCL),NCDSP(DRW,DCL)
	COMMON/D2R/NRDSP,NCDSP
	LOGICAL*1 OARRY(100)
	INTEGER*2 OSWIT,OCNTR
	COMMON/OAR/OSWIT,OCNTR,OARRY
C COMMON OAR SWITCHES OUTPUT OFF IF OSWIT=2
	INTEGER*2 TYPE(RRW,RCL),VLEN(9)
	INTEGER*2 KLVL
	COMMON/KLVL/KLVL
	INTEGER*2 IOLVL
	COMMON/IOLVL/IOLVL
C IOLVL IS LUN FOR XQTCMD TO USE (NORMALLY 3 FOR INDIRECT FILES OR 5
C FOR TERMINAL. WE USE 5,6 FOR TERMINAL INPUT, OUTPUT NORMALLY.
	LOGICAL*1 AVBLS(100,27),VBLS(8,RRW,RCL)
	REAL*8 XXV(RRW,RCL)
	EQUIVALENCE(XXV(1,1),VBLS(1,1,1))
	COMMON/V/TYPE,AVBLS,VBLS,VLEN
C DEFFMT IS THE DEFAULT FORMAT FOR NUMERICS. INITIALLY IT WILL BE F9.2
	LOGICAL*1 DEFFMT(10),DVFMT(12)
	EQUIVALENCE(DVFMT(2),DEFFMT(1))
	COMMON/DEFVBX/DVFMT
	LOGICAL*1 NMSH(80)
	COMMON/NMSH/NMSH
	INTEGER*2 FORMFG,RCFGX,PZAP
	COMMON/FFGG/FORMFG,RCFGX,PZAP
C FORMFG FLAGS FORMAT OF DISPLAY GLOBALLY
C RCFGX FLAGS WHETHER TO DO AUTO RECALCULATION. IF 1, INHIBITS
C AUTO RECALC (USE R COMMAND TO DO A CALC.). RM COMMAND TURNS
C RCFGX ON.
C PZAP CONTROLS WHETHER TO REDRAW SCREEN. IF ZERO, NORMAL. IF 1
C (NONZERO ANYHOW), INHIBITS RE DISPLAY. V COMMAND RESETS TO 0
C  AND VM INHIBITS. (SETS TO 1).
C
C DISPLAY ARRAY WILL KEEP A COPY OF VARIABLES DISPLAYED AND FORMATS
C USED LOCALLY WHICH DISPLAY ROUTINE CAN USE TO SEE WHAT ACTUALLY
C NEEDS TO BE REFRESHED ON SCREEN. DRWV AND DCLV ARE COLS, ROWS OF
C DISPLAY ACTUALLY USED FOR SCREEN.
	INTEGER*2 CWIDS(DRW)
C CWIDS IS WIDTHS IN CHARACTERS OF COLUMNS ON DISPLAY. NOTE THAT BECAUSE
C OF PECULIAR INVERSION WHICH I AM TOO LAZY TO CORRECT IT IS DIMENSIONED
C AS DRW NOT DCL.
	INTEGER*4 I4TMP
	REAL*8 DVS(DRW,DCL)
	COMMON /FVLDC/FVLD
	LOGICAL*1 DFMTS(10,DRW,DCL)
C 10 CHARACTERS PER ENTRY.
	COMMON/DSPCMN/DVS,DFMTS,CWIDS
	DATA NOWRAP / "24,0 /
C INITIAL DEFAULT FORMAT FOR NUMERICS
C	DATA DVFMT/'(','F','9','.','2',6*32,')'/
C
C	SET UP TERMINAL
C SET IT NOWRAP, NO CARRIAGE CONTROL.
C
C SETUP INITIAL DISPLAY LIMITS ACTUALLY USED.
	IOLVL=5
	DRWV=MXCOLS
	DCLV=MXROWS
	KLVL=1
	ICODE=0
	RCFGX=0
	FORMFG=0
C      CALL GETADR ( PRL, NOWRAP )
C      PRL ( 2 ) = 2
C WTQIO issues I/O to set multiple characteristics of your terminal
C to turn off system's auto-wrap. If this is different either set it
C first by hand or modify.
C      CALL WTQIO ( SFSMC, 5, 2,,, PRL )
C	CALL ASSIGN(6,'TI:')
C	CALL ASSIGN(5,'TI:')
C must be able to turn off FORTRAN carriage control somehow.
      OPEN ( UNIT = 5, FILE='TT:',CARRIAGECONTROL = 'NONE' )
      OPEN ( UNIT = 6, FILE='TT:',CARRIAGECONTROL = 'NONE' )
	CALL UVT100(ANSI)
C	CALL UVT100(RM,8)
	CALL UVT100(ED,2)
	CALL UVT100(SCS,0,1)
	CALL UVT100(SCS,1,2)
	CALL UVT100(CUP,5,12)
C ZERO THE VARIABLES TO START OFF WITH.
	DO 2070 KK=1,100
	DO 2070 KKK=1,27
2070	AVBLS(KK,KKK)=0
	DO 2071 KK=1,RRW
	DO 2071 KKK=1,RCL
2071	XXV(KK,KKK)=0.
	CALL UVT100(SGR,7)
	WRITE(6,3010)
3010	FORMAT('PortaCalc')
	CALL UVT100(CUP,6,12)
	WRITE(6,3278)
3278	FORMAT('V03-01A')
	CALL UVT100(CUP,7,15)
	CALL UVT100(SGR,0)
	WRITE(6,3011)
3011	FORMAT('or')
	CALL UVT100(CUP,9,11)
	WRITE(6,3012)
3012	FORMAT('ViziKluge')
	CALL UVT100(CUP,12,3)
	WRITE(6,3013)
3013	FORMAT('(derived from Ger. KLUGE, = clever)')
	CALL UVT100(CUP,15,5)
	WRITE(6,3014)
3014	FORMAT(' by Glenn Everhart, as a public service.',/////)
	CALL UVT100(CUP,16,1)
C NOW GET ON WITH USEFUL WORK.
      PRL ( 2 ) = 1
      PRL ( 3 ) = 0
      CALL UVT100 ( ANSI )
C RESET MODE 8 (VT100 AUTOREPEAT)
C      CALL UVT100 ( RM, 8 )
C RESET MODE 5 (I.E., SCREEN TO BLACK BACKGROUND).
C      CALL UVT100 ( RM, 5 )
3000	CONTINUE
	PZAP=0
	LINIZZ=0
	CALL UVT100(CUP,18,1)
	WRITE(6,3588)
3588	FORMAT('Enter new numeric format default [Y/N]:')
	READ(IOLVL,3006,END=5600,ERR=5600)NMSH
	IF(NMSH(1).NE.'Y')GOTO 3589
C ENTER NEW DEFAULT.
	CALL UVT100(CUP,18,1)
	CALL UVT100(EL,2)
C LINE NOW ERASED... GET NEW FORMAT
	WRITE(6,3590)
3590	FORMAT('Enter new format. Suggest F9.2>')
	READ(IOLVL,3006,END=5600,ERR=5600)NMSH
C NOW HAVE HIS DESIRED FORMAT. COPY INTO THE DEFAULT ARRAY.
C DEFFMT IS THAT.
	DO 3591 N1=1,10
	KKK=NMSH(N1)
	KKK=MAX0(32,KKK)
C ASSUME NMSH COMPLETELY INIT'D
3591	DEFFMT(N1)=KKK
C CHECK ITS LEGALITY BY TRYING TO USE IT ONCE.
	XX=3.14159
	ENCODE(78,DVFMT,NMSH)XX
C IF IT FAILS, PROGRAM WILL CRASH AND FILE WON'T GET CLOBBERED.
3589	CONTINUE
	CALL UVT100(CUP,20,1)
	WRITE(6,3005)
3005	FORMAT(/,'Title of Spreadsheet:')
	READ(IOLVL,3006,END=5600,ERR=5600)NMSH
3006	FORMAT(80A1)
C NULL TERMINATE ALL FORMAT STRINGS.
	DO 16 N1=1,DRW
	CWIDS(N1)=10
	DO 16 N2=1,DCL
16	DFMTS(10,N1,N2)=0
	MXL=132
C READ IN SHEET NAME ON LUN 5 TO "SHT>" PROMPT.
	IF(ICODE.EQ.-4)GOTO 1
43	CALL UVT100(CUP,21,1)
	WRITE(6,3154)
3154	FORMAT(/,'Does a file to use for work storage exist?'
     1  '(Q=fast go)[Y/N/Q]:')
	CMDLIN(1)=0
	READ(IOLVL,3017,END=5600,ERR=5600)MXL,CMDLIN
	IOLDFL=0
	IF(CMDLIN(1).EQ.'Y')IOLDFL=1
	IF(CMDLIN(1).EQ.'Q')IOLDFL=2
	IF(CMDLIN(1).LE.32)IOLDFL=3
	IF(IOLDFL.EQ.0.AND.CMDLIN(1).NE.'N')GOTO 43
	CALL UVT100(CUP,22,1)
	WRITE(6,3016)
3016	FORMAT(/,'Enter filename of working spreadsheet>')
	READ(IOLVL,3017,END=5600,ERR=5600)MXL,CMDLIN
3017	FORMAT(Q,80A1,80A1)
C PUT UP SOMETHING FOR USER TO LOOK AT WHILE WE INITIALIZE.
	IF(IOLDFL.NE.2)CALL HELP
	MXL=MIN0(MXL,131)
	CMDLIN(MXL+1)=0
C USE THE GETCML FORM IN RSX IF DESIRED. NORMALLY USE LUN 5 ONLY.
C	CALL GETCML(CMDLIN,'SHT',MXL,132,,5)
C GET IN THE FILE NAME TO BE USED.
	CALL ASSIGN(7,CMDLIN,MXL)
	DEFINE FILE 7 (RRCL,64,U,I4TMP)
C  SET UP RANDOM FILE AS NEEDED FOR SHEET
C EACH RECORD HAS:
C CHARS 1-110	FORMULAS
C CHARS 120-128	DISPLAY FORMAT (INITIALLY F9.2)
C CHAR 119	VALID FLAG (ALLOWS HANDLING READS.)
C CHAR 118	MAGIC NUMBER 15 (CHECKS ALL WELL)
C READ A RECORD, IF ERROR, CREATE EMPTY FILE.
	IF(IOLDFL.EQ.0)GOTO 1
C IF IOLDFL NONZERO IT MEANS USER CLAIMS THERE EXISTS A FILE. IF 0 IT'S NEW.
C HERE IT'S OLD SO LET'S BE SURE IT REALLY IS OK.
	READ(7'1,ERR=2691,END=2691)FORM
	IF(FORM(118).NE.15)GOTO 1
	GOTO 2
2691	CONTINUE
C USER SCREWED UP. CLOSE AND REOPEN THE FILE TO ENSURE WE HAVE SOME CHANCE OF
C GETTING IT RIGHT.
	CLOSE(UNIT=7)
	DEFINE FILE 7 (RRCL,64,U,I4TMP)
1	CONTINUE
C HIT EOF OR ERROR. MUST BE A NEW FILE. THEREFORE ZERO IT TO OUR NEEDS.
	DO 3 N=1,128
	FORM(N)=0
3	CONTINUE
	DO 3592 N=1,9
3592	FORM(119+N)=DEFFMT(N)
	FORM(118)=15
C	FORM(120)='F'
C	FORM(121)='9'
C	FORM(122)='.'
C	FORM(123)='2'
	FORM(1)='0'
	FORM(2)='.'
C	FORM(119)=1
C FILL IN DISPLAY FORMATS INITIALLY TOO.
	DO 17 N1=1,DRW
	DO 17 N2=1,DCL
	DO 17 N3=1,9
	M=N3+119
17	DFMTS(N3,N1,N2)=FORM(M)
	DO 4 N=1,RRCL
4	WRITE(7'N)FORM
C
2	CONTINUE
C COMMON POINT WITH FILE PREPARED.
C
C NOW SET UP NRDSP, NCDSP
	DO 5 N1=1,DRW
	DO 5 N2=1,DCL
C INITIALLY WE DISPLAY THE UPPER LEFT PART OF THE SYSTEM.
	NRDSP(N1,N2)=N1
	NCDSP(N1,N2)=N2+1
	DVS(N1,N2)=.00000031
	DO 41 KK=1,10
41	DFMTS(KK,N1,N2)=DEFFMT(KK)
C	DFMTS(1,N1,N2)='F'
C	DFMTS(2,N1,N2)='9'
C	DFMTS(3,N1,N2)='.'
C	DFMTS(4,N1,N2)='2'
5	CONTINUE
	DO 40 N1=1,RRW
	DO 40 N2=1,RCL
	FVLD(N1,N2)=0
C INITIALIZE IN CASE WE DON'T READ FILE...QUICK STARTUP.
40	CONTINUE
	PCOL=2
	PROW=1
	DCOL=1
	DROW=1
	IF(IOLDFL.GT.1)GOTO 2000
C QUICK STARTUP IF HE REPLIES CR OR Q
	DO 6 N1=1,RRW
	DO 6 N2=1,RCL
	IRRX=(N2-1)*RRW+N1
	READ(7'IRRX)FORM
	IF(FORM(118).NE.15)FORM(119)=0
	IF(FORM(118).EQ.15)GOTO 7
	DO 9 N=1,128
	FORM(N)=0
9	CONTINUE
C	FORM(119)=1
	FORM(118)=15
	DO 3594 N=1,9
3594	FORM(119+N)=DEFFMT(N)
C	FORM(120)='F'
C	FORM(121)='9'
C	FORM(122)='.'
C	FORM(123)='2'
	FORM(1)='0'
	FORM(2)='.'
	WRITE(7'IRRX)FORM
7	CONTINUE
	FVLD(N1,N2)=FORM(119)
6	CONTINUE
C NOW HAVE VALIDITY MASK BUILT.
C NEXT SET UP FORMATS FOR ALL DISPLAY CELLS FROM OLD SHEET.
	DO 18 N1=1,DRW
	DO 18 N2=1,DCL
	M1=NRDSP(N1,N2)
	M2=NCDSP(N1,N2)
	DVS(N1,N2)=-1.
	IRRX=(M2-1)*RRW+M1
	READ(7'IRRX)FORM
	DO 19 N3=1,9
19	DFMTS(N3,N1,N2)=FORM(119+N3)
	DFMTS(10,N1,N2)=0
18	CONTINUE
C
2000	CONTINUE
C DRAW OUR LABELS AND OTHERWISE INITIALIZE DISPLAY SHEET
	IF(PZAP.EQ.0)CALL UVT100(ED,2)
	CALL UVT100(CUP,1,1)
	OSWIT=20
	IPRSS=PROW
	IPCSS=PCOL
	IDRW=DROW
	IDCL=DCOL
	IF(LINIZZ.LE.1)CALL RECALC
	IF(PZAP.EQ.0)CALL DSPSHT(2)
	DCOL=IDCL
	DROW=IDRW
	PROW=IPRSS
	PCOL=IPCSS
C
1000	CONTINUE
	LINIZZ=LINIZZ+1
	OSWIT=20
C ISSUE A PROMPT FOR COMMAND AND DO A COMMAND
	ICODE=0
	CALL XQTCMD(ICODE)
	OSWIT=20
	IPRSS=PROW
	IPCSS=PCOL
	IDRW=DROW
	IDCL=DCOL
	IF(LINIZZ.LE.1)CALL RECALC
	DCOL=IDCL
	DROW=IDRW
	PROW=IPRSS
	PCOL=IPCSS
	IF(ICODE.EQ.-1)GOTO 2000
	IF (ICODE.EQ.-2)CALL CLOSE(7)
	IF(ICODE.LE.-2)GOTO 3000
C
C  COMMANDS INCLUDE:
C E = ENTER NUMBERS
C M = MOVE FORMULAS (TO OTHER CELLS
C D = DISPLAY CHARACTERISTIC CHANGES
C V = VIEWSCREEN UPDATE. REDISPLAY EVERYTHING FROM SCRATCH.
C VF = VIEW WITH FORMULAS,NOT JUST NUMBERS.
C C = COPY NUMBERS
C 1,2,3,4 = MOVE CURSOR UP,DOWN,LEFT,RIGHT 1 ROW/COL
C (THESE DO NOT INVALIDATE CALCULATION SO RECALCULATION IS NOT
C DONE FOR THESE COMMANDS.)
C F = ENTER FORMULA
C R = RECALCULATE SHEET. RM = RECALC MANUALLY ONLY (R RESETS MODE).
C D = DROP INTO CALC CALCULATOR (*E RETURNS TO SHEET)
C L = LOCATE CURSOR (MOVE TO POSITION ON SHEET)
C (L VARIABLE IS THE COMMAND, AND IT LOCATES ORIGIN ON PHYSICAL
C SHEET. WILL ALSO MOVE CURSOR ON DISPLAY SHEET IF THAT CELL IS
C DISPLAYED, BUT OTHERWISE DOES NOT DISPLAY THE NUMBER.)
C Z = ZERO FORMULA/NUMBERS (OR ALL SHEET)
C  ZERO VARIABLE ZEROES THAT VARIABLE
C  ZERO VARIABLE1:VARIABLE2 ZEROES THAT RANGE (ROW OR COL)
C  ZERO * ZEROES ALL OF THE SHEET.
C X = EXIT (RETURNS TO OS)
C S = SAVE SHEET TO DISK (FORMULAS)
C P = PUT NUMBERS TO FILE. ALWAYS GENERATES P#+nn#+mm forms based on
C current location.
C G = GET NUMBERS OUT OF FILE. USES CURRENT ORIGIN FROM L COMMAND OR 1,1
C TO ENTER NUMBERS (ALLOWS COMBINING DATA).
C W = WRITE SCREEN ON PRINTER (HARDCOPY FORMAT APPROX. AS DISPLAY.)
C 
C NOTE THAT N-ARY FUNCTIONS ARE FNAME[ARGS,ARGS,...]
C AND RANGES ARE CELL1:CELLN. MULTIPLE COMMANDS IN FORMULA ARE
C DELIMITED BY \ CHARACTER.
C
C RECALCULATE SHEET NOW AUTOMAGICALLY
C IF ICODE=1, COMMAND JUST MOVES ON DISPLAY, SO NO NEED TO RECALCULATE
C THE ENTIRE SHEET.
	IF(ICODE.NE.1.AND.RCFGX.NE.1)CALL RECALC
C
C DISPLAY SHEET NOW. ONLY ALTERS ENTRIES INVALIDATED BY COMMAND.
	IF(ICODE.NE.2)GOTO 21
C ICODE=2 = REFRESH DISPLAY. ZERO ALL NUMBERS AND CAUSE TOTAL REDISPLAY.
	DO 22 N1=1,DRW
	DO 22 N2=1,DCL
C SET NUMBER DISPLAYED TO WEIRD VALUE.
22	DVS(N1,N2)=.000000000034
	IF(PZAP.EQ.0)CALL UVT100(ED,2)
	CALL UVT100(CUP,1,1)
21	CONTINUE
	IF(PZAP.EQ.0)CALL DSPSHT(ICODE)
	DCOL=IDCL
	DROW=IDRW
	PROW=IPRSS
	PCOL=IPCSS
	GOTO 1000
5600	CONTINUE
C ERROR ON READ FROM IOLVL HANDLED HERE.
	REWIND 5
	CLOSE(UNIT=3)
	IOLVL=5
	GOTO 1000
	END
	SUBROUTINE IN2AS(ROW,CHRS)
	INTEGER*2 ROW
	LOGICAL*1 CHRS(4)
	INTEGER*4 AC,AC1,AC2
	DO 1 N1=1,4
1	CHRS(N1)=32
C CONVERT ROW TO LETTERS. ASSUMES COL=2 OR MORE. ROW 1=A-Z
C ROW 2=AA-AZ, THEN BA-BZ ETC.
	AC=ROW
	DO 2 N=1,4
	M=5-N
C CONVERT BACKWARDS INTO CHRS
	AC1=(AC/26)
	AC2=AC1*26
	IX=AC-AC2
	IF(.NOT.(IX.EQ.0.AND.AC1.GT.0))GOTO 772
C CORRECT SO WE GET Z, NOT A<NULL> FOR LABELS.
	IX=26
	AC1=AC1-26
772	CONTINUE
	IF(IX.GT.0)CHRS(M)=IX+64
C CONVERT TO ASCII A-Z CHARACTER
	AC=AC1
2	CONTINUE
C JUST IGNORE ANY OVERFLOW.
	RETURN
	END
	SUBROUTINE HELP
C PRINT HELP INFO ON SCREEN USING FIRST 22 LINES. ASSUME XQTCMD INVALIDATES
C THE DISPLAY.
      PARAMETER CUP = 1, CUU = 2, CUD = 3, CUF = 4, CUB = 5, DECDWL = 6
     $, DECDHL = 7, DECRC = 8, DECSC = 9, DECSWL = 10, ED = 11, EL = 12
     $, SGR = 13, NEL = 14, SCS = 15, SM = 16, RM = 17, ANSI = 18
      PARAMETER TMREFN = 1
	CALL UVT100(ANSI)
	CALL UVT100(ED,2)
C	CALL UVT100(RM,8)
C	CALL UVT100(RM,5)
	CALL UVT100(CUP,1,1)
	WRITE(6,100)
	CALL UVT100(CUP,2,1)
	WRITE(6,101)
	CALL UVT100(CUP,3,1)
	WRITE(6,102)
	CALL UVT100(CUP,4,1)
	WRITE(6,103)
	CALL UVT100(CUP,5,1)
	WRITE(6,104)
	CALL UVT100(CUP,6,1)
	WRITE(6,105)
	CALL UVT100(CUP,7,1)
	WRITE(6,106)
	CALL UVT100(CUP,8,1)
	WRITE(6,107)
	CALL UVT100(CUP,9,1)
	WRITE(6,108)
	CALL UVT100(CUP,10,1)
	WRITE(6,109)
	CALL UVT100(CUP,11,1)
	WRITE(6,110)
	CALL UVT100(CUP,12,1)
	WRITE(6,111)
	CALL UVT100(CUP,13,1)
	WRITE(6,112)
	CALL UVT100(CUP,14,1)
	WRITE(6,113)
	CALL UVT100(CUP,15,1)
	WRITE(6,114)
	CALL UVT100(CUP,16,1)
	WRITE(6,122)
	CALL UVT100(CUP,17,1)
	WRITE(6,115)
	CALL UVT100(CUP,18,1)
	WRITE(6,116)
	CALL UVT100(CUP,19,1)
	WRITE(6,117)
	CALL UVT100(CUP,20,1)
	WRITE(6,118)
	CALL UVT100(CUP,21,1)
	WRITE(6,119)
	CALL UVT100(CUP,22,1)
	WRITE(6,120)
	CALL UVT100(CUP,23,1)
	WRITE(6,121)
	CALL UVT100(CUP,24,1)
100	FORMAT('EN expression - Insert expression at '
     1 'current pos.')
101	FORMAT('M1,M2,M3, or M4 - Motion up, down, left, right (auto)')
102	FORMAT('DL var1:var2 Rn:m (or Cn:m) - Display Loc phys to '
     1   'row/col n-m')
103	FORMAT('DF var1:var2 [format] - set display format.'
     1 ' A or L shows text, else #')
104	FORMAT('DT var1:var2 F or I - Set display number type to'
     1 ' flt or int')
105	FORMAT('DW n,m - set width of column n of display to m chars')
106	FORMAT('DB c,r - Set display bounds at c cols, r rows (chars)')
109	FORMAT('L var - Move cursor to var named (phys.)'
     1  ' OA var or OR var=move displ. origin')
107	FORMAT('V - redraw screen. VF - Disply. formulas. VM=no auto.'
     1  ' redraw')
108	FORMAT('K - Drop into interactive calc. *E returns to sheet.')
110	FORMAT('ZA - zero all. ZE var1:var2 - zero var1 thru var2')
111	FORMAT('X - exit program. W write screen to file or printer')
C112	FORMAT('CV v1:v2 v3:v4 copy value from v1:v2 to v3:v4 range')
113	FORMAT('CD v1:v2 v3:v4 copy display format. CF=copy formula'
     1  '. CA=copy all')
114	FORMAT('P Put screen to file. G=get screen from file at curr.loc')
C115	FORMAT('1,2,3, or 4 - move a cell Up, Down, Left, Right')
112	FORMAT('CV v1:v2 v3:v4 copy value from v1:v2 to v3:v4 range '
     1 'CR=copy and relocate vars.')
115	FORMAT('1,2,3,4 - move cursor Up,Down,Left,Right. '
     1  'A[A/R]n[R/C] Add abs/reloc n Row/Col')
116	FORMAT('Variable ranges are var1[:var2]. Var names P#+n#+m or')
117	FORMAT('D#+n#+m are current Phys or Display locs + or - offsets')
118	FORMAT('Expressions may use multiple stmts, use \ separators.')
119	FORMAT('Use std FORTRAN  function names + MIN, MAX, AVG, STD')
120	FORMAT('or SUM. IF stmt format is IF [v1.REL.v2]yes-expr|else'
     1  ' expr.')
121	FORMAT('Rels are .LT.,.GT.,.EQ.,.NE.,.GE.,.LE.')
122	FORMAT('R Recompute sheet. RM Recompute Manually only (R resets)')
	RETURN
	END
