发信人: OASISGUAVA (蓝色水瓶的兄贵), 信区: asciiart
标 题: [转寄]ANSI控制码
发信站: 蛋卷广场 (Wed Mar 12 09:00:53 1997)
A N S I 控 制 码 说 明
【游标控制】
┏━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ 控 制 码 ┃ 说 明 ┃
┣━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃[X;Yf or [X;YH┃ 将游标移至第 X 列 , 第 Y 行 的位置。 ┃
┣━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ [nA ┃ 游标上移 n 列。<<若至萤幕顶端则无效>> ┃
┣━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ [nB ┃ 游标下移 n 列。<<若至萤幕底端则无效>> ┃
┣━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ [nC ┃ 游标向右 n 行。<<若已至萤幕最右端则无效>> ┃
┣━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ [nD ┃ 游标向左 n 行。<<若已至萤幕最左端则无效>> ┃
┣━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ [6n ┃ 报告游标位置。 ┃
┣━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ [s ┃ 保存目前的游标位置。 ┃
┣━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ [u ┃ 取出保存的游标位置来使用。 ┃
┗━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
A N S I 控 制 码 说 明
【萤幕控制】
┏━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ 控 制 码 ┃ 说 明 ┃
┣━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ [2J ┃ 清除萤幕。 <<功能和 DOS 的 CLS 命令一样>> ┃
┣━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ [K ┃ 将游标位置开始至本列结束的所有字元清除。 ┃
┗━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
A N S I 控 制 码 说 明
【显示字元属性控制】
┏━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ 控 制 码 ┃ 说 明 ┃
┣━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ ┃Ⅰ设定显示字元的属性状态。 ┃
┃[n1;n2;......m┃Ⅱ若有两个以上的属性状态要设定则以分号将代码(n1;n2;..)隔开┃
┃ ┃Ⅲ除非重新设定,否则原设定之属性一直被保留。 ┃
┗━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
┏━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ 代 码 ┃ 意 义 ┃
┣━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ 0 ┃ 所有属性 OFF,即返回生常显示模式 (Normal) ┃
┃ 1 ┃ 高亮度显示 (Bright) ┃
┃ 4 ┃ 加上底线 (Underline) ┃
┃ 5 ┃ 闪烁显示 (Flash) ┃
┃ 7 ┃ 反白显示 (Inverse) ┃
┃ 8 ┃ 不可见 (Invisable) ┃
┣━━━┳━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ 前景 ┃ 背景 ┃ 颜 色 ┃
┣━━━╋━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ 30 ┃ 40 ┃ 黑色 ┃
┃ 31 ┃ 41 ┃ 红色 ┃
┃ 32 ┃ 42 ┃ 绿色 ┃
┃ 33 ┃ 43 ┃ 黄色 ┃
┃ 34 ┃ 44 ┃ 蓝色 ┃
┃ 35 ┃ 45 ┃ 紫红色 ┃
┃ 36 ┃ 46 ┃ 青蓝色 ┃
┃ 37 ┃ 47 ┃ 白色 ┃
┗━━━┻━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
A N S I 控 制 码 说 明
【重订键盘】
┏━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ 控 制 码 ┃ 说 明 ┃
┣━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ [n;mp ┃ 将 ASCII 码为 n 的键改为 ASCII 码 m ┃
┣━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃[n;'字串';mp ┃ 将 ASCII 码为 n 的键改为字串加上 ASCII 码 m 之字元 ┃
┃ ┃ (通常 m 为控制字元之 ASCII 码) ┃
┗━━━━━━━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
A N S I 控 制 码 说 明
【命令说明】
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃■以下 ? 为表示按 ALT-027 键的前导码 ┃
┃?[15;30H <<将游标移至 15 列 24 行>> ┃
┃?[为前导码 {?在 PE2 内的 ESC 字元显示模样} ┃
┃ 15 列叁数 ; 叁数的分号 24 行叁数 H 结束码命令识别字(若为f须小写) ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
※ 修改:·unknown 於 Aug 10 07:45:13 修改本文·[FROM: 10.13.13.1]
※ 来源:·日月光华站 bbs.fudan.edu.cn·[FROM: 10.64.5.130]
Sender: OASISGUAVA blue water bottle brother, message area: asciiart
Title: [Forward]ANSI Control Code
Sending station: Egg Roll Plaza Wed Mar 12 09:00:53 1997
Control code description
Cursor control
Control code description
[X;Yf or [X;YH] Move the cursor to the position of column X, row Y
[nA Move the cursor up n columns <<Invalid if it reaches the top of the screen>>
[nB Move the cursor down n columns <<Invalid if it reaches the bottom of the screen>>
[nC Cursor n lines to the right <<Invalid if it has reached the far right end of the screen>>
[nD Cursor moves n lines to the left <<Invalid if it has reached the far left of the screen>>
[6n Report cursor position
[s saves the current cursor position
[u Take out the saved cursor position and use it
Control code description
screen control
Control code description
[2J Clear screen <<The function is the same as the CLS command of DOS>>
[K Clear all characters from the cursor position to the end of this column
Control code description
Show character attribute controls
Control code description
ⅠSet the attribute status of display characters
[n1;n2;......m Ⅱ If there are more than two attribute states to be set, separate the codes n1;n2;.. with semicolons
ⅢUnless reset, the originally set attributes will be retained.
code meaning
0 All attributes are OFF, which means returning to normal display mode Normal
1 Highlight display Bright
4 Add the bottom line Underline
5 flash display Flash
7 Inverse display
8 Invisible
foreground background color
30 40 black
31 41 red
32 42 green
33 43 yellow
34 44 blue
35 45 purple
36 46 cyan blue
37 47 white
Control code description
Reset keyboard
Control code description
[n;mp Change the key with ASCII code n to ASCII code m
[n;'string';mp Change the key with ASCII code n to a string plus the character with ASCII code m
Usually m is the ASCII code of the control character
Control code description
Command description
The following ? is the preamble indicating pressing the ALT 027 key
?[15;30H <<Move the cursor to column 15 and row 24>>
?[is the preamble {?The ESC character display appearance in PE2}
15 Column parameters; semicolon of parameters 24 Row parameters H End code command identification word If it is f, it must be lowercase
Modification: unknown modified this article on Aug 10 07:45:13 [FROM: 10.13.13.1]
Source: Sun and Moon Guanghua Station bbs.fudan.edu.cn [FROM: 10.64.5.130]