home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / amiga / introduc / 1217 < prev    next >
Encoding:
Internet Message Format  |  1992-09-08  |  15.9 KB

  1. Xref: sparky comp.sys.amiga.introduction:1217 comp.sys.amiga.misc:13508 comp.sys.amiga.programmer:13117
  2. Path: sparky!uunet!olivea!decwrl!nntp1.radiomail.net!portal!cup.portal.com!thad
  3. From: thad@cup.portal.com (Thad P Floryan)
  4. Newsgroups: comp.sys.amiga.introduction,comp.sys.amiga.misc,comp.sys.amiga.programmer
  5. Subject: Re: 1.3 to 2.04 ansi escape codes?
  6. Message-ID: <65334@cup.portal.com>
  7. Date: 6 Sep 92 00:21:34 GMT
  8. References: <1992Sep2.153057.8602@rtsg.mot.com>
  9. Organization: The Portal System (TM)
  10. Lines: 328
  11.  
  12. In article <1992Sep2.153057.8602@rtsg.mot.com>
  13. earl@rtsg.mot.com (Brent R. Earl) writes:
  14.  
  15. |  [...]
  16. |  I have a program that uses ansi escape codes for cursor positioning,
  17. |  Where can one find the ansi x3.64 spec that is mentioned in
  18. |  [...]
  19.  
  20. The ANSI spec is large; I have a copy at my office.  For your purpose, the
  21. enclosed summary that was posted to the net a while back should prove to
  22. be useful.
  23.  
  24. If you want the ANSI spec, ordering info is at the end of the enclosure.
  25.  
  26. Thad Floryan [ thad@btr.com, thad@cup.portal.com ]
  27.  
  28. -------------------- begin enclosure
  29.  
  30.  ANSI Standard (X3.64) Control Sequences for Video Terminals and Peripherals
  31.                        in alphabetic order by mnemonic
  32.  
  33.      (Inspired by the article "Toward Standardized Video Terminals: ANSI
  34.       X3.64 Device Control" by Mark L. Siegel, April 1984 BYTE, page 365)
  35.  
  36.                (Ps and Pn are parameters expressed in ASCII.)
  37.                (Numeric parameters are given in decimal radix.)
  38.                (Abbreviations are explained in detail at end.)
  39.                (Spaces used in this table for clarity are not
  40.                 used in the actual codes.)
  41.  
  42.                                                            Default    Type
  43. Sequence     Sequence                                      Parameter   or
  44. Mnemonic     Name              Sequence                    Value      Mode
  45. ---------------------------------------------------------------------------
  46. APC  Applicatn Program Command Esc Fe                                 Delim
  47. CBT  Cursor Backward Tab       Esc [ Pn Z                   1         eF
  48. CCH  Cancel Previous Character Esc T
  49. CHA  Cursor Horzntal Absolute  Esc [ Pn G                   1         eF
  50. CHT  Cursor Horizontal Tab     Esc [ Pn I                   1         eF
  51. CNL  Cursor Next Line          Esc [ Pn E                   1         eF
  52. CPL  Cursor Preceding Line     Esc [ Pn F                   1         eF
  53. CPR  Cursor Position Report    Esc [ Pn ; Pn R              1, 1
  54. CSI  Control Sequence Intro    Esc [                                  Intro
  55. CTC  Cursor Tab Control        Esc [ Ps W                   0         eF
  56. CUB  Cursor Backward           Esc [ Pn D                   1         eF
  57. CUD  Cursor Down               Esc [ Pn B                   1         eF
  58. CUF  Cursor Forward            Esc [ Pn C                   1         eF
  59. CUP  Cursor Position           Esc [ Pn ; Pn H              1, 1      eF
  60. CUU  Cursor Up                 Esc [ Pn A                   1         eF
  61. CVT  Cursor Vertical Tab       Esc [ Pn Y                             eF
  62. DA   Device Attributes         Esc [ Pn c                   0
  63. DAQ  Define Area Qualification Esc [ Ps o                   0
  64. DCH  Delete Character          Esc [ Pn P                   1         eF
  65. DCS  Device Control String     Esc P                                  Delim
  66. DL   Delete Line               Esc [ Pn M                   1         eF
  67. DMI  Disable Manual Input      Esc \                                  Fs
  68. DSR  Device Status Report      Esc [ Ps n                   0
  69. EA   Erase in Area             Esc [ Ps O                   0         eF
  70. ECH  Erase Character           Esc [ Pn X                   1         eF
  71. ED   Erase in Display          Esc [ Ps J                   0         eF
  72. EF   Erase in Field            Esc [ Ps N                   0         eF
  73. EL   Erase in Line             Esc [ Ps K                   0         eF
  74. EMI  Enable Manual Input       Esc b                                  Fs
  75. EPA  End of Protected Area     Esc W
  76. ESA  End of Selected Area      Esc G
  77. FNT  Font Selection            Esc [ Pn ; Pn Space D        0, 0      FE
  78. GSM  Graphic Size Modify       Esc [ Pn ; Pn Space B        100, 100  FE
  79. GSS  Graphic Size Selection    Esc [ Pn Space C             none      FE
  80. HPA  Horz Position Absolute    Esc [ Pn `                   1         FE
  81. HPR  Horz Position Relative    Esc [ Pn a                   1         FE
  82. HTJ  Horz Tab w/Justification  Esc I                                  FE
  83. HTS  Horizontal Tab Set        Esc H                                  FE
  84. HVP  Horz & Vertical Position  Esc [ Pn ; Pn f              1, 1      FE
  85. ICH  Insert Character          Esc [ Pn @                   1         eF
  86. IL   Insert Line               Esc [ Pn L                   1         eF
  87. IND  Index                     Esc D                                  FE
  88. INT  Interrupt                 Esc a                                  Fs
  89. JFY  Justify                   Esc [ Ps ; ... ; Ps Space F  0         FE
  90. MC   Media Copy                Esc [ Ps i                   0
  91. MW   Message Waiting           Esc U
  92. NEL  Next Line                 Esc E                                  FE
  93. NP   Next Page                 Esc [ Pn U                   1         eF
  94. OSC  Operating System Command  Esc ]                                  Delim
  95. PLD  Partial Line Down         Esc K                                  FE
  96. PLU  Partial Line Up           Esc L                                  FE
  97. PM   Privacy Message           Esc ^                                  Delim
  98. PP   Preceding Page            Esc [ Pn V                   1         eF
  99. PU1  Private Use 1             Esc Q
  100. PU2  Private Use 2             Esc R
  101. QUAD Typographic Quadding      Esc [ Ps Space H             0         FE
  102. REP  Repeat Char or Control    Esc [ Pn b                   1
  103. RI   Reverse Index             Esc M                                  FE
  104. RIS  Reset to Initial State    Esc c                                  Fs
  105. RM   Reset Mode                Esc [ Ps l                   none
  106. SD   Scroll Down               Esc [ Pn T                   1         eF
  107. SEM  Select Edit Extent Mode   Esc [ Ps Q                   0
  108. SGR  Select Graphic Rendition  Esc [ Ps m                   0         FE
  109. SL   Scroll Left               Esc [ Pn Space @             1         eF
  110. SM   Select Mode               Esc [ Ps h                   none
  111. SPA  Start of Protected Area   Esc V
  112. SPI  Spacing Increment         Esc [ Pn ; Pn Space G        none      FE
  113. SR   Scroll Right              Esc [ Pn Space A             1         eF
  114. SS2  Single Shift 2 (G2 set)   Esc N                                  Intro
  115. SS3  Single Shift 3 (G3 set)   Esc O                                  Intro
  116. SSA  Start of Selected Area    Esc F
  117. ST   String Terminator         Esc \                                  Delim
  118. STS  Set Transmit State        Esc S
  119. SU   Scroll Up                 Esc [ Pn S                   1         eF
  120. TBC  Tab Clear                 Esc [ Ps g                   0         FE
  121. TSS  Thin Space Specification  Esc [ Pn Space E             none      FE
  122. VPA  Vert Position Absolute    Esc [ Pn d                   1         FE
  123. VPR  Vert Position Relative    Esc [ Pn e                   1         FE
  124. VTS  Vertical Tabulation Set   Esc J                                  FE
  125.  
  126. ---------------------------------------------------------------------------
  127.  
  128. Abbreviations:
  129.  
  130. Intro  an Introducer of some kind of defined sequence; the normal 7-bit
  131.        X3.64 Control Sequence Introducer is the two characters "Escape ["
  132.  
  133. Delim  a Delimiter
  134.  
  135. x/y    identifies a character by position in the ASCII table (column/row)
  136.  
  137. eF     editor function (see explanation)
  138.  
  139. FE     format effector (see explanation)
  140.  
  141. F      is a Final character in
  142.             an Escape sequence (F from 3/0 to 7/14 in the ASCII table)
  143.             a control sequence (F from 4/0 to 7/14)
  144.  
  145. Gs     is a graphic character appearing in strings (Gs ranges from
  146.        2/0 to 7/14) in the ASCII table
  147.  
  148. Ce     is a control represented as a single bit combination in the C1 set
  149.        of controls in an 8-bit character set
  150.  
  151. C0     the familiar set of 7-bit ASCII control characters
  152.  
  153. C1     roughly, the set of control characters available only in 8-bit systems.
  154.        This is too complicated to explain fully here, so read Jim Fleming's
  155.        article in the February 1983 BYTE, especially pages 214 through 224.
  156.  
  157. Fe     is a Final character of a 2-character Escape sequence that has an
  158.        equivalent representation in an 8-bit environment as a Ce-type
  159.        (Fe ranges from 4/0 to 5/15)
  160.  
  161. Fs     is a Final character of a 2-character Escape sequence that is
  162.        standardized internationally with identical representation in 7-bit
  163.        and 8-bit environments and is independent of the currently
  164.        designated C0 and C1 control sets (Fs ranges from 6/0 to 7/14)
  165.  
  166. I      is an Intermediate character from 2/0 to 2/15 (inclusive) in the
  167.        ASCII table
  168.  
  169. P      is a parameter character from 3/0 to 3/15 (inclusive) in the ASCII
  170.        table
  171.  
  172. Pn     is a numeric parameter in a control sequence, a string of zero or
  173.        more characters ranging from 3/0 to 3/9 in the ASCII table
  174.  
  175. Ps     is a variable number of selective parameters in a control sequence
  176.        with each selective parameter separated from the other by the code
  177.        3/11 (which usually represents a semicolon); Ps ranges from
  178.        3/0 to 3/9 and includes 3/11
  179.  
  180. \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  181. /
  182.  
  183. Format Effectors versus Editor Functions
  184.  
  185. A format effector specifies how the final output is to be created.
  186. An editor function allows you to modify the specification.
  187.  
  188. For instance, a format effector that moves the "active position" (the 
  189. cursor or equvalent) one space to the left would be useful when you want to
  190. create an overstrike, a compound character made of two standard characters
  191. overlaid. Control-H, the Backspace character, is actually supposed to be a
  192. format effector, so you can do this. But many systems use it in a
  193. nonstandard fashion, as an editor function, deleting the character to the
  194. left of the cursor and moving the cursor left. When Control-H is assumed to
  195. be an editor function, you cannot predict whether its use will create an
  196. overstrike unless you also know whether the output device is in an "insert
  197. mode" or an "overwrite mode". When Control-H is used as a format effector,
  198. its effect can always be predicted. The familiar characters carriage
  199. return, linefeed, formfeed, etc., are defined as format effectors.
  200.  
  201. \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  202. /
  203.  
  204. ANSI X3.64 Mode-Changing Parameters for use with the
  205.            Select Mode (SM) and Reset Mode (RM) functions
  206.  
  207.     Parameter           Mode          Mode Function
  208.     Characters          Mnemonic
  209.  column/    graphic
  210.   row       repres.
  211. ----------------------------------------------------------------------------
  212. 3/0           0                       an error condition
  213. 3/1           1          GATM         guarded-area transfer mode
  214. 3/2           2          KAM          keyboard action mode
  215. 3/3           3          CRM          control representation mode
  216. 3/4           4          IRM          insertion/replacement mode
  217. 3/5           5          SRTM         status-reporting transfer mode
  218. 3/6           6          ERM          erasure mode
  219. 3/7           7          VEM          vertical editing mode
  220. 3/8           8                       reserved for future standardization
  221. 3/9           9                       reserved for future standardization
  222. 3/10          :                       reserved separator for parameters
  223. 3/11          ;                       Standard separator for parameters
  224. 3/12          <                       reserved for private (experimental) use
  225. 3/13          =                       reserved for private (experimental) use
  226. 3/14          >                       reserved for private (experimental) use
  227. 3/15          ?                       reserved for private (experimental) use
  228. 3/1  3/0      10         HEM          horizontal editing mode
  229. 3/1  3/1      11         PUM          positioning unit mode
  230. 3/1  3/2      12         SRM          send/receive mode
  231. 3/1  3/3      13         FEAM         format effector action mode
  232. 3/1  3/4      14         FETM         format effector transfer mode
  233. 3/1  3/5      15         MATM         multiple area transfer mode
  234. 3/1  3/6      16         TTM          transfer termination mode
  235. 3/1  3/7      17         SATM         selected area transfer mode
  236. 3/1  3/8      18         TSM          tabulation stop mode
  237. 3/1  3/9      19         EBM          editing boundary mode
  238. 3/1  3/10     1:                      reserved separator for parameters
  239. 3/1  3/11     1;                      Standard separator for parameters
  240. 3/1  3/12     1<                      error condition--unspecified recovery
  241. 3/1  3/13     1=                      error condition--unspecified recovery
  242. 3/1  3/14     1>                      error condition--unspecified recovery
  243. 3/1  3/15     1?                      error condition--unspecified recovery
  244. 3/2  3/0      20         LNM          linefeed/newline mode (not in ISO 6429)
  245. 3/2  3/1      21
  246.  .            .
  247.  .            .                       reserved for future standardization
  248.  .            .
  249. 3/9  3/9      99
  250.  
  251. 3/12 3/0      <0
  252.  .            .
  253.  .            .                       reserved for private (experimental) use
  254.  .            .
  255. 3/15 3/15     ??
  256.  
  257. \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  258. /
  259.  
  260. NOTES ON THE DEC VT100 IMPLEMENTATION
  261.  
  262. In the case of the popular DEC VT100 video-terminal implementation,
  263. the only mode that may be altered is the linefeed/newline (LNM) mode.
  264. Other modes are considered permanently set, reset, or not applicable
  265. as follows:
  266.  
  267.      Set:   ERM
  268.      Reset: CRM, EBM, FEAM, FETM, IRM, KAM, PUM, SRTM, TSM
  269.      N/A:   GATM, HEM, MATM, SATM, TTM, VEM
  270.  
  271. Control sequences implemented in the VT100 are as follows:
  272.  
  273.      CPR, CUB, CUD, CUF, CUP, CUU, DA, DSR, ED, EL, HTS, HVP, IND,
  274.      LNM, NEL, RI, RIS, RM, SGR, SM, TBC
  275.  
  276. plus several private DEC commands.
  277.  
  278. Erasing parts of the display (EL and ED) in the VT100 is performed thus:
  279.  
  280.      Erase from cursor to end of line           Esc [ 0 K    or Esc [ K
  281.      Erase from beginning of line to cursor     Esc [ 1 K
  282.      Erase line containing cursor               Esc [ 2 K
  283.      Erase from cursor to end of screen         Esc [ 0 J    or Esc [ J
  284.      Erase from beginning of screen to cursor   Esc [ 1 J
  285.      Erase entire screen                        Esc [ 2 J
  286.  
  287. The VT100 responds to receiving the DA (Device Attributes) control
  288.  
  289.      Esc [ c    (or Esc [ 0 c)
  290.  
  291. by transmitting the sequence
  292.  
  293.      Esc [ ? l ; Ps c
  294.  
  295. where Ps is a character that describes installed options.
  296.  
  297. The VT100's cursor location can be read with the DSR (Device Status
  298. Report) control
  299.  
  300.      Esc [ 6 n
  301.  
  302. The VT100 reports by transmitting the CPR sequence
  303.  
  304.      Esc [ Pl ; Pc R
  305.  
  306. where Pl is the line number and Pc is the column number (in decimal).
  307.  
  308. \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  309. /
  310.  
  311. The complete document describing the standard,  "ANSI X3.64-1979:
  312. Additional Controls for Use with the American National Standard
  313. Code for Information Interchange," can be ordered for $13.50 (plus
  314. $4 postage) from
  315.  
  316.      Standards Sales Department
  317.      American National Standards Institute
  318.      1430 Broadway
  319.      New York, NY 10018
  320.      212/354-3300
  321.  
  322. It's best to read the full standard before using it. It also helps
  323. to have copies of the related standards "X3.4-1977: American
  324. National Standard Code for Information Interchange" (the ASCII
  325. standard) and "X3.41.1974: Code-Extension Techniques for Use with
  326. the 7-Bit Coded Character Set of American National Standard for
  327. Information Interchange."
  328.  
  329. See also the chapter "Using Extended Screens and Keyboard Control"
  330. in the IBM PC-DOS manuals, especially for the coding for character
  331. attributes.
  332.  
  333. The specification for the DEC VT100 is document EK-VT100-UG-003.
  334.  
  335. (Copyright 1984 BYTE Publications, subsidiary of McGraw-Hill Inc.)
  336. (Permission granted to reproduce for noncommercial uses.)
  337. (This file prepared by Richard S. Shuford.)
  338.  
  339. -------------------- end enclosure
  340.