Common ANSI control codes

Source: Internet
Author: User

The following is the commonly used ANSI control code found. However, I have never succeeded in saving the control code and restoring the cursor position. I first use/033 [s to save the current cursor position, and then use/033 [X; YH to set the cursor position, and finally restore the cursor position/033 [U, however, the original location cannot be recovered. Do not understand.

 

BBS supports the ANSI/3.64 control code standard. All ANSI control codes start with ESC [as the control code.
The ESC Character Input Method in BBS is [ESC] + [ESC], which is represented by "*" in the editor.
* Press ESC twice or Alt + 027 (numeric keypad) twice. You can also press insert in cterm.
The signature file has a limit on the number of lines in six rows (the so-called six rows indicate that the input character occupies six rows rather than the display character occupies six rows ),
BBS currently has a limit of about 240 characters per line. Therefore, a signature file can contain a total of about 1320 characters.
The ANSI cursor control code is required for the event signing file. The principle is the same as that for animation production.
DOS supports most ANSI control codes. For details about how to use it in DOS, see C:> help ANSI. sys (invalid command ?)
The following is the commonly used ANSI control code table of BBs. Note that the control character is case sensitive.
Device = ANSI. sys

BBS usually uses ANSI code control table

Cursor control]

Please refer to the following link for more information:
Traffic Control Code Description
Please refer to the following link for more information:
Cursor [X; YH cursor move the cursor to the position of row X and column Y. Bytes
Please refer to the following link for more information:
Cursor [Na cursor move the cursor up n columns.> Bytes
Please refer to the following link for more information:
Cursor [NB ← move the cursor down n columns.> Bytes
Please refer to the following link for more information:
Cursor [NC cursor n rows to the right.> Bytes
Please refer to the following link for more information:
Direction [Nd direction indicator to N rows left.> Bytes
Please refer to the following link for more information:
Cursor [6N cursor report the cursor position. Bytes
Please refer to the following link for more information:
Cursor [s cursor stores the current cursor position. Bytes
Please refer to the following link for more information:
Cursor [U cursor is used to retrieve the saved cursor position. Bytes
Please refer to the following link for more information:
Note: The one-screen display of the BBS system is about 25*80, and the last two behaviors are occupied by the BBS system, which is only 23*80.

[Screen Control]

Please refer to the following link for more information:
Traffic Control Code Description
Please refer to the following link for more information:
Else [2j else clear the screen. > Logging
Please refer to the following link for more information:
Cursor [k cursor clears all characters starting from the cursor position to the end of this column. Bytes
Please refer to the following link for more information:

Display character Property Control]

Please refer to the following link for more information:
Traffic Control Code Description
Please refer to the following link for more information:
┃ I sets the attribute status of the characters to be displayed. Bytes
Separator [N1; N2;... m ┃ ⅱ if there are more than two attribute states to be set, separate the code (N1; N2;...) with a semicolon
Unless reset, the original property is retained. Bytes
Please refer to the following link for more information:

Please refer to the following link for more information:

Please refer to the following link for more information:
Returns the normal display mode (normal) When
Highlight 1 highlight High Brightness Display (bright) Highlight
When 4 then underline (underline) (Note 1) then
Highlight 5 flashing (flash) (note 2) Highlight
Listen 7 reverse phase display (inverse) Reverse Phase
When 8 then invisible (invisable) then
Please refer to the following link for more information:
┃ Foreground colors background colors
Please refer to the following link for more information:
Expires 30 minutes 40 Gbit/s black expires
31 then 41 then red
Listen 32 then 42 then green then
33 then 43 then yellow
201734 g044 g0blue Scheduler
35 then 45 then purple-red
36 then 46 Then Blue
California 37, 47, yellow, white
Please refer to the following link for more information:
NOTE 1: The old sterm version does not support the offline draw line function. The current version 1.266 and later versions support underline and underline.
The color is the same as the foreground color. For example, if the foreground color is green, the underline is green. Use cterm to see
All underlines are white, regardless of the color of the foreground.
NOTE 2: sterm and cterm display effects are slightly different. The background color is not highlighted, but sterm 1.266
This function is used to display the highlighted background. For example, highlight the red foreground and
The low-bright yellow background. If you use sterm 1.266, add the echo function.
It turns into a highlighted red background and a low-bright yellow foreground, that is, the foreground color and the background color are completely exchanged and highlighted.
Degrees are also exchanged. However, if cterm is used, the example after the anti-explicit function is added is a low-bright red background.
And the highlighted yellow foreground, color interchange, brightness does not change, because the cterm cannot display the highlighted background.

[Font control]

Please refer to the following link for more information:
Traffic Control Code Description
Please refer to the following link for more information:
Restore [0i restore to normal font again
Please refer to the following link for more information:
┃ [1i ┃ ┃
Please refer to the following link for more information:
Invalid [2I invalid Black Box
Please refer to the following link for more information:
When [3I when ┃
Please refer to the following link for more information:

Special Control]

Please refer to the following link for more information:
Traffic Control Code Description
Please refer to the following link for more information:
[G]
Please refer to the following link for more information:
Confirm [NU weight URL validation (n Bytes) bytes
Please refer to the following link for more information:
Latency [Nm latency (n is the microseconds)> latency
Please refer to the following link for more information:

Special color control operator

·: No.
In fact, when you go back to the article, the system adds the following before the article:, it will make the article color become dark blue, with * [0; 36 m
The result is the same. The colon must be the colon in the English input method and must be at the first position of the row,
There can be spaces after the colon. This symbol is only valid for the content of this line.

· [In .................. ] Format
This format must also be at the starting position of the row. The effect is the same as that of * [1; 33m, and an English text is left blank.
Character location, the word "in" cannot be less, and must be the first word, followed by any content. This symbol
All text on the screen starting with this line is valid.

·> NO.
The effect is exactly the same as that of the number. It should also be placed at the starting position of the line.> the number can be followed by no space or space,
The results are the same. This symbol is only valid for the content of this line.

· ==> No.
The effect is equivalent to * [1; 33 m; the position must also be at the starting position of the row, ==> no space is required for the end, or a space is required,
This symbol is valid for the content on the screen from now on.

Color Recognition

· Primary colors: red, yellow, and blue
Red + yellow = orange + Blue = green + Blue = purple + yellow + Blue = black

· Three colors: Red, green, and blue
Red + Green = yellow green + Blue = green red + Blue = purple red + green + Blue = white

· The color system on the computer is set according to the three original light.

Some practices of BBS Systems

· Special commands: (Please Press ESC first and then select the following items)

(I) Import files (e) Export files (c) View color editing results
(B) Set background color (f) Set foreground color (r) Restore color
(ESC) color control code (m) Block Processing (l) ON or off the message bar

· General commands:

^ W, ^ x finish editing after archiving ^ L, ^ g redraw Screen
^ Q: displays the secondary image. ^ Z: view or return information.

· Cursor movement command:

^ P, direction up | ^ N, direction down | ^ r, direction to left | ^ V, → right
^ A, home to the beginning of the Line | ^ e, end to the end of the line | ^ B, pgup Previous Page | ^ F, pgdn next page
^ S file START | ^ t file end | ESC-s search | ESC-N continue searching
ESC-G jump # Line │

· DELETE command:

^ O, INS switch insert/replace mode swap ^ h, BS Delete left character swap ^ y delete a row
^ D, del Delete the current character forward ^ K to the end of the row

· Block Processing:

^ U block calibration ^ C copy block ESC-D clear block ESC-Q clear Calibration

ANSI. sys and nansi. sys functions-ANSI x3.64

ESC [y, XH cursor position y, X
ESC [Na cursor up n lines
ESC [NB cursor down n lines
ESC [NC cursor forward n characters
ESC [Nd cursor backward n characters
ESC [Y; XF cursor position y, x (less frequently used)
ESC [Y; XR cursor position report y, X
ESC [6N device status report (cursor POS) (N is constant 'n ')
ESC [s save cursor position
ESC [U restore cursor position
ESC [2j erase display
ESC [k erase to end of line
ESC [NL inserts n blank lines at cursor line. (nansi)
ESC [Nm deletes n lines including cursor line. (nansi)
ESC [N @ inserts n blank chars at cursor. (nansi)
ESC [NP deletes n chars including cursor Char. (nansi)
ESC [NP deletes n chars including cursor Char. (nansi)
ESC [n; ny output char translate (nansi)
When first char is encountered in output request, it
Is replaced with the second Char. When no parameters
Are given, all chars are reset.
ESC ["str" P keyboard key reassignment. The first char of STR gives
The key to redefine; the rest of the string is
Key's new value. To specify unprintable chars, give
The ASCII value of the char outside of quotes, as
Normal parm. IBM function keys are two byte strings.

Ex: ESC [0; "; Dir A:"; 13; P

Redefines F1 to have the value "dir A:" followed by Cr.
If no parameters given, all keys are reset to their
Default values. Single or double quotes are valid.

ESC [n;... nm set graphics rendition is used to set attributes
Well as foreground and background colors. If multiple parameters
Are used, they are executed in sequence, and the effects are
Cumulative. 'n' is one of the following attributes or colors:
0 all attributes off 5 blink
1 bold 7 Reverse Video
2 dim 8 invisible
4 underline

Foreground colors background colors

30 black 40 black
31 red 41 red
32 green 42 green
33 yellow 43 yellow
34 blue 44 blue
35 magenta 45 Magenta
36 cyan 46 cyan
37 white 47 white

ESC [= NH set mode (see screen modes for N)
ESC [= NL reset mode (see screen modes for N)

Screen modes are similar to those found in the ibm bios:

0 text 40x25 black & white
1 text 40x25 color
2 Text 80x25 black & white
3 text 80x25 color
4 320x200 4 bits/Pixel
5 320x200 1 bit/Pixel
6 640x200 1 bit/Pixel
7 cursor wrap
13 320x200 4 bits/pixel (bytes)
14 640x200 4 bits/pixel (bytes)
16 640x350 4 bits/pixel (bytes)

This article from: (www.91linux.com) detailed source reference: http://www.91linux.com/html/article/program/cpp/20081211/14558.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.