.; .; PRN.CMD .; .; This is a printer port utility oriented to LA50. .; .SETS S$PROC .; Required ICP initialization: .ENABLE SUBSTITUTION .DISABLE DISPLAY .DISABLE DETACH .ENABLE CONTROL-Z .ENABLE ESCAPE-SEQUENCE .ENABLE OVERFLOW .; Required TT: driver initialization (must come after the .; .ENABLE ESCAPE-SEQUENCE): .SETN TIWID .SETS MCR "" .IF <> "MCR" .SETS MCR "MCR " .ENABLE QUIET 'MCR'SET /FORMFEED=TI: 'MCR'SET /LOWER=TI: 'MCR'SET /ESCSEQ=TI: 'MCR'SET /BUF=TI:132. .DISABLE QUIET .; Useful symbol definitions: .; The following are suitable for ASCII terminals: .SETN NJUNK 7 ! Define BELL to be a .SETS BELL "'NJUNK%V'" ! character. .SETN NJUNK 12 ! Define LF to be a .SETS LF "'NJUNK%V'" ! char. .SETN NJUNK 14 ! Define FF to be a .SETS FF "'NJUNK%V'" ! char. .SETN NJUNK 16 ! Define SO to be a .SETS SO "'NJUNK%V'" ! char. .SETN NJUNK 17 ! Define SI to be a .SETS SI "'NJUNK%V'" ! char. .SETN NJUNK 33 ! Define ESCAPE to be .SETS ESCAPE "'NJUNK%V'" ! an character .SETN NJUNK 217 ! Define SS3 to be an .SETS SS3 "'NJUNK%V'" ! (="O") .SETN NJUNK 233 ! Define CSI to be a .SETS CSI "'NJUNK%V'" ! (="[") .SETS BLANKS " " .SETS BLANKS BLANKS+BLANKS+BLANKS .; The following are suitable for ANSI terminals: .SETS HOME ESCAPE+"[H" ! HOME homes cursor .SETS CLEAR ESCAPE+"[J" ! CLEAR clears screen .SETS CLRLIN ESCAPE+"[K" ! Clear line. .SETS BOLD ESCAPE+"[1m" ! Bold video. .SETS REV ESCAPE+"[7m" ! Reverse video .SETS NML ESCAPE+"[m" ! Normal screen attrib. .SETS BOTTOM ESCAPE+"[24;1H" .; The following initializes a DEC VT100 or VT200 .; series terminal by homing and clearing the screen, .; loading the normal ASCII character set into G0 and .; the graphics character set into G1, and selecting G0. .SETS INIT HOME+CLEAR+ESCAPE+"(B"+ESCAPE+")0"+SI+NML .; The horizontal pitch on an LA50 is set by an escape .; sequence of the form "[w", where .; is as follows: .; 5 = 5 characters/inch .; 6 = 6 characters/inch .; 8 = 8 characters/inch .; 0 = 10 characters/inch .; 2 = 12 characters/inch .; 4 = 16.5 characters/inch .; The following array translates any desired integer .; pitch from 1 through 16 to the nearest equivalent .; excape sequence argument. .; .SETS S$PCHR "5555568800224444" .; Define parameters used in processing the arrow keys: .; These are defined by: .; .SETS ARROWx "axis,fac,sign,limit,test" .; where: .; x = last character of escape sequence; .; axis = name of symbol to update; .; fac = factor to apply if PF1 in effect; .; sign = direction of travel along axis; .; limit = limiting value on the axis; .; test = type of test to make against limit. .SETS ARROWA "N$FLD,8,-,0.,<" ! A = Up arrow. .SETS ARROWB "N$FLD,8,+,N$FMAX,>" ! B = Down arrow. .SETS ARROWC "N$CVAL,10,+,N$CMAX,>" ! C = Right arrow. .SETS ARROWD "N$CVAL,10,-,N$CMIN,<" ! D = Left arrow. .SETS ARROW5 "N$SCR,8,-,0.,<" ! Fake for "Prev Screen" .SETS ARROW6 "N$SCR,8,+,N$SMAX,>" ! Fake for "Next Screen" .GOTO ENTRY ! Skip subroutines. .; And, some useful subroutines: .; .; .GOSUB ASKE size;line;column\fldtxt .; .; Positions the cursor at the given line and column, .; displays "fldtxt" in a reverse video field, .; and issues a .ASKS. On return, .; TEXT contains the text part of the answer; .; ESCSEQ contains the escape sequence; .; contains the location of the escape .; character. .; .ASKE: .PARSE COMMAN ";" FLDSIZ COMMAN .PARSE COMMAN "\" COMMAN FLDTXT .GOSUB POSITN 'COMMAN%C' .TEST FLDTXT .SETS FLDTMP FLDTXT+BLANKS[+1:'FLDSIZ'.] .SETS ESCSEQ "" .INC N$FLD .DISABLE LOWERCASE .ASKS [::FLDTXT] TEXT 'COMMAN''REV''FLDTMP''COMMAN' .ENABLE LOWERCASE .SETS S$ERR "" .SETS S$GOTO "DISPAT" .IFT .RETURN .TEST TEXT ESCAPE .IF = 0 .TEST TEXT CSI .IF = 0 .TEST TEXT SS3 .IF <> 0 .SETS ESCSEQ TEXT[:*] .IF <> 0 .SETS TEXT TEXT[1:-1] .IF TEXT = "" .SETS TEXT FLDTXT .TEST TEXT .SETS FLDTMP TEXT+BLANKS[+1:'FLDSIZ'.] ;'COMMAN''REV''FLDTMP''BOTTOM''NML''CLRLIN''HOME' .RETURN .; .; .GOSUB POSITN line;column .; .; returns the escape sequence in COMMAN. .; .; The following is suitable for an ANSI terminal. .; .POSITN: .SETS COMMAN ESCAPE+"["+"'COMMAN%C'"+"H" .RETURN .; .; .GOSUB PLOTF size;line;column\text .; .; Plots the text in a reverse field at the given location. .; .PLOTF: .PARSE COMMAN ";" FLDSIZ COMMAN .PARSE COMMAN "\" COMMAN FLDTXT .GOSUB POSITN 'COMMAN%C' .TEST FLDTXT .SETS FLDTMP FLDTXT+BLANKS[+1:'FLDSIZ'.] ;'COMMAN''REV''FLDTMP' .RETURN .ENTRY: .; .SETT L$Y .SETF L$N .SETT L$T .SETF L$F .SETF L$0 .SETT L$1 .SETS S$T "Y" .SETS S$F "N" .SETN N$T 1. .SETN N$F 0. .SETN N$Y 1. .SETN N$N 0. .SETF GOLD .SETS S$GCTL "FLD" .SETN N$SCR 0. ! Initialy in screen 0 (= main) .SETN N$SMAX 2. ! Have a total of 3 screens. .SETN N$FLD 0. ! Initially on field 0 of that screen. .SETN N$FMX0 6. ! Screen 0 has 7 fields. .SETN N$FMX1 4. ! Screen 1 has 5 fields. .SETN N$FMX2 0. ! Screen 2 has 1 field. .SETN N$FMAX N$FMX'N$SCR%D' ! Set max flds for current screen. .SETN N$CVAL 0. ! Coded value of current field. .SETN N$CMIN 0. ! Min. coded value. .SETN N$CMAX 0. ! Max. coded value. .SETS S$FILE "" ! No file name yet. .SETN N$COPY 1. ! Number of copies. .SETT L$LFF ! Assume want a leading formfeed. .SETT L$TEJ ! Assume want a trailing formfeed. .SETN N$HPIT 10. ! Assume printer horiz. pitch is 10. .SETN N$FTY 0. ! File format. .SETS S$PNM0 "PIP" ! Format 0 processed by ...PIP. .SETS S$PNM1 "RNO" ! Format 1 processed by ...RNO. .SETS S$FTY0 "TEXT" ! Format 0 is called "TEXT". .SETS S$FTY1 "RUNOFF" ! Format 1 is called "RUNOFF". .SETF L$RDY ! Assume not ready to print. .SETT L$MRUN ! Allow multiple files per run. .SETS S$RNOT ".RNO" ! File types to be fed to RUNOFF. .SETN N$DHP 10. ! Default pitch (0 = auto). .SETN N$TLF 0. ! Linefeeds after trailing formfeed. .SETN N$PWID 8. ! Assume printer width is 8. .TRANSLATE PRN$MULTIPLE_REQUESTS .IF <> "" .SETL L$MRUN L$'' .TRANSLATE PRN$RUNOFF_FILES .IF <> "" .SETS S$RNOT .TRANSLATE PRN$DEFAULT_HORIZONTAL_PITCH .IF <> "" .SETN N$DHP ''. .TRANSLATE PRN$TRAILING_LINEFEED .IF <> "" .SETN N$TLF ''. .TRANSLATE PRN$PRINTER_WIDTH .IF <> "" .SETN N$PWID ''. .SETS S$ERR "" .SETS ESCSEQ "" .SETS TEXT P1 .IF TEXT = "" .GOTO PAINT .SETN N$OFLD N$FLD .INC N$FLD .SETS S$OGCT S$GCTL .SETS S$GCTL "FLD" .SETS S$GOTO "PAINT" .GOTO GOTFIL .PAINT: .GOTO PAINT'N$SCR%D' .PAINT0:;'INIT' .TEST S$PROC .SETN N$COL 40.-(/2) .SETS S$JUNK BLANKS[1:N$COL]+S$PROC ;'HOME''CLEAR''S$JUNK' ; Printer Port Utility ; ; Use: ^Z to exit, for help, for setup, to print ; ; File name: 'REV''S$FILE%L40''NML' ; Number of copies: 'REV''N$COPY%DL2''NML' .SETS S$CVAL S$'L$LFF' ; Leading formfeed [Y/N]: 'REV''S$CVAL''NML' .SETS S$CVAL S$'L$TEJ' ; Trailing formfeed [Y/N]: 'REV''S$CVAL''NML' ; Horizontal pitch: 'REV''N$HPIT%DL2''NML' .SETS S$CVAL S$FTY'N$FTY%D' ; File format: 'REV''S$CVAL%L6''NML' ; ; ; ; ; .SETS S$CVAL S$'L$RDY' ; Ready to print [Y/N]: 'REV''S$CVAL''NML' ;'BOTTOM''CLRLIN''BOLD''S$ERR''NML''HOME' .GOTO DISPAT .PAINT1:;'INIT' .TEST S$PROC .SETN N$COL 40.-(/2) .SETS S$JUNK BLANKS[1:N$COL]+S$PROC ;'HOME''CLEAR''S$JUNK' ; Printer Port Utility Setup Screen ; Use to return to Main Screen ; ; ; ; ; ; ; ; ; .SETS S$JUNK S$'L$MRUN' ; Multiple prints per PRN run: 'REV''S$JUNK''NML' ; File types of RUNOFF files: 'REV''S$RNOT%L40''NML' ; Default pitch (0 = auto): 'REV''N$DHP%DL2''NML' ; Linefeeds after last formfeed: 'REV''N$TLF%L2D''NML' ; Printer width: 'REV''N$PWID%L2D''NML' ;'BOTTOM''CLRLIN''BOLD''S$ERR''NML''HOME' .GOTO DISPAT .PAINT2:;'INIT' .TEST S$PROC .SETN N$COL 40.-(/2) .SETS S$JUNK BLANKS[1:N$COL]+S$PROC ;'HOME''CLEAR''S$JUNK' ;'SO' ;lqqqqqqqqwqqqqqqqqwqqqqqqqqwqqqqqqqqk lqqqqqqqqwqqqqqqqqwqqqqqqqqwqqqqqqqqk ;x ^ xNEXT FLDx x x x'REV' 'NML'x x SETUP x PRINT x ;x x x'REV'LAST FLD'NML'x x x'REV' GOLD 'NML'x HELP x x x ;xPREV FLDx x xVALUE-1 xVALUE+1 x x'REV' 'NML'x x'REV' REDRAW 'NML'x'REV' EXIT 'NML'x ;x'REV'FRST FLD'NML'x 'SI'v'SO' x'REV'VALUE-10'NML'x'REV'VALUE+10'NML'x tqqqqqqqqnqqqqqqqqnqqqqqqqqnqqqqqqqqu ;mqqqqqqqqvqqqqqqqqvqqqqqqqqvqqqqqqqqj x x x x x ; x x x x x ; x x x x x ; tqqqqqqqqnqqqqqqqqnqqqqqqqqnqqqqqqqqu ; x x x x x ; x x x x x ; x x x x x ; tqqqqqqqqnqqqqqqqqnqqqqqqqqnqqqqqqqqu ; x x x x x ; x x x x x ; x x x x x ; tqqqqqqqqvqqqqqqqqnqqqqqqqqu x ;'SI'CTRL/Z Exit from PRN'SO' x x x x ; x x x x ; x x x x ;'BOLD''SI'To exit HELP, press the help key again.'SO''NML' mqqqqqqqqqqqqqqqqqvqqqqqqqqvqqqqqqqqj'SI''HOME' ;'BOTTOM''CLRLIN''BOLD''S$ERR''NML''HOME' .GOTO DISPAT .DISPAT: .SETN N$OFLD N$FLD .SETS S$OGCT S$GCTL .SETS S$GCTL "FLD" .GOTO 'S$OGCT''N$SCR%D''N$FLD%D' .FLD00: .GOSUB ASKE 40;6;34\'S$FILE' .IFT .GOTO EXIT .IF TEXT = "" .GOTO ESCPSI .SETS S$GOTO "DISPAT" .GOTFIL:.; .SETS TEXT "'TEXT%C'" .SETS S$ERR "Error - File 'TEXT' not found." .TESTFILE 'TEXT' .IF <> 1 .GOTO INPERR .SETS S$ERR "" .IF S$FILE <> .SETS S$GOTO "PAINT" .SETS S$FILE .PARSE S$FILE ".;" S$JUNK S$FTYP S$JUNK .SETN N$FTY 0. .TEST S$RNOT S$FTYP .IF > 0 .GOTO GOTRNO .SETF L$LFF .SETT L$TEJ .OPENR 'S$FILE' .PARSE "," S$JUNK S$JUNK S$HPIT S$JUNK .SETN N$HPIT 'S$HPIT'./N$PWID .IF N$DHP > 0 .SETN N$HPIT N$DHP .READ TEXT .CLOSE .TEST TEXT FF .IF = 0 .SETT L$LFF .GOTO ESCPSI .GOTRNO:.SETT L$LFF .SETF L$TEJ .SETN N$FTY 1. .GOTO ESCPSI .FLD01: .SETN N$CVAL N$COPY .SETN N$CMIN 1. .SETN N$CMAX 99. .GOSUB ASKE 2;7;34\'N$COPY%D' .IFT .GOTO EXIT .SETS S$ERR #Error - You must give a number between 'N$CMIN%D' and 'N$CMAX%D'.# .TEST TEXT .IFF .GOTO INPERR .SETN N$CVAL 0'TEXT'. .IF N$CVAL < N$CMIN .GOTO INPERR .IF N$CVAL > N$CMAX .GOTO INPERR .SETS S$ERR "" .COD01: .SETN N$COPY N$CVAL .GOTO ESCPSI .FLD02: .SETN N$CVAL N$'L$LFF' .SETN N$CMIN N$F .SETN N$CMAX N$T .SETS S$CVAL S$'L$LFF' .GOSUB ASKE 1;8;34\'S$CVAL' .IFT .GOTO EXIT .SETS S$ERR #Error - You must reply "Y" or "N".# .TEST "YN" TEXT .IF = 0 .GOTO INPERR .SETN N$CVAL N$'TEXT' .SETS S$ERR "" .COD02: .SETL L$LFF L$'N$CVAL' .GOTO ESCPSI .FLD03: .SETN N$CVAL N$'L$TEJ' .SETN N$CMIN N$F .SETN N$CMAX N$T .SETS S$CVAL S$'L$TEJ' .GOSUB ASKE 1;9;34\'S$CVAL' .IFT .GOTO EXIT .SETS S$ERR #Error - You must reply "Y" or "N".# .TEST "YN" TEXT .IF = 0 .GOTO INPERR .SETN N$CVAL N$'TEXT' .SETS S$ERR "" .COD03: .SETL L$TEJ L$'N$CVAL' .GOTO ESCPSI .FLD04: .SETN N$CVAL N$HPIT .SETN N$CMIN 5. .SETN N$CMAX 16. .GOSUB ASKE 2;10;34\'N$CVAL%D' .IFT .GOTO EXIT .SETS S$ERR #Error - You must give a number between 'N$CMIN%D' and 'N$CMAX%D'.# .TEST TEXT .IFF .GOTO INPERR .SETN N$CVAL 0'TEXT'. .IF N$CVAL < N$CMIN .GOTO INPERR .IF N$CVAL > N$CMAX .GOTO INPERR .SETS S$ERR "" .COD04: .SETN N$HPIT N$CVAL .GOTO ESCPSI .FLD05: .SETN N$CVAL N$FTY .SETN N$CMIN 0. .SETN N$CMAX 1. .SETS S$CVAL S$FTY'N$FTY%D' .GOSUB ASKE 6;11;34\'S$CVAL' .IFT .GOTO EXIT .IF TEXT = "" .SETS TEXT S$FTY'N$FTY%D' .SETS S$ERR #Error - You must reply "'S$FTY0'" or "'S$FTY1'".# .IFF .GOTO INPERR .SETS S$CVAL "/'S$FTY0':0/'S$FTY1':1/" .TEST S$CVAL "/'TEXT'" .IF = 0 .GOTO INPERR .SETS S$CVAL S$CVAL[+1:*] .PARSE S$CVAL "/" S$CVAL S$JUNK .PARSE S$CVAL ":" S$JUNK S$CVAL .SETN N$CVAL 'S$CVAL'. .SETS S$CVAL S$FTY'N$CVAL%D' .GOSUB PLOTF 6;11;34\'S$CVAL' .SETS S$ERR "" .COD05: .SETN N$FTY N$CVAL .GOTO ESCPSI .FLD06: .SETN N$CVAL N$'L$RDY' .SETN N$CMIN N$F .SETN N$CMAX N$T .SETS S$CVAL S$'L$RDY' .GOSUB ASKE 1;17;34\'S$CVAL' .IFT .GOTO EXIT .SETS S$ERR #Error - You must reply "Y" or "N".# .TEST "YN" TEXT .IF = 0 .GOTO INPERR .SETN N$FLD 0. .SETN N$CVAL N$'TEXT' .SETS S$ERR "" .COD06: .SETS S$ERR "Error - You have not specified a file to print." .IF S$FILE = "" .IFT L$'N$CVAL' .GOTO INPERR .IFT L$'N$CVAL' .SETS S$GOTO "DOIT" .GOTO ESCPSI .FLD10: .SETN N$CVAL N$'L$MRUN' .SETN N$CMIN N$F .SETN N$CMAX N$T .SETS S$CVAL S$'L$MRUN' .GOSUB ASKE 1;13;34\'S$CVAL' .IFT .GOTO EXIT .SETS S$ERR #Error - You must reply "Y" or "N".# .TEST "YN" TEXT .IF = 0 .GOTO INPERR .SETN N$CVAL N$'TEXT' .SETS S$ERR "" .COD10: .IF N$CVAL = N$'L$MRUN' .GOTO ESCPSI .SETL L$MRUN L$'N$CVAL' .ENABLE QUIET 'MCR'DFL 'L$MRUN'=PRN$MULTIPLE_REQUESTS .DISABLE QUIET .GOTO ESCPSI .FLD11: .GOSUB ASKE 40;14;34\'S$RNOT' .IFT .GOTO EXIT .IF TEXT = "" .GOTO ESCPSI .IF TEXT = S$RNOT .GOTO ESCPSI .SETS S$RNOT TEXT .ENABLE QUIET 'MCR'DFL "'S$RNOT'"=PRN$RUNOFF_FILES .DISABLE QUIET .GOTO ESCPSI .FLD12: .SETN N$CVAL N$DHP .SETN N$CMIN 0. .SETN N$CMAX 16. .GOSUB ASKE 2;15;34\'N$CVAL%D' .IFT .GOTO EXIT .SETS S$ERR #Error - You must give a number between 'N$CMIN%D' and 'N$CMAX%D'.# .IF TEXT = "" .GOTO ESCPSI .TEST TEXT .IFF .GOTO INPERR .SETN N$CVAL 0'TEXT'. .IF N$CVAL < N$CMIN .GOTO INPERR .IF N$CVAL > N$CMAX .GOTO INPERR .SETS S$ERR "" .COD12: .IF N$CVAL = N$DHP .GOTO ESCPSI .SETN N$DHP N$CVAL .ENABLE QUIET 'MCR'DFL 'N$DHP%D'=PRN$DEFAULT_HORIZONTAL_PITCH .DISABLE QUIET .GOTO ESCPSI .FLD13: .SETN N$CVAL N$TLF .SETN N$CMIN 0. .SETN N$CMAX 16. .GOSUB ASKE 2;16;34\'N$CVAL%D' .IFT .GOTO EXIT .SETS S$ERR #Error - You must give a number between 'N$CMIN%D' and 'N$CMAX%D'.# .IF TEXT = "" .GOTO ESCPSI .TEST TEXT .IFF .GOTO INPERR .SETN N$CVAL 0'TEXT'. .IF N$CVAL < N$CMIN .GOTO INPERR .IF N$CVAL > N$CMAX .GOTO INPERR .SETS S$ERR "" .COD13: .IF N$CVAL = N$TLF .GOTO ESCPSI .SETN N$TLF N$CVAL .ENABLE QUIET 'MCR'DFL 'N$TLF%D'=PRN$TRAILING_LINEFEED .DISABLE QUIET .GOTO ESCPSI .FLD14: .SETN N$CVAL N$PWID .SETN N$CMIN 4. .SETN N$CMAX 20. .GOSUB ASKE 2;17;34\'N$CVAL%D' .IFT .GOTO EXIT .SETS S$ERR #Error - You must give a number between 'N$CMIN%D' and 'N$CMAX%D'.# .SETN N$FLD 0 .IF TEXT = "" .GOTO ESCPSI .TEST TEXT .IFF .GOTO INPERR .SETN N$CVAL 0'TEXT'. .IF N$CVAL < N$CMIN .GOTO INPERR .IF N$CVAL > N$CMAX .GOTO INPERR .SETS S$ERR "" .COD14: .IF N$CVAL = N$PWID .GOTO ESCPSI .SETN N$PWID N$CVAL .ENABLE QUIET 'MCR'DFL 'N$PWID%D'=PRN$PRINTER_WIDTH .DISABLE QUIET .GOTO ESCPSI .FLD20: .GOSUB ASKE 0;1;1\ .IFT .GOTO EXIT .SETN N$FLD 0 .GOTO ESCPSI .INPERR:;'BOTTOM''CLRLIN''BOLD''S$ERR''NML''HOME' .LGCERR:.SETN N$FLD N$OFLD .GOTO 'S$GOTO' .; Initialize the escape sequence parser: .ESCPSI: .SETS ESCTYP "INI" ! Set parser "state". .SETN ESCAMX 0. ! Set number of arguments. .SETN ESCA0 0. ! Clear the first argument. .; Main parser loop: .; Strip off the next character (if any), convert it to .; a number, and do a "computed" GO TO based on current .; parser state and character code: .ESCPSR: .IF ESCSEQ = "" .GOTO 'S$GOTO' ! If done, get more. .SETS CHAR ESCSEQ[1:1] ! Get first character, .SETS ESCSEQ ESCSEQ[2:*] ! remove from buffer. .SETN CVALUE 'CHAR%V' ! Get its value. .ONERR ESCPSE ! Trap unexpected chars. .GOTO 'ESCTYP''CVALUE' ! Handle this character. .; Any unrecognised characters end up here. .ESCPSE:.SETN N$FLD N$OFLD ! Error. Recover field .SETF GOLD ! Turn off gold key .GOTO 'S$GOTO' ! Go do whatever. .; First character = ; set state: .INI33: .SETS ESCTYP "ESC" ! Go to escape "state". .GOTO ESCPSR ! Get next character. .; First character is , or .INI217:.; .; First was and second is "O"; set state: .ESC117:.SETS ESCTYP "SS3" ! Go to SS3 "state". .GOTO ESCPSR ! Get next character. .; Got nnn~ = one of the "F" keys. Dispatch appropriately. .CSI176:.GOTO FKY'ESCA0%D' .; Got P = PF1 - use it as shift key: .SS3120:.SETN N$FLD N$OFLD .SETT GOLD ! Set shift flag. .GOTO ESCPSI ! Get next escape seq. .FKY28: .; Got LK201 "Help" key. .; Got Q = PF2 - use it as help key: .SS3121:.SETS S$GOTO "PAINT" .SETN N$FLD N$OFLD .SETN N$OFLD 2. .IF N$SCR = 2. .SETN N$OFLD 0. .SETN N$SCR N$OFLD .SETN N$OFLD 0. .SETN N$FLD 0. .SETN N$FMAX N$FMX'N$SCR' .SETF GOLD .GOTO ESCPSI ! Get next escape seq. .; Got R = PF3 - use it as setup key: .SS3122:.SETS S$GOTO "PAINT" .SETN N$FLD N$OFLD .IFT GOLD .GOTO REFRSH .SETN N$OFLD 1. .IF N$SCR = 1. .SETN N$OFLD 0. .SETN N$SCR N$OFLD .SETN N$OFLD 0. .SETN N$FLD 0. .SETN N$FMAX N$FMX'N$SCR' .REFRSH:.SETF GOLD .GOTO ESCPSI ! Get next escape seq. .FKY29: .; Got LK201 "Do" key. .SETF GOLD ! Turn off "gold". .; Got S = PF4 - use it as print or exit key: .SS3123:.SETN N$FLD N$OFLD .IFT GOLD .GOTO EXIT .SETS S$ERR "Error - You have not specified a file to print." .IF S$FILE = "" .GOTO INPERR .SETS S$GOTO "DOIT" .GOTO ESCPSI ! Get next escape seq. .; First character is , or .INI233:.; .; First was and second is "["; set state: .ESC133:.SETS ESCTYP "CSI" ! Go to CSI "state". .GOTO ESCPSR ! Get next character. .; In a sequence, and have a decimal digit: .CSI60: .; .CSI61: .; .CSI62: .; .CSI63: .; .CSI64: .; .CSI65: .; .CSI66: .; .CSI67: .; .CSI70: .; .CSI71: .; .; ! Accumulate parameter. .SETN ESCA'ESCAMX' ESCA'ESCAMX'*10.+CVALUE-60 .GOTO ESCPSR ! Get next character. .; In a sequence, and got a ";"; End of parameter: .CSI73: .SETN ESCAMX ESCAMX+1. ! Have another param. .SETN ESCA'ESCAMX' 0. ! Initialize it. .GOTO ESCPSR ! Get next character. .FKY5: .; LK201 "Prev. Screen" key. .FKY6: .; LK201 "Next Screen" key. .SETS CHAR "'ESCA0%D'" ! Fake "n" .SETN ESCA0 1. ! Force argument to 1. .SETS S$GOTO "PAINT" ! We will need to repaint. .SETN N$FLD 0. ! Force to field 0. .GOTO ARROW ! Process like arrow. .; An arrow key generates these escape sequences: .CSI103:.; C = Right arrow; .CSI104:.; D = Left arrow. .SETS S$GCTL "COD" .CSI101:.; A = Up arrow; .CSI102:.; B = Down arrow; .ARROW:.; .SETN N$FLD N$OFLD .PARSE ARROW'CHAR' "," AXIS FAC SIGN LIMIT TEST .IF ESCA0 = 0 .SETN ESCA0 1. ! Force param. .IFT GOLD .SETN ESCA0 ESCA0*'FAC'. ! Apply PF1. .SETN 'AXIS' 'AXIS''SIGN'ESCA0 ! Set new loc. .IF 'AXIS' 'TEST' 'LIMIT' .SETN 'AXIS' 'LIMIT' .SETF GOLD ! Clear shift key. .GOTO ESCPSR ! Get next character. .DOIT: .SETS S$HDR ESCAPE+"[5i"+ESCAPE+"["+S$PCHR[N$HPIT:N$HPIT]+"w" .IFT L$LFF .SETS S$HDR S$HDR+FF .SETS S$SEP "" .IFT L$LFF .IFT L$TEJ .SETS S$SEP FF .SETS S$PRC S$PNM'N$FTY%D' .SETN N$ITER N$COPY ;'BOTTOM''CLRLIN''BOLD'Information - Printing 'S$FILE''NML''HOME' .DOITL: ;'S$HDR' .SETS S$HDR "" .ENABLE QUIET 'MCR''S$PRC' TI:='S$FILE' .DISABLE QUIET .SETS S$HDR S$SEP .DEC N$ITER .IF N$ITER > 0 .GOTO DOITL .SETS S$JUNK ESCAPE+"[w"+ESCAPE+"[4i" .IFT L$TEJ .SETS S$JUNK FF+S$JUNK ;'S$JUNK' ;'BOTTOM''CLRLIN''BOLD''BELL''BELL'Information - Done printing 'S$FILE''NML''HOME' .SETN N$FLD 0 .IFT L$MRUN .GOTO DISPAT .EXIT: .; .ENABLE QUIET 'MCR'SET /BUF=TI:'TIWID%D'. .DISABLE QUIET ;'INIT' .EXIT