TCFL: Terminal Control Function Library by S.C. CRIBBS Pinawa, Manitoba Canada R0E1L0 Preliminary Document ABSTRACT TCFL is a subroutine library that provides RT-11 programmers with a convenient method for controlling "smart" terminals. Fortran callable routines have been provided for the issuing of most ANSI terminal control sequences and also for the receipt and interpretation of response from the terminal. RT-11 multi-terminal or single console I/O options can be selected during program assembly. TCFL: Terminal Control Function Library TCFL is the collective name for a grouping of subroutines which are used to control and monitor the operation of "smart" terminals. Smart in this context means terminals that respond to code extension techniques defined in ANSI standards X3.41-1974 AND X3.64-1979 (ISO 2022 and 6429). The Digital Equipment Corporation VT100 video and LA120 hardcopy families of terminals support the above standard control techniques and additional DEC private control sequences. This subroutine library provides RT-11 programmers with a convenient software tool for issuing control sequence strings and the monitoring and interpretation of terminal response. The subroutines are written in MACRO-11 to minimize memory usage, but have been designed for use by FORTRAN-IV programs. Specifically, support is provided for the ANSI mode control of the VT100 series and VT125 video terminals and the LA120, LA34, LA100, and LA12 (Corespondent) hardcopy units. Software assembly time options enable creation of subsets of the control function subroutines for users that do not require the complete package. The control strings generated by the TCFL routines can be issued directly to the RT-11 program console or optionally, through multi-terminal directives, to an alternate terminal or can be returned as ASCII character strings in a user provided array. Input from the console terminal (or multi-terminal unit) may be routed through the input service routines which detect and interpret ANSI escape sequences. RT-11 monitor timer features ensure minimal CPU usage when the input code filter routine is assembled for the Foreground-Background (FB) or Extended Memory (XM) monitors. Simulated timer watchdog code can be selected to oversee input response in those systems unable to support the RT-11 daytime clock routine. The TCFL library provides the basic programming tools necessary to enable the creation of programs with the sophistication of KED in handling cursor positioning and keypad interpretation. I won't suggest that this software provides the utility of FMS-11, but for many RT-11 applications simple screen displays controlled directly by the program are easier to implement and require less memory. As mentioned above, TCFL can be assembled to use multi-terminal I/O. Programs written to perform all terminal communication through the TCFL subroutines can be converted to multi-terminal use with just one subroutine call. Several example programs have been provided to demonstrate TCFL: Be sure to SET TT: NOCRLF before executing the demos! ------ Page 2 TCFL Demonstration Programs 1. KTRMID - This routine solicits and interprets a terminal's identification string. This can be very useful for applications that must be run only on a video terminal! File TID.NTE, included in the distribution, contains the identification codes of commonly used DEC terminals. 2. CURP - Demonstrates simple FORTRAN control of screen cursor position. 3. KTCC - Shows that TCFL can properly interpret any key code or character sequence sent from the terminal keyboard. In addition, KTCC demonstrates how to write an input interpretion routine using TCFL subroutines. 4. SLVPLY - Uses the TCFL output subroutines to build screen forms. Rigid control of cursor positioning is enforced and each character input by the user is subjected to validation tests. True, the task the program accomplishes is trivial, but it sure gave me an appreciation for the finesse required if one wants to attempt proper forms management. 5. SLVPLM - Multi-terminal version of SLVPLY. Just start it from the consol;, it will prompt you for the number of the terminal to be used. Note that the only difference in the FORTRAN program from SLVPLY is one call from the mainline to a terminal allocation routine. 6. SLVPLX - Differs from SLVPLY in that the forms to be displayed are stored within the program as ASCII strings. SLVPLY generates each form as required by calling the output subroutines. SLVPLX just routes stored text to the terminal. One look at the actual executable code required in this version should convince you of the desirability of this method. Program TXTWRT, included as a separate submission, greatly simplifies forms design. Page 3 The naming and descriptions of the individual subroutines that presently make up the TCFL library have been included in the following appendices: APPENDIX CONTENTS A. - All TCFL supported Terminal Control Output Commands B. - VT125 Terminal Control Commands subset C. - VT100 Terminal Control Commands subset D. - LA34 (LA12,LA100) Terminal Control Commands subset E. - LA120 Terminal Control Commands subset F. - Terminal Input and Utility subroutines Considerable effort has been expended to make the TCFL files useful on as wide a range of terminal and computer hardware as possible. This has been accomplished through extensive use of MACRO-11 conditional code. The files must be assembled with parameter file PTCFL.MAC which turns on selected options: .ENABL LC ; Conditional file for TCFL%%.MAC ; Common Symbols ; NHD = 1 ;Symbol should be defined for NHD mathematics ; For TCFLO - Output routines ESC = 33 ;Define Escape Sequence Introducer SZEM4 = 20. ;Length (bytes) of MSG4 buffer VT$.$ = 1 ;Define for default video terminal features ; VT125 = 1 ;Define for VT125 specific features ; LA$.$ = 1 ;Define for default hardcopy terminal features ; LA34 = 1 ;Define for LA34 specific features (LA12,LA100) ; For TCFLIO - Input - Output routines ; ONLY$O = 1 ;Assemble only output code ; MTT$Y = 1 ;Define for Multi-terminal I/O ; USERBF = 1 ;Output routed to user's buffer FBXM = 1 ;Monitor (FB or XM) supports .TWAIT ; TIME$R = 1 ;Monitor provides .MRKT support (SJ) The above configuration selects normal defaults for arithmetic instructions (EIS code), Escape Sequence introducer and maximum length of generated output string. Output will be routed to the RT-11 program console (.PRINT) and will consist of only those control codes recognized by the standard VT100 terminal. Input time-out will be detected through use of RT-11 FB/XM monitor timer support routine ".TWAIT". Page 4 Three object libraries have been included in this submission. All three were built for RT-11 systems that support atleast the EIS instruction set. Should NHD code be required, the libraries can be rebuilt with the "NHD" symbol defined in parameter file PTCFL.MAC. 1. TCFL.CSL - I/O between computer and program console Symbols ONLY$O, MTT$Y, USERBF not defined in PTCFL.MAC .MACRO PTCFL+TCFLIO/OBJECT .MACRO TCFLU1 .MACRO PTCFL+TCFLU2/OBJECT .MACRO PTCFL+TCFLO/OBJECT .LIBRARY/CREATE TCFL.CSL TCFLIO,TCFLU1,TCFLU2,TCFLO 2. TCFL.MTT - I/O support for RT-11 multi-terminals Symbols ONLY$O, USERBF not defined in PTCFL.MAC Symbol MTT$Y defined .MACRO PTCFL+TCFLIO/OBJECT .MACRO TCFLU1 .MACRO PTCFL+TCFLU2/OBJECT .MACRO PTCFL+TCFLO/OBJECT .LIBRARY/CREATE TCFL.MTT TCFLIO,TCFLU1,TCFLU2,TCFLO 3. TCFL.BFO - Output only, to a user supplied text buffer Symbol MTT$Y not defined in PTCFL.MAC Symbols ONLY$O, USERBF defined .MACRO PTCFL+TCFLIO/OBJECT .MACRO PTCFL+TCFLO/OBJECT .LIBRARY/CREATE TCFL.BFO TCFLIO,TCFLO Note: TCFL.BFO is used by program TXTWRT.SAV: another related submission to the 1983 DECUS Spring symposium APPENDIX A Alphabetical Index of All Terminal Control Commands Alphabetical Index of All Terminal Control Commands Page A-2 ================================================================ Name Generated Code Function Description ---------------------------------------------------------------- ALIGND <"33>#8 -ALIGN Display (fill the text screen with E's) ANSI <"33>< -set terminal to respond to ANSI escape codes BIGBOT <"33>#4 -BIG BOTtom of double height and width line BIGTOP <"33>#3 -BIG TOP of double height and width line CLRALL <"33>[2J -CLeaR ALL of the text screen CLRBEG <"33>[1K -CLeaR the BEGinning of this text line CLRBOT <"33>[0J -CLeaR from cursor to BOTtom of the screen CLREND <"33>[0K -CLeaR from cursor to the END of this text line CLRLIN <"33>[2K -CLeaR this entire text LINe CLRTOP <"33>[1J -CLeaR text from TOP of screen to the cursor position CRLF <"15><"12> -generate Carriage Return, Line Feed sequence CUB(m) <"33>[~D -move CUrsor Backward "m" character positions CUD(m) <"33>[~B -move CUrsor Down "m" lines CUF(m) <"33>[~C -move CUrsor Forward "m" character positions CUP(m,n) <"33>[~;~H -CUrsor Position to line "m" column "n" CUU(m) <"33>[~A -move CUrsor Up "m" lines DCS105 <"33>P0t -Device Control String - emulate VT105 graphics DCS125 <"33>P0p -Device Control String - enter REGIS graphics DCSDIF <"33>P0q -Device Control String - Delimit Image Format DWL <"33>#6 -Double Width Line GIMOAP <"33>[?0i -Graphics IMage Output to Auxiliary Port GIMOHC <"33>[?2i -Graphics IMage Output to Host Computer Alphabetical Index of All Terminal Control Commands Page A-3 ---------------------------------------------------------------- Name Generated Code Function Description ---------------------------------------------------------------- GPOFF <"33>2 -Graphics Processor OFF GPON <"33>1 -Graphics Processor ON HPA(m) <"33>[0` -Horizontal Position Absolute HPR(m) <"33>[0a -Horizontal Position Relative HRDCPY <"33>#7 -HaRDCoPY (Dump VT100 text screen to printer) HTBCLA <"33>[3g -Horizontal TaB CLear All HTBCLC <"33>[0g -Horizontal TaB CLear at Current position HTBSTC <"33>H -Horizontal TaB SeT at Current position HTBSTS(m,n...) <"33>[~;~;~;~u -Horizontal TaB SeT at Specified columns IND <"33>D -INDex (move down one line, maintain column) KPAM <"33>= -KeyPad Application mode KPNM <"33>> -KeyPad Numeric mode LLEDS(m,n,o,p) <"33>[~;~;~;~q -Light specified LEDS (0 means extinguish all) LNEFDM <"33>[20l -LiNE FeeD Mode ( generates only ) MDCPY(m) <"33>[~i -Media CoPY mode option "m" NEL <"33>E -NExt Line (move to beginning of the next line) NWLNEM <"33>[20h -NeW LiNE Mode ( generates ) PLD <"33>K -Partial Line Down PLU <"33>L -Partial Line Up RESCUR <"33>8 -REStore CURsor RGSTRM <"33>\ -ReGiS graphics mode terminator RI <"33>M -Reverse Index (up one line, maintain column) RIS <"33>c -Reset to Initial State RM(m) <"33>[?0l -Reset Mode for option "m" Alphabetical Index of All Terminal Control Commands Page A-4 ---------------------------------------------------------------- Name Generated Code Function Description ---------------------------------------------------------------- RPTCP <"33>[6n -RePorT Cursor Position RPTDS <"33>[5n -RePorT Device Status RPTID <"33>[0c -RePorT Terminal IDentification code SAVCUR <"33>7 -SAVe CURsor SCS0 <"17> -Shift to Character Set G0 SCS1 <"16> -Shift to Character Set G1 SCSAL1(m) <"33>*1 -Select Character Set - Alternate Standard set SCSAL2(m) <"33>*2 -Select Character Set - Alternate Special set SCSFIN(m) <"33>*C -Select Character Set - FINNISH SCSFRA(m) <"33>*R -Select Character Set - FRENCH (FRANCE) SCSGER(m) <"33>*K -Select Character Set - GERMAN SCSGRF(m) <"33>*0 -Select Character Set - VT100 line graphics SCSNOR(m) <"33>*E -Select Character Set - NORWEGIAN SCSQUE(m) <"33>*Q -Select Character Set - FRENCH (Quebec) SCSSWE(m) <"33>*H -Select Character Set - SWEDISH SCSUK(m) <"33>*A -Select Character Set - ENGLISH (BRITAIN) SCSUSA(m) <"33>*B -Select Character Set - ENGLISH (AMERICAN) SETLPP(m) <"33>[~t -SET "m" Lines Per Page SETLRM(m,n) <"33>[~;~s -SET Left (column "m") & Right ("n") Margins SETTBM(m,n) <"33>[~;~r -SET Top (line "m") & Bottom "n" Margins (scrolling region) SGR(m,n,o,p) <"33>[~;~;~;~m -Select Graphic Rendition of following chars. SHPTCH(m) <"33>[~w -Set Horizontal PiTCH to option "m" SM(m) <"33>[?~h -Set Mode for option "m" Alphabetical Index of All Terminal Control Commands Page A-5 ---------------------------------------------------------------- Name Generated Code Function Description ---------------------------------------------------------------- SS2 <"33>N -Single Shift 2 - select G2 set for one character SS3 <"33>O -Single Shift 3 - select G3 set for one character SVPTCH(m) <"33>[~z -Set Vertical PiTCH to option "m" SWL <"33>#5 -Single Width Line VPA(m) <"33>[~d -Vertical Position Absolute - active line to "m" VPR(m) <"33>[~e -Vertical Position Relative - advance "m" lines VTBCLA <"33>[4g -Vertical TaB CLear All VTBCLC <"33>[1g -Vertical TaB CLear at Current position VTBSTC <"33>J -Vertical TaB SeT at Current position VTBSTS(m,n...) <"33>[~;~;.;.v -Vertical TaB SeT at Specified lines "m,n..." ---------------------------------------------------------------- Notes: 1. The symbol " ~ " represents the ASCII code for a decimal numerical argument to a terminal command. 2. Omitted or null arguments to commands that require arguments result in a zero character being generated in the output string. Argument values too large for a particular command are replaced with the highest acceptable value. Excess arguments are ignored. ANSI protocol does not limit the number of arguments that may be passed to commands HTBSTS & VTBSTS. However, default space for arguments in the output string is twenty characters, thus a program reassembly may be necessary for special case applications. 3. Arguments to the character set selection commands (eg. SCSUSA(m)) are a special case. The argument value should be either zero or one. If the argument is zero or omitted, the " * " in the generated code will be replaced with a " ( " which designates this character set as the G0 set. An argument value of one generates the " ) " character which designates this character set as the G1 set. 4. Characters enclosed in angle parentheses describe the octal value of the ASCII code generated. APPENDIX B Alphabetical Index of VT125 Terminal Control Commands Alphabetical Index of VT125 Terminal Control Commands Page B-2 ================================================================ Name VT125 Generated Code Function Description ---------------------------------------------------------------- ALIGND <"33>#8 -ALIGN Display (fill the text screen with E's) ANSI <"33>< -set terminal to respond to ANSI escape codes BIGBOT <"33>#4 -BIG BOTtom of double height and width line BIGTOP <"33>#3 -BIG TOP of double height and width line CLRALL <"33>[2J -CLeaR ALL of the text screen CLRBEG <"33>[1K -CLeaR the BEGinning of this text line CLRBOT <"33>[0J -CLeaR from cursor to BOTtom of the screen CLREND <"33>[0K -CLeaR from cursor to the END of this text line CLRLIN <"33>[2K -CLeaR this entire text LINe CLRTOP <"33>[1J -CLeaR text from TOP of screen to the cursor position CRLF <"15><"12> -generate Carriage Return, Line Feed sequence CUB(m) <"33>[~D -move CUrsor Backward "m" character positions CUD(m) <"33>[~B -move CUrsor Down "m" lines CUF(m) <"33>[~C -move CUrsor Forward "m" character positions CUP(m,n) <"33>[~;~H -CUrsor Position to line "m" column "n" CUU(m) <"33>[~A -move CUrsor Up "m" lines DCS105 <"33>P0t -Device Control String - emulate VT105 graphics DCS125 <"33>P0p -Device Control String - enter REGIS graphics DCSDIF <"33>P0q -Device Control String - Delimit Image Format DWL <"33>#6 -Double Width Line GIMOAP <"33>[?0i -Graphics IMage Output to Auxiliary Port GIMOHC <"33>[?2i -Graphics IMage Output to Host Computer Alphabetical Index of VT125 Terminal Control Commands Page B-3 ---------------------------------------------------------------- Name VT125 Generated Code Function Description ---------------------------------------------------------------- GPOFF <"33>2 -Graphics Processor OFF GPON <"33>1 -Graphics Processor ON HPA(m) <"33>[0` -Horizontal Position Absolute HPR(m) <"33>[0a -Horizontal Position Relative HRDCPY <"33>#7 -HaRDCoPY (Dump VT100 text screen to printer) HTBCLA <"33>[3g -Horizontal TaB CLear All HTBCLC <"33>[0g -Horizontal TaB CLear at Current position HTBSTC <"33>H -Horizontal TaB SeT at Current position IND <"33>D -INDex (move down one line, maintain column) KPAM <"33>= -KeyPad Application mode KPNM <"33>> -KeyPad Numeric mode LLEDS(m,n,o,p) <"33>[~;~;~;~q -Light specified LEDS (0 means extinguish all) LNEFDM <"33>[20l -LiNE FeeD Mode ( generates only ) MDCPY(m) <"33>[~i -Media CoPY mode option "m" NEL <"33>E -NExt Line (move to beginning of the next line) NWLNEM <"33>[20h -NeW LiNE Mode ( generates ) RESCUR <"33>8 -REStore CURsor RGSTRM <"33>\ -ReGiS graphics mode terminator RI <"33>M -Reverse Index (up one line, maintain column) RIS <"33>c -Reset to Initial State RM(m) <"33>[?0l -Reset Mode for option "m" RPTCP <"33>[6n -RePorT Cursor Position RPTDS <"33>[5n -RePorT Device Status RPTID <"33>[0c -RePorT Terminal IDentification code Alphabetical Index of VT125 Terminal Control Commands Page B-4 ---------------------------------------------------------------- Name VT125 Generated Code Function Description ---------------------------------------------------------------- SAVCUR <"33>7 -SAVe CURsor SCS0 <"17> -Shift to Character Set G0 SCS1 <"16> -Shift to Character Set G1 SCSAL1(m) <"33>*1 -Select Character Set - Alternate Standard set SCSAL2(m) <"33>*2 -Select Character Set - Alternate Special set SCSUK(m) <"33>*A -Select Character Set - ENGLISH (BRITAIN) SCSUSA(m) <"33>*B -Select Character Set - ENGLISH (AMERICAN) SETTBM(m,n) <"33>[~;~r -SET Top (line "m") & Bottom "n" Margins (scrolling region) SGR(m,n,o,p) <"33>[~;~;~;~m -Select Graphic Rendition of following chars. SM(m) <"33>[?~h -Set Mode for option "m" SS2 <"33>N -Single Shift 2 - select G2 set for one character SS3 <"33>O -Single Shift 3 - select G3 set for one character SWL <"33>#5 -Single Width Line ---------------------------------------------------------------- Notes: 1. The symbol " ~ " represents the ASCII code for a decimal numerical argument to a terminal command. 2. Omitted or null arguments to commands that require arguments result in a zero character being generated in the output string. Argument values too large for a particular command are replaced with the highest acceptable value. Excess arguments are ignored. 3. Arguments to the character set selection commands (eg. SCSUSA(m)) are a special case. The argument value should be either zero or one. If the argument is zero or omitted, the " * " in the generated code will be replaced with a " ( " which designates this character set as the G0 set. An argument value of one generates the " ) " character which designates this character set as the G1 set. 4. Characters enclosed in angle parentheses describe the octal value of the ASCII code generated. APPENDIX C Alphabetical Index of VT100 Terminal Control Commands Alphabetical Index of VT100 Terminal Control Commands Page C-2 ================================================================ Name VT100 Generated Code Function Description ---------------------------------------------------------------- ALIGND <"33>#8 -ALIGN Display (fill the text screen with E's) ANSI <"33>< -set terminal to respond to ANSI escape codes BIGBOT <"33>#4 -BIG BOTtom of double height and width line BIGTOP <"33>#3 -BIG TOP of double height and width line CLRALL <"33>[2J -CLeaR ALL of the text screen CLRBEG <"33>[1K -CLeaR the BEGinning of this text line CLRBOT <"33>[0J -CLeaR from cursor to BOTtom of the screen CLREND <"33>[0K -CLeaR from cursor to the END of this text line CLRLIN <"33>[2K -CLeaR this entire text LINe CLRTOP <"33>[1J -CLeaR text from TOP of screen to the cursor position CRLF <"15><"12> -generate Carriage Return, Line Feed sequence CUB(m) <"33>[~D -move CUrsor Backward "m" character positions CUD(m) <"33>[~B -move CUrsor Down "m" lines CUF(m) <"33>[~C -move CUrsor Forward "m" character positions CUP(m,n) <"33>[~;~H -CUrsor Position to line "m" column "n" CUU(m) <"33>[~A -move CUrsor Up "m" lines DWL <"33>#6 -Double Width Line GPOFF <"33>2 -Graphics Processor OFF GPON <"33>1 -Graphics Processor ON HRDCPY <"33>#7 -HaRDCoPY (Dump VT100 text screen to printer) HTBCLA <"33>[3g -Horizontal TaB CLear All HTBCLC <"33>[0g -Horizontal TaB CLear at Current position HTBSTC <"33>H -Horizontal TaB SeT at Current position IND <"33>D -INDex (move down one line, maintain column) KPAM <"33>= -KeyPad Application mode KPNM <"33>> -KeyPad Numeric mode Alphabetical Index of VT100 Terminal Control Commands Page C-3 ---------------------------------------------------------------- Name VT100 Generated Code Function Description ---------------------------------------------------------------- LLEDS(m,n,o,p) <"33>[~;~;~;~q -Light specified LEDS (0 means extinguish all) LNEFDM <"33>[20l -LiNE FeeD Mode ( generates only ) NEL <"33>E -NExt Line (move to beginning of the next line) NWLNEM <"33>[20h -NeW LiNE Mode ( generates ) RESCUR <"33>8 -REStore CURsor RI <"33>M -Reverse Index (up one line, maintain column) RIS <"33>c -Reset to Initial State RM(m) <"33>[?0l -Reset Mode for option "m" RPTCP <"33>[6n -RePorT Cursor Position RPTID <"33>[0c -RePorT Terminal IDentification code SAVCUR <"33>7 -SAVe CURsor SCS0 <"17> -Shift to Character Set G0 SCS1 <"16> -Shift to Character Set G1 SCSAL1(m) <"33>*1 -Select Character Set - Alternate Standard set SCSAL2(m) <"33>*2 -Select Character Set - Alternate Special set SCSGRF(m) <"33>*0 -Select Character Set - VT100 line graphics SCSUK(m) <"33>*A -Select Character Set - ENGLISH (BRITAIN) SCSUSA(m) <"33>*B -Select Character Set - ENGLISH (AMERICAN) SETTBM(m,n) <"33>[~;~r -SET Top (line "m") & Bottom "n" Margins (scrolling region) SGR(m,n,o,p) <"33>[~;~;~;~m -Select Graphic Rendition of following chars. SM(m) <"33>[?~h -Set Mode for option "m" SWL <"33>#5 -Single Width Line ---------------------------------------------------------------- Alphabetical Index of VT100 Terminal Control Commands Page C-4 Notes: 1. The symbol " ~ " represents the ASCII code for a decimal numerical argument to a terminal command. 2. Omitted or null arguments to commands that require arguments result in a zero character being generated in the output string. Argument values too large for a particular command are replaced with the highest acceptable value. Excess arguments are ignored. 3. Arguments to the character set selection commands (eg. SCSUSA(m)) are a special case. The argument value should be either zero or one. If the argument is zero or omitted, the " * " in the generated code will be replaced with a " ( " which designates this character set as the G0 set. An argument value of one generates the " ) " character which designates this character set as the G1 set. 4. Characters enclosed in angle parentheses describe the octal value of the ASCII code generated. APPENDIX D Alphabetical Index of LA34 Terminal Control Commands Alphabetical Index of LA34 Terminal Control Commands Page D-2 ================================================================ Name LA34 Generated Code Function Description ---------------------------------------------------------------- CRLF <"15><"12> -generate Carriage Return, Line Feed sequence CUU(m) <"33>[~A -move CUrsor Up "m" lines DCSDIF <"33>P0q -Device Control String - Delimit Image Format HPA(m) <"33>[0` -Horizontal Position Absolute HPR(m) <"33>[0a -Horizontal Position Relative HTBCLA <"33>[3g -Horizontal TaB CLear All HTBCLC <"33>[0g -Horizontal TaB CLear at Current position HTBSTC <"33>H -Horizontal TaB SeT at Current position HTBSTS(m,n...) <"33>[~;~;~;~u -Horizontal TaB SeT at Specified columns IND <"33>D -INDex (move down one line, maintain column) KPAM <"33>= -KeyPad Application mode KPNM <"33>> -KeyPad Numeric mode LNEFDM <"33>[20l -LiNE FeeD Mode ( generates only ) NEL <"33>E -NExt Line (move to beginning of the next line) NWLNEM <"33>[20h -NeW LiNE Mode ( generates ) PLD <"33>K -Partial Line Down PLU <"33>L -Partial Line Up RGSTRM <"33>\ -ReGiS graphics mode terminator RI <"33>M -Reverse Index (up one line, maintain column) RPTID <"33>[0c -RePorT Terminal IDentification code Alphabetical Index of LA34 Terminal Control Commands Page D-3 ---------------------------------------------------------------- Name LA34 Generated Code Function Description ---------------------------------------------------------------- SCS0 <"17> -Shift to Character Set G0 SCS1 <"16> -Shift to Character Set G1 SCSFIN(m) <"33>*C -Select Character Set - FINNISH SCSFRA(m) <"33>*R -Select Character Set - FRENCH (FRANCE) SCSGER(m) <"33>*K -Select Character Set - GERMAN SCSGRF(m) <"33>*0 -Select Character Set - VT100 line graphics SCSNOR(m) <"33>*E -Select Character Set - NORWEGIAN SCSQUE(m) <"33>*Q -Select Character Set - FRENCH (Quebec) SCSSWE(m) <"33>*H -Select Character Set - SWEDISH SCSUK(m) <"33>*A -Select Character Set - ENGLISH (BRITAIN) SCSUSA(m) <"33>*B -Select Character Set - ENGLISH (AMERICAN) SETLPP(m) <"33>[~t -SET "m" Lines Per Page SETLRM(m,n) <"33>[~;~s -SET Left (column "m") & Right ("n") Margins SETTBM(m,n) <"33>[~;~r -SET Top (line "m") & Bottom "n" Margins (scrolling region) SHPTCH(m) <"33>[~w -Set Horizontal PiTCH to option "m" SVPTCH(m) <"33>[~z -Set Vertical PiTCH to option "m" VPA(m) <"33>[~d -Vertical Position Absolute - active line to "m" VPR(m) <"33>[~e -Vertical Position Relative - advance "m" lines VTBCLA <"33>[4g -Vertical TaB CLear All VTBCLC <"33>[1g -Vertical TaB CLear at Current position VTBSTC <"33>J -Vertical TaB SeT at Current position VTBSTS(m,n...) <"33>[~;~;.;.v -Vertical TaB SeT at Specified lines "m,n..." ---------------------------------------------------------------- Alphabetical Index of LA34 Terminal Control Commands Page D-4 Notes: 1. The symbol " ~ " represents the ASCII code for a decimal numerical argument to a terminal command. 2. Omitted or null arguments to commands that require arguments result in a zero character being generated in the output string. Argument values too large for a particular command are replaced with the highest acceptable value. Excess arguments are ignored. ANSI protocol does not limit the number of arguments that may be passed to commands HTBSTS & VTBSTS. However, default space for arguments in the output string is twenty characters, thus a program reassembly may be necessary for special case applications. 3. Arguments to the character set selection commands (eg. SCSUSA(m)) are a special case. The argument value should be either zero or one. If the argument is zero or omitted, the " * " in the generated code will be replaced with a " ( " which designates this character set as the G0 set. An argument value of one generates the " ) " character which designates this character set as the G1 set. 4. Characters enclosed in angle parentheses describe the octal value of the ASCII code generated. APPENDIX E Alphabetical Index of LA120 Terminal Control Commands Alphabetical Index of LA120 Terminal Control Commands Page E-2 ================================================================ Name LA120 Generated Code Function Description ---------------------------------------------------------------- CRLF <"15><"12> -generate Carriage Return, Line Feed sequence HPA(m) <"33>[0` -Horizontal Position Absolute HPR(m) <"33>[0a -Horizontal Position Relative HTBCLA <"33>[3g -Horizontal TaB CLear All HTBCLC <"33>[0g -Horizontal TaB CLear at Current position HTBSTC <"33>H -Horizontal TaB SeT at Current position HTBSTS(m,n...) <"33>[~;~;~;~u -Horizontal TaB SeT at Specified columns IND <"33>D -INDex (move down one line, maintain column) KPAM <"33>= -KeyPad Application mode KPNM <"33>> -KeyPad Numeric mode LNEFDM <"33>[20l -LiNE FeeD Mode ( generates only ) NEL <"33>E -NExt Line (move to beginning of the next line) NWLNEM <"33>[20h -NeW LiNE Mode ( generates ) RPTID <"33>[0c -RePorT Terminal IDentification code SCS0 <"17> -Shift to Character Set G0 SCS1 <"16> -Shift to Character Set G1 SCSFIN(m) <"33>*C -Select Character Set - FINNISH SCSFRA(m) <"33>*R -Select Character Set - FRENCH (FRANCE) SCSGER(m) <"33>*K -Select Character Set - GERMAN SCSGRF(m) <"33>*0 -Select Character Set - VT100 line graphics SCSNOR(m) <"33>*E -Select Character Set - NORWEGIAN SCSSWE(m) <"33>*H -Select Character Set - SWEDISH SCSUK(m) <"33>*A -Select Character Set - ENGLISH (BRITAIN) SCSUSA(m) <"33>*B -Select Character Set - ENGLISH (AMERICAN) SETLPP(m) <"33>[~t -SET "m" Lines Per Page SETLRM(m,n) <"33>[~;~s -SET Left (column "m") & Right ("n") Margins Alphabetical Index of LA120 Terminal Control Commands Page E-3 ---------------------------------------------------------------- Name LA120 Generated Code Function Description ---------------------------------------------------------------- SETTBM(m,n) <"33>[~;~r -SET Top (line "m") & Bottom "n" Margins (scrolling region) SHPTCH(m) <"33>[~w -Set Horizontal PiTCH to option "m" SVPTCH(m) <"33>[~z -Set Vertical PiTCH to option "m" VPA(m) <"33>[~d -Vertical Position Absolute - active line to "m" VPR(m) <"33>[~e -Vertical Position Relative - advance "m" lines VTBCLA <"33>[4g -Vertical TaB CLear All VTBCLC <"33>[1g -Vertical TaB CLear at Current position VTBSTC <"33>J -Vertical TaB SeT at Current position VTBSTS(m,n...) <"33>[~;~;.;.v -Vertical TaB SeT at Specified lines "m,n..." ---------------------------------------------------------------- Notes: 1. The symbol " ~ " represents the ASCII code for a decimal numerical argument to a terminal command. 2. Omitted or null arguments to commands that require arguments result in a zero character being generated in the output string. Argument values too large for a particular command are replaced with the highest acceptable value. Excess arguments are ignored. ANSI protocol does not limit the number of arguments that may be passed to commands HTBSTS & VTBSTS. However, default space for arguments in the output string is twenty characters, thus a program reassembly may be necessary for special case applications. 3. Arguments to the character set selection commands (eg. SCSUSA(m)) are a special case. The argument value should be either zero or one. If the argument is zero or omitted, the " * " in the generated code will be replaced with a " ( " which designates this character set as the G0 set. An argument value of one generates the " ) " character which designates this character set as the G1 set. 4. Characters enclosed in angle parentheses describe the octal value of the ASCII code generated. APPENDIX F Terminal input and Utility Subroutines Terminal input and Utility Subroutines Page F-2 1. +++++++++++++++++++++++++ Look for Escape Sequences Called by FORTRAN: I = LESCSQ(STRING) where STRING - Character string which returns received input I - -1 = Time out (no response received) 0 = Invalid Escape sequence detected >0 = Number of characters in Escape sequence NOTE: When an invalid character sequence is detected, all characters preceeding and the offending character are returned in ASCIZ format in vector STRING. If only an character is received before timeout occurs, the character will be returned as an ASCIZ string in STRING and an invalid sequence detected code will be returned. If no input at all is received, STRING will contain a null string. The timeout period has been defined (in TCFLIO.MAC) as 0.2 seconds for those systems supporting .TWAIT (FB or XM monitors) or .MRKT under the SJ monitor. For systems with no LTC, timeout is a simulated 1 second (on a LSI-11/2), but is easily modified before program assembly. 2. +++++++++++++++++++++++++ Determine terminal's identity Called from FORTRAN by: I = KTRMID(NPARM,IPARM,LPRVTE) where: NPARM - Maximum number of parameters to return IPARM - Integer vector to contain parameter values LPRVTE - -1 if private sequence found, else zero I - Returned funtion value = -1 - Timeout (No response from terminal) = 0 - Unrecognized response received = >0 - The number of parameters available 3. +++++++++++++++++++++++++ Get the video terminal's present cursor position Called from FORTRAN by: I = KCURP(IROW,ICOL) where: IROW - Cursor position row number ICOLM - & column number I - Returned value = -1 - Timeout (No response from terminal) = 0 - Unrecognized response received = 1 - Proper format response recived Terminal input and Utility Subroutines Page F-3 4. +++++++++++++++++++++++++ KITCC - Decodes Keypad and Cursor positioning key input Note: Terminal must have Keypad Application Mode set for keypad keys (except PF1->PF4) to be detected. ANSI Cursor Key Mode must be set for cursor positioning keys to be detected. Called from FORTRAN by: I = KITCC(INCHAR,ICODE) where: INCHAR - Provided by user, the termination character of the just received Escape sequence ICODE - Integer returned, the numeric value of the received terminal command key -if numeric or punctuation, ICODE will contain the actual character code: ',' = "54 44 decimal '-' = "55 45 '.' = "56 46 '0' = "60 48 '1' = "61 49 '2' = "62 50 '3' = "63 51 '4' = "64 52 '5' = "65 53 '6' = "66 54 '7' = "67 55 '8' = "70 56 '9' = "71 57 -if Cursor control, Programmable function or the key Up = "1 1 decimal Down = "2 2 Right = "3 3 Left = "4 4 = "15 13 PF1 = "20 16 PF2 = "21 17 PF3 = "22 18 PF4 = "23 19 - or if an error or unrecognized character is detected the ASCII character actually received I - Returned function value = -1 - Timeout or unrecognized input = 0 - Numeric or puntuation command = 1 - Cursor control, Programmable function or the key pressed .END LITERAL .PAGE .LITERAL 5. +++++++++++++++++++++++++ Define the multi-terminal port to be used for I/O Called from FORTRAN by: Terminal input and Utility Subroutines Page F-4 CALL LUNTRM(NPORT) where: NPORT - The number of the multi-terminal port to be used. Note: The calling program must request use of the terminal port from the monitor [CALL MTATCH(?)] before calling LUNTRM. 6. +++++++++++++++++++++++++ Define address of user's buffer for TCFLO's returned strings Called from FORTRAN by: CALL DFNBUF(BUFFER) where: BUFFER - is a FORTRAN vector of appropriate length to handle the maximum string length to be returned. 81 bytes is a nice round number. 7. +++++++++++++++++++++++++ Device "somewhat" independent ASCIZ string output subroutine Called from FORTRAN by: CALL OUTTZ(STRING) !Append or CALL OUTTZN(STRING) !Do not append where STRING - is an ASCIZ character string (ends with a null). 8. +++++++++++++++++++++++++ Empty the terminal's input buffer Called by FORTRAN: CALL FLUSHB 9. +++++++++++++++++++++++++ Device "somewhat" independent routine to define terminal's operating characteristics. Called from FORTRAN by: CALL TTMDE(IARG) where: IARG - Defines Terminal features wanted = 0 - Uppercase only, line mode, wait = 1 - Enable lowercase, line mode, wait = 2 - Uppercase only, Single Character, wait = 3 - Enable lowercase, Single Character, wait = 4 - Uppercase only, line mode, no wait ??? = 5 - Enable lowercase, line mode, no wait ??? = 6 - Uppercase only, Single Character, no wait = 7 - Enable lowercase, Single Character, no wait Note: IARG values of 3 or 4 are impractical - but may be set.