📄 chapter3.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><HTML><HEAD><TITLE>VT100.net: Digital VT100 User Guide</TITLE><LINK HREF="vt100-ug.css" TYPE="text/css" REL="stylesheet"><LINK HREF="/favicon.ico" TYPE="image/x-icon" REL="shortcut icon"></HEAD><BODY><DIV CLASS="navbar"><A HREF="http://vt100.net/"><IMG CLASS="button" SRC="vt100.net-logo.png" ALT="VT100.net" HEIGHT="16" WIDTH="102"></A> VT100 User Guide<TABLE WIDTH="100%"><COL SPAN="3" WIDTH="33%"><TBODY><TR><TD ALIGN="LEFT"><A HREF="chapter2.html">Chapter 2</A></TD><TD ALIGN="CENTER"><A HREF="contents.html">Contents</A></TD><TD ALIGN="RIGHT"><A HREF="chapter4.html">Chapter 4</A></TD></TR></TBODY></TABLE><HR></DIV><H1 ID="S3">Chapter 3<BR>Programmer Information</H1><P>The VT100 terminal normally performs a two-part function. It is an input device toa computer -- information entered through the keyboard is sent to the computer. Itis simultaneously an output device for the computer -- that is, data coming in fromthe computer is displayed on the video screen. <A HREF="figure3-1.html">Figure 3-1</A> shows the data flow.</P><P>This section of the user's manual discusses data flow between the VT100 and thehost. Included are codes generated by the keyboard; the transmission protocolfollowed by the terminal; and the actions and reactions of the terminal to controlfunctions in both ANSI and VT52 modes of operation.</P><H2 ID="S3.1">The Keyboard</H2><P>The VT100 uses a keyboard with a key arrangement similar to an ordinary officetypewriter, as shown in <A HREF="figure3-2.html">Figure 3-2</A>. In addition to the standard typewriter keys theVT100 keyboard has additional keys and indicators used to generate control sequences,cursor control commands, and to show the current terminal status.</P><P><STRONG>LED Indicators</STRONG><BR>The keyboard has seven light emitting diodes (LEDs) of which two are committedto the complementary ON-LINE/LOCAL function. The power on condition is implicitlyshown by one of the two LEDs being on; that is, if the keyboard is connectedand power is on, one of these LEDs will be on.</P><P>A third LED indicates a "keyboard locked" condition. In this condition the keyboardhas been "turned off" automatically by the terminal due to a full buffer or by thehost through the transmission of an XOFF to the terminal.</P><P>The four remaining LEDs are programmable and can be assigned any meaning forspecific applications. The code sequences to turn these LEDs on or off are discussedlater in this chapter.</P><P><IMG SRC="keys/bk/setup.png" ALT="" HEIGHT="40" WIDTH="60"> <STRONG>SET-UP</STRONG><BR>The <SPAN CLASS="keyname">SET-UP</SPAN> key is at the upper-left corner of the main key array. Operationsperformed in SET-UP mode can be stored in nonvolatile memory (NVR) so thatturning the terminal power off does not, by itself, alter the terminal configuration.</P><P>The procedures to change the SET-UP features are provided in the operator'sinformation section of this manual. Those SET-UP features which may be modifiedby the host are listed in <A HREF="table3-1.html">Table 3-1</A> and described in detail under the escape sequences.</P><P><STRONG>Keyboard Operation</STRONG><BR>The operator uses the keyboard to transmit codes to the host. Some keys transmitone or more codes to the host immediately when typed. Other keys such as <SPAN CLASS="keyname">CTRL</SPAN>and <SPAN CLASS="keyname">SHIFT</SPAN> do not transmit codes when typed, but modify the codes transmittedby other keys. The code-transmitting keys cause the terminal to make a clickingsound to verify to the operator that the keystroke has been processed by theterminal. If two code-transmitting keys are pressed together, two codes will betransmitted according to the order in which the keys were typed. The terminal willnot wait for the keys to be lifted, but will transmit both codes as soon as possibleafter the keys are first typed. If three such keys are pressed simultaneously, thecodes for the first two keys are transmitted immediately; the code for the third willbe transmitted when one of the first two keys is lifted.</P><P><STRONG>Alphabetic Keys</STRONG> -- The VT100 will transmit the lowercase code unless either orboth of the <SPAN CLASS="keyname">SHIFT</SPAN> keys are down, or unless the <SPAN CLASS="keyname">CAPS LOCK</SPAN> key is down. Pressingthe <SPAN CLASS="keyname">CAPS LOCK</SPAN> key will lock only the 26 alphabetic keys in the shifted(uppercase) mode. <A HREF="table3-2.html">Table 3-2</A> shows the codes generated by the alphabetic keys.</P><P><STRONG>Nonalphabetic Keys</STRONG> -- Each of the nonalphabetic keys can be used to generatetwo different codes. One code will be generated if neither <SPAN CLASS="keyname">SHIFT</SPAN> key is pressed.The other code will be generated if either or both of the <SPAN CLASS="keyname">SHIFT</SPAN> keys are down.Unlike the <SPAN CLASS="keyname">SHIFT LOCK</SPAN> key of a typewriter, the <SPAN CLASS="keyname">CAPS LOCK</SPAN> key does not affectthese keys; it affects only the alphabetic keys. <A HREF="table3-3.html">Table 3-3</A> shows the nonalphabetickeys and the codes they generate.</P><P><STRONG>Function Keys</STRONG> -- There are several keys on the keyboard which transmit controlcodes. Control codes do not produce displayable characters but are codes forfunctions. If these codes are received by the terminal, the VT100 will perform theassociated function as shown in <A HREF="table3-4.html">Table 3-4</A>.</P><P><STRONG>NO SCROLL</STRONG> -- When the <SPAN CLASS="keyname">NO SCROLL</SPAN> key is pressed it generates a single XOFFcode, inhibits further scrolling and freezes the screen. When pressed again thesame key generates XON. In practice, if the software recognizes XOFF, the hostwill stop transmitting until the <SPAN CLASS="keyname">NO SCROLL</SPAN> key is pressed again to allow scrolling.If the XOFF/XON feature is disabled (SET-UP function) the <SPAN CLASS="keyname">NO SCROLL</SPAN> keycauses no action.</P><P><STRONG>BREAK</STRONG> -- Typing the <SPAN CLASS="keyname">BREAK</SPAN> key causes the transmission line to be forced to itszero state for 0.2333 seconds ± 10 percent. If either <SPAN CLASS="keyname">SHIFT</SPAN> key is down, the timeis increased to 3.5 seconds ± 10 percent. Data Terminal Ready is also deassertedduring this interval. At the conclusion of the 3.5 second interval Data TerminalReady will again be asserted.</P><P>The <SPAN CLASS="keyname">SHIFT</SPAN> and <SPAN CLASS="keyname">BREAK</SPAN> keys typed together provide the long-break-disconnectfunction. Used with properly configured modems with RS-232-C levels, it willcause both the local and remote data sets to disconnect. For modems that areconnected via the 20 mA current loop, issuing the long space may disconnect theremote data set only.</P><P>The <SPAN CLASS="keyname">CTRL</SPAN> and <SPAN CLASS="keyname">BREAK</SPAN> keys typed together cause the transmission of theanswerback message.</P><P>The <SPAN CLASS="keyname">BREAK</SPAN> key does not function when the VT100 is in LOCAL mode.</P><P><STRONG>Auto Repeating</STRONG> -- All keys will auto repeat except: <SPAN CLASS="keyname">SET-UP</SPAN>, <SPAN CLASS="keyname">ESC</SPAN>, <SPAN CLASS="keyname">NO SCROLL</SPAN>,<SPAN CLASS="keyname">TAB</SPAN>, <SPAN CLASS="keyname">RETURN</SPAN>, and any key pressed with <SPAN CLASS="keyname">CTRL</SPAN>. Auto repeating works as follows:when a key is typed, its code(s) is sent once, immediately. If the key is helddown for more than ½ second, the code(s) will be sent repeatedly at a rate ofapproximately 30 Hz (less if low transmit baud rates are used) until the key isreleased.</P><P><STRONG>CTRL (Control)</STRONG> -- The <SPAN CLASS="keyname">CTRL</SPAN> key is used in conjunction with other keys on thekeyboard to generate control codes. If the <SPAN CLASS="keyname">CTRL</SPAN> key is held down when any of thekeys in <A HREF="table3-5.html">Table 3-5</A> are typed, the code actually transmitted is in the range000<SUB>8</SUB>-037<SUB>8</SUB>.</P><P><STRONG>Cursor Control</STRONG> -- The keyboard also contains four keys labeled with arrows ineach of four directions. These keys transmit control sequences. If the host echoesthese control sequences back to the terminal, the cursor will move one characterup, down, right, or left. <A HREF="table3-6.html">Table 3-6</A> shows the control sequences generated by eachkey.</P><P><STRONG>Auxiliary Keypad</STRONG> -- The keys on the auxiliary keypad normally transmit the codesfor the numerals, decimal point, minus sign, and comma. In addition, the keylabeled <SPAN CLASS="keyname">ENTER</SPAN> transmits the same code as the <SPAN CLASS="keyname">RETURN</SPAN> key. The host cannot tellif these keys were typed on the auxiliary keypad as opposed to the correspondingkeys on the main keyboard. Therefore, software which requires considerable numericdata entry need not be rewritten to use the keypad.</P><P>However, if software must be able to distinguish between pressing a key on theauxiliary keypad and pressing the corresponding key on the main keyboard, thehost can give the terminal a command to place it in keypad application mode. Inkeypad application mode all keys on the auxiliary keypad are defined to give controlsequences which may be used by the host as user-defined functions.</P><P>The codes sent by the auxiliary keypad for the four combinations of theVT52/ANSI mode and keypad numeric/application mode are shown in Tables <A HREF="table3-7.html">3-7</A>and <A HREF="table3-8.html">3-8</A>. None of the keys are affected by pressing the <SPAN CLASS="keyname">SHIFT</SPAN>, <SPAN CLASS="keyname">CAPS LOCK</SPAN>, or<SPAN CLASS="keyname">CTRL</SPAN> keys.</P><P><STRONG>Special Graphics Characters</STRONG><BR>If the Special Graphics set is selected, the graphics for ASCII codes 137<SUB>8</SUB> through176<SUB>8</SUB> will be replaced according to <A HREF="table3-9.html">Table 3-9</A>. (See the SCS control sequence).</P><H2 ID="S3.2">Communications Protocols</H2><P><STRONG>Full Duplex</STRONG><BR>The terminal can operate at transmission speeds up to 19,200 baud. However, theterminal may not be able to keep up with incoming data. The terminal storesincoming characters in a 64-character buffer and processes them on a first-in/first-outbasis. When the content of the buffer reaches 32 characters, the terminal willtransmit 023<SUB>8</SUB> (XOFF or DC3). On this signal the host should suspend its transmissionto the terminal. Eventually, if the host stops transmitting, the terminal willdeplete the buffer. When 16 characters remain in the buffer the terminal willtransmit 021<SUB>8</SUB> (XON or DC1) to signal the host that it may resume transmission.</P><P>If the host fails to respond to an XOFF from the terminal in a timely manner, thebuffer will continue to fill. When the 64-character capacity of the buffer is exceeded,a condition occurs called "buffer overflow". To determine if the buffer willoverflow use the following formulas:</P><TABLE><TBODY><TR VALIGN="TOP"><TD>No. of characters to overflow</TD><TD>=</TD><TD>32 - [3 × (receiver speed / transmit speed) ]</TD></TR><TR VALIGN="TOP"><TD>Time to respond to XOFF</TD><TD>=</TD><TD>No. of characters to overflow × (bits per character + parity bit + 2) / receiver speed</TD></TR></TBODY></TABLE><P><SPAN CLASS="example">Example 1:</SPAN><BR>The VT100 is transmitting 8-bit characters with no parity at 1200 baud and receivingat 1200 baud. The terminal has just sent an XOFF which the host mustrespond to with 0.2416 second to avoid a buffer overflow.</P><TABLE><TBODY><TR VALIGN="TOP"><TD>No. of characters to overflow</TD><TD>=</TD><TD>32 - [3 × (1200 / 1200) ] = 29 characters</TD></TR><TR VALIGN="TOP"><TD>Time to respond to XOFF</TD><TD>=</TD><TD>29 × [8 + 0 + 2) / 1200 = 0.2416 second</TD></TR></TBODY></TABLE><P><SPAN CLASS="example">Example 2:</SPAN><BR>The VT100 is transmitting 7-bit characters with parity at 300 baud and receivingat 1200 baud. The terminal has just sent an XOFF which the host must respond towithin 0.1666 second to avoid a buffer overflow.</P><TABLE><TBODY><TR VALIGN="TOP"><TD>No. of characters to overflow</TD><TD>=</TD><TD>32 - [3 × (1200 / 300) ] = 20 characters</TD></TR><TR VALIGN="TOP"><TD>Time to respond to XOFF</TD><TD>=</TD><TD>20 × [7 + 1 + 2) / 1200 = 0.1666 second</TD></TR></TBODY></TABLE><P>If the buffer overflows, the VT100 will begin to discard incoming characters andthe error character will be displayed.</P><P>Software which does not support receipt of the XOFF/XON signals from the terminalcan still use the VT100 provided the software never sends the <CODE>ESC</CODE> code to theterminal, the baud rate is limited to 4800 or less, and the software does not usesmooth scrolling or split screen features.</P><P>Alternatively, if XOFF/XON cannot be used, fill characters may be used after charactersor character strings are sent to the VT100. A reference chart of fill charactersrequired for these functions is included in Appendix C.</P><P>Two of the terminal functions, Reset and Self-Test, reinitialize the terminal anderase the buffer. This means that if characters are received subsequent to thecommands to perform these two functions and the characters are placed in thebuffer, the character would be destroyed without being processed.</P><P>To compensate for this, the host may act in one of two ways:</P><OL><LI>Immediately after sending the terminal the commands to perform eitherthe Reset or Self-Test functions, the host may act as if it had receivedXOFF from the terminal, thus sending no more characters until it receivesXON. The terminal will transmit XON only after it completes thespecified operation and the XOFF/XON feature is enabled.</LI><LI>When the first method cannot be implemented, a delay of no less than10 seconds may be used to allow the terminal time to complete theinvoked function. This method, however, does not guarantee againstthe loss of data when an invoked function has detected an error; andwhile this delay is currently adequate, future options may require achange in the time delay.</LI></OL><P>The XOFF/XON synchronization scheme has an advantage over requiring the hostto insert delays or filler characters in its data stream. Requiring a minimum ofsoftware support, XON/XOFF ensures that every character or command sent tothe VT100 will be processed in correct order. It frees interface programs from alltiming considerations and results in more reliable operation.</P><P>In addition to the buffer-filling condition, there are two other means of transmittingXOFF and XON; the <SPAN CLASS="keyname">NO SCROLL</SPAN> key, and Control S/Control Q. If the XON/XOFFfeature is enabled, the VT100 will coordinate these three sources of XOFF andXON so that the desired effect occurs. For example, if the buffer-filling conditionhas caused an XOFF to be sent, and then the operator types the <SPAN CLASS="keyname">NO SCROLL</SPAN> key,a second XOFF is not sent. Instead of sending an XON when the buffer empties,the VT100 waits until the operator types the <SPAN CLASS="keyname">NO SCROLL</SPAN> key again before sendingXON.</P><P>Also, entering SET-UP mode causes the VT100 to temporarily stop taking charactersfrom the buffer. An XOFF will be sent if the buffer becomes nearly full.</P><P>Use of Control S and Control Q will also be synchronized with the <SPAN CLASS="keyname">NO SCROLL</SPAN>key.</P><P>If the XON/XOFF feature is disabled, the buffer-filling condition will not send anXOFF, the <SPAN CLASS="keyname">NO SCROLL</SPAN> key is disabled, and Control S and Control Q will betransmitted as typed.</P><P>The VT100 also recognizes received XOFF and XON. Receipt of XOFF will inhibitthe VT100 from transmitting any codes except XOFF and XON. From three toseven keystrokes on the keyboard will be stored in a keyboard buffer (some keystransmit two or three codes, e.g., cursor controls). If the keyboard buffer overflows,keyclicks will stop and the KBD LOCKED LED will come on. Transmission resumesupon receipt of XON.</P><P>If the user transmits an XOFF to the host (by Control S or <SPAN CLASS="keyname">NO SCROLL</SPAN>), the hostshould not echo any further type-in until the user types XON. This places theburden of not overloading the host's output buffer on the user.</P><P>Entering and exiting SET-UP clears the keyboard locked condition.</P><H2 ID="S3.3">Terminal Control Commands</H2><P>The VT100 has many control commands which cause it to take action other thandisplaying a character on the screen. In this way, the host can command theterminal to move the cursor, change modes, ring the bell, etc. The following paragraphsdiscuss the terminal control commands.</P><H3 ID="S3.3.1">Control Characters</H3><P>Control characters have values of 000<SUB>8</SUB> - 037<SUB>8</SUB>, and 177<SUB>8</SUB>. The control charactersrecognized by the VT100 are shown in <A HREF="table3-10.html">Table 3-10</A>. All other control codes causeno action to be taken.</P><P>Control characters (codes 0<SUB>8</SUB> to 37<SUB>8</SUB> inclusive) are specifically excluded from thecontrol sequence syntax, but may be embedded within a control sequence. Embeddedcontrol characters are executed as soon as they are encountered by theVT100. The processing of the control sequence then continues with the next characterreceived. The exceptions are: if the character <STRONG>ESC</STRONG> occurs, the current controlsequence is aborted, and a new one commences beginning with the <STRONG>ESC</STRONG> justreceived. If the character CAN (30<SUB>8</SUB>) or the character SUB (32<SUB>8</SUB>) occurs, the currentcontrol sequence is aborted. The ability to embed control characters allowsthe synchronization characters XON and XOFF to be interpreted properly withoutaffecting the control sequence.</P><H3 ID="S3.3.2">Control Sequences</H3><P>The VT100 is an upward and downward software compatible terminal; that is,previous DIGITAL video terminals have DIGITAL private standards for control sequences.The American National Standards Institute (ANSI) has since standardizedescape and control sequences in terminals in documents X3.41-1974 andX3.64-1977.</P><P CLASS="note">NOTE: The ANSI standards allow the manufacturer flexibility inimplementing each function. This manual describes how the VT100 will respond tothe implemented ANSI control function.</P><P>The VT100 is compatible with both the previous DIGITAL standard and ANSIstandards. Customers may use existing DIGITAL software designed around theVT52 or new VT100 software. The VT100 has a "VT52 compatible" mode inwhich the VT100 responds to control sequences like a VT52. In this mode, most ofthe new VT100 features cannot be used.</P><P>Throughout this section of the manual, references will be made to "VT52 mode" or"ANSI mode". These two terms are used to indicate the VT100's software compatibility.All new software should be designed around the VT100 "ANSI mode".Future DIGITAL video terminals will not necessarily be committed to VT52 compatibility.</P><P CLASS="note">NOTE: ANSI standards may be obtained by writing:<BR>Sales Department<BR>American National Standards Institute<BR>1430 Broadway<BR>New York, New York 10018</P><H3 ID="S3.3.3">Valid ANSI Mode Control Sequences</H3><H4>Definitions</H4><P>The following listing defines the basic elements of the ANSI mode control sequences.A more complete listing appears in Appendix A.</P><DL><DT>Control Sequence Introducer (CSI)</DT><DD>An escape sequence that providessupplementary controls and is itself a prefix affecting the interpretation ofa limited number of contiguous characters. In the VT100 the CSI is <CODE>ESC [</CODE>.</DD><DT>Parameter</DT><DD><OL><LI>A string of zero or more decimal characters which representa single value. Leading zeroes are ignored. The decimal charactershave a range of 0 (60<SUB>8</SUB>) to 9 (71<SUB>8</SUB>).</LI><LI>The value so represented.</LI></OL></DD><DT>Numeric Parameter</DT><DD>A parameter that represents a number, designatedby Pn.</DD><DT>Selective Parameter</DT><DD>A parameter that selects a subfunction from aspecified list of subfunctions, designated by Ps. In general, a control sequencewith more than one selective parameter causes the same effect asseveral control sequences, each with one selective parameter, e.g., CSI Psa;Psb; Psc F is identical to CSI Psa F CSI Psb F CSI Psc F.</DD><DT>Parameter String</DT><DD>A string of parameters separated by a semicolon (73<SUB>8</SUB>).</DD><DT>Default</DT><DD>A function-dependent value that is assumed when no explicitvalue, or a value of 0, is specified.</DD><DT>Final character</DT><DD>A character whose bit combination terminates an escapeor control sequence.</DD></DL><P><SPAN CLASS="example">Examples:</SPAN></P><OL><LI><P>Control sequence for double-width line (DECDWL) <CODE>ESC # 6</CODE></P><TABLE><THEAD><TR><TH>Sequence</TH><TH>Octal Representation of Sequence</TH></TR></THEAD><TBODY><TR VALIGN="TOP"><TD><IMG SRC="ch3examp1a.png" ALT=""></TD><TD><IMG SRC="ch3examp1b.png" ALT=""></TD></TR></TBODY></TABLE></LI><LI><P>Control sequence to turn off all character attributes, and then turn on underscoreand blink attributes (SGR). <CODE>ESC [ 0 ; 4 ; 5 m</CODE></P><TABLE><THEAD><TR><TH>Sequence</TH><TH>Octal Representation of Sequence</TH></TR></THEAD><TBODY><TR VALIGN="TOP"><TD><IMG SRC="ch3examp2a.png" ALT=""></TD><TD><IMG SRC="ch3examp2b.png" ALT=""></TD></TR></TBODY></TABLE></LI></OL>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -