||
8086 color:red">汇编指令速查手册
color:red">一、数据传输指令
mso-hansi-font-family:"Times New Roman"">───────────────────────────────────────
"Times New Roman"">它们在存贮器和寄存器、寄存器和输入输出端口之间传送数据.
1. 通用数据传送指令.
MOV
"Times New Roman";color:blue">传送字或字节.
MOVSX
"Times New Roman"">先符号扩展,再传送.
MOVZX
"Times New Roman"">先零扩展,再传送.
PUSH
"Times New Roman";color:blue">把字压入堆栈.
POP
mso-hansi-font-family:"Times New Roman";color:blue">把字弹出堆栈.
PUSHA
"Times New Roman"">把AX,CX,DX,BX,SP,BP,SI,DI
"Times New Roman"">依次压入堆栈.
POPA
"Times New Roman"">把DI,SI,BP,SP,BX,DX,CX,AX
"Times New Roman"">依次弹出堆栈.
PUSHAD
"Times New Roman"">把EAX,ECX,EDX,EBX,ESP,EBP,ESI,EDI
"Times New Roman"">依次压入堆栈.
POPAD
"Times New Roman"">把EDI,ESI,EBP,ESP,EBX,EDX,ECX,EAX
"Times New Roman"">依次弹出堆栈.
BSWAP
"Times New Roman"">交换32位寄存器里字节的顺序
XCHG
"Times New Roman";color:blue">交换字或字节.(
mso-hansi-font-family:"Times New Roman";color:blue">至少有一个操作数为寄存器,段寄存器不可作为操作数)
CMPXCHG
mso-hansi-font-family:"Times New Roman"">比较并交换操作数.(
"Times New Roman"">第二个操作数必须为累加器AL/AX/EAX )
XADD
"Times New Roman"">先交换再累加.(
"Times New Roman"">结果在第一个操作数里 )
XLAT
"Times New Roman";color:blue">字节查表转换.
color:blue">── BX
"Times New Roman";color:blue">指向一张
256
mso-hansi-font-family:"Times New Roman";color:blue">字节的表的起点, AL
color:blue">为表的索引值 (0-255,
"Times New Roman";color:blue">即
0-FFH);
"Times New Roman";color:blue">返回 AL
"Times New Roman";color:blue">为查表结果.
( [BX+AL]->AL
)
2. 输入输出端口传送指令.
IN
I/O
mso-hansi-font-family:"Times New Roman";color:blue">端口输入. (
color:blue">语法: IN
"Times New Roman";color:blue">累加器, {
"Times New Roman";color:blue">端口号│DX}
)
OUT
I/O
mso-hansi-font-family:"Times New Roman";color:blue">端口输出. (
color:blue">语法: OUT {
"Times New Roman";color:blue">端口号│DX},
"Times New Roman";color:blue">累加器 )
color:blue">输入输出端口由立即方式指定时,
"Times New Roman";color:blue">其范围是
0-255;
mso-hansi-font-family:"Times New Roman";color:blue">由寄存器 DX
color:blue">指定时,
color:blue">其范围是 0-65535.
3. 目的地址传送指令.
LEA
"Times New Roman"">装入有效地址.
mso-hansi-font-family:"Times New Roman"">例: LEA
DX,string ;
"Times New Roman"">把偏移地址存到DX.
LDS
"Times New Roman"">传送目标指针,
"Times New Roman"">把指针内容装入DS.
mso-hansi-font-family:"Times New Roman"">例: LDS
SI,string ;
"Times New Roman"">把段地址:偏移地址存到DS:SI.
LES
"Times New Roman"">传送目标指针,
"Times New Roman"">把指针内容装入ES.
mso-hansi-font-family:"Times New Roman"">例: LES
DI,string ;
"Times New Roman"">把段地址:偏移地址存到ES:DI.
LFS
"Times New Roman"">传送目标指针,
"Times New Roman"">把指针内容装入FS.
mso-hansi-font-family:"Times New Roman"">例: LFS
DI,string ;
"Times New Roman"">把段地址:偏移地址存到FS:DI.
LGS
"Times New Roman"">传送目标指针,
"Times New Roman"">把指针内容装入GS.
mso-hansi-font-family:"Times New Roman"">例: LGS
DI,string ;
"Times New Roman"">把段地址:偏移地址存到GS:DI.
LSS
"Times New Roman"">传送目标指针,
"Times New Roman"">把指针内容装入SS.
mso-hansi-font-family:"Times New Roman"">例: LSS
DI,string ;
"Times New Roman"">把段地址:偏移地址存到SS:DI.
4. 标志传送指令.
LAHF
"Times New Roman";color:blue">标志寄存器传送,
"Times New Roman";color:blue">把标志装入AH.
SAHF
mso-hansi-font-family:"Times New Roman";color:blue">标志寄存器传送,把AH内容装入标志寄存器.
PUSHF
mso-hansi-font-family:"Times New Roman";color:blue">标志入栈.
POPF
mso-hansi-font-family:"Times New Roman";color:blue">标志出栈.
PUSHD 32
"Times New Roman"">位标志入栈.
POPD 32
"Times New Roman"">位标志出栈.
color:red">二、算术运算指令
mso-hansi-font-family:"Times New Roman"">───────────────────────────────────────
mso-hansi-font-family:"Times New Roman""> ADD 加法.
ADC
color:blue">带进位加法.
INC
mso-hansi-font-family:"Times New Roman";color:blue">加 1.
AAA
"Times New Roman"">加法的ASCII
"Times New Roman"">码调整.
DAA
"Times New Roman"">加法的十进制调整.
SUB
"Times New Roman";color:blue">减法.
SBB
mso-hansi-font-family:"Times New Roman";color:blue">带借位减法.
DEC
mso-hansi-font-family:"Times New Roman";color:blue">减 1.
NEC
"Times New Roman"">求反(以 0
mso-hansi-font-family:"Times New Roman"">减之).
CMP
"Times New Roman"">比较.(两操作数作减法,
mso-hansi-font-family:"Times New Roman"">仅修改标志位,
"Times New Roman"">不回送结果).
AAS
"Times New Roman"">减法的ASCII
"Times New Roman"">码调整.
DAS
"Times New Roman"">减法的十进制调整.
MUL
"Times New Roman";color:blue">无符号乘法.
IMUL
color:blue">整数乘法.
mso-hansi-font-family:"Times New Roman"">以上两条,
"Times New Roman"">结果回送AH和AL(
mso-hansi-font-family:"Times New Roman"">字节运算),
"Times New Roman"">或DX和AX(
mso-hansi-font-family:"Times New Roman"">字运算),
AAM
"Times New Roman"">乘法的ASCII
"Times New Roman"">码调整.
DIV
"Times New Roman";color:blue">无符号除法.
IDIV
"Times New Roman";color:blue">整数除法.
mso-hansi-font-family:"Times New Roman"">以上两条,
"Times New Roman"">结果回送:
商回送AL, mso-hansi-font-family:"Times New Roman"">余数回送AH, ( "Times New Roman"">字节运算);
mso-hansi-font-family:"Times New Roman"">或 商回送AX,
mso-hansi-font-family:"Times New Roman"">余数回送DX, (
"Times New Roman"">字运算).
AAD
"Times New Roman"">除法的ASCII
"Times New Roman"">码调整.
CBW color:blue">字节转换为字. ( "Times New Roman";color:blue">把AL "Times New Roman";color:blue">中字节的符号扩展到AH中去)
CWD
mso-hansi-font-family:"Times New Roman";color:blue">字转换为双字. (把AX中的字的符号扩展到DX中去)
CWDE
"Times New Roman"">字转换为双字. (
"Times New Roman"">把AX中的字符号扩展到EAX
mso-hansi-font-family:"Times New Roman"">中去)
CDQ
"Times New Roman"">双字扩展. (把EAX
mso-hansi-font-family:"Times New Roman"">中的字的符号扩展到EDX
"Times New Roman"">中去)
color:red">三、逻辑运算指令
mso-hansi-font-family:"Times New Roman"">───────────────────────────────────────
AND
"Times New Roman";color:blue">与运算.
OR
mso-hansi-font-family:"Times New Roman";color:blue">或运算.
XOR
mso-hansi-font-family:"Times New Roman";color:blue">异或运算.
NOT
mso-hansi-font-family:"Times New Roman";color:blue">取反.
TEST
mso-hansi-font-family:"Times New Roman";color:blue">测试.(两操作数作与运算,仅修改标志位,不回送结果).
SHL
mso-hansi-font-family:"Times New Roman";color:blue">逻辑左移.
SAL
mso-hansi-font-family:"Times New Roman";color:blue">算术左移.(=SHL)
SHR
mso-hansi-font-family:"Times New Roman";color:blue">逻辑右移.
SAR
mso-hansi-font-family:"Times New Roman";color:blue">算术右移.(=SHR)
ROL
mso-hansi-font-family:"Times New Roman";color:blue">循环左移.
ROR
mso-hansi-font-family:"Times New Roman";color:blue">循环右移.
RCL
mso-hansi-font-family:"Times New Roman";color:blue">通过进位的循环左移.
RCR
mso-hansi-font-family:"Times New Roman";color:blue">通过进位的循环右移.
color:blue">以上八种移位指令, "Times New Roman";color:blue">其移位次数可达255 "Times New Roman";color:blue">次.
color:blue">移位一次时, "Times New Roman";color:blue">可直接用操作码. color:blue">如 SHL AX,1.
color:blue">移位>1
"Times New Roman";color:blue">次时,
"Times New Roman";color:blue">则由寄存器CL
"Times New Roman";color:blue">给出移位次数.
color:blue">如 MOV CL,04
SHL AX,CL
color:red">四、串指令
mso-hansi-font-family:"Times New Roman"">───────────────────────────────────────
mso-hansi-font-family:"Times New Roman""> DS:SI 源串段寄存器 :
"Times New Roman"">源串变址.
ES:DI
"Times New Roman"">目标串段寄存器:
"Times New Roman"">目标串变址.
CX
"Times New Roman"">重复次数计数器.
AL/AX
"Times New Roman"">扫描值.
D
mso-hansi-font-family:"Times New Roman"">标志 0表示重复操作中SI
mso-hansi-font-family:"Times New Roman"">和DI
"Times New Roman"">应自动增量; 1
"Times New Roman"">表示应自动减量.
Z
mso-hansi-font-family:"Times New Roman"">标志 用来控制扫描或比较操作的结束.
MOVS
"Times New Roman";color:blue">串传送.
( MOVSB 传送字符. MOVSW 传送字. MOVSD 传送双字. )
CMPS
"Times New Roman";color:blue">串比较.
( CMPSB
"Times New Roman"">比较字符. CMPSW
mso-hansi-font-family:"Times New Roman"">比较字. )
SCAS
"Times New Roman";color:blue">串扫描.
mso-hansi-font-family:"Times New Roman"">把AL
"Times New Roman"">或AX的内容与目标串作比较,
mso-hansi-font-family:"Times New Roman"">比较结果反映在标志位.
LODS
"Times New Roman";color:blue">装入串.
mso-hansi-font-family:"Times New Roman"">把源串中的元素(
"Times New Roman"">字或字节)逐一装入AL
mso-hansi-font-family:"Times New Roman"">或AX
"Times New Roman"">中.
( LODSB 传送字符. LODSW 传送字. LODSD 传送双字. )
STOS
"Times New Roman";color:blue">保存串.
mso-hansi-font-family:"Times New Roman"">是LODS
"Times New Roman"">的逆过程.
REP
"Times New Roman"">当CX/ECX<>0
"Times New Roman"">时重复.
REPE/REPZ
"Times New Roman"">当ZF=1或比较结果相等,
mso-hansi-font-family:"Times New Roman"">且CX/ECX<>0
"Times New Roman"">时重复.
REPNE/REPNZ
"Times New Roman"">当ZF=0或比较结果不相等,
mso-hansi-font-family:"Times New Roman"">且CX/ECX<>0
"Times New Roman"">时重复.
REPC
"Times New Roman"">当CF=1且CX/ECX<>0时重复.
REPNC
"Times New Roman"">当CF=0且CX/ECX<>0时重复.
color:red">五、程序转移指令
mso-hansi-font-family:"Times New Roman"">───────────────────────────────────────
"Times New Roman""> 1>无条件转移指令 ( mso-hansi-font-family:"Times New Roman"">长转移)
JMP
color:blue">无条件转移指令
CALL
mso-hansi-font-family:"Times New Roman";color:blue">过程调用
RET/RETF color:blue">过程返回.
2>
mso-hansi-font-family:"Times New Roman"">条件转移指令 (
"Times New Roman"">短转移,-128
"Times New Roman"">到+127的距离内)
(
mso-hansi-font-family:"Times New Roman"">当且仅当(SF XOR
OF)=1
mso-hansi-font-family:"Times New Roman"">时,OP1<OP2 )
JA/JNBE
mso-hansi-font-family:"Times New Roman"">不小于或不等于时转移.
JAE/JNB
mso-hansi-font-family:"Times New Roman"">大于或等于转移.
JB/JNAE
mso-hansi-font-family:"Times New Roman"">小于转移.
JBE/JNA
mso-hansi-font-family:"Times New Roman"">小于或等于转移.
mso-hansi-font-family:"Times New Roman"">以上四条,
"Times New Roman"">测试无符号整数运算的结果(
"Times New Roman"">标志C和Z).
JG/JNLE
mso-hansi-font-family:"Times New Roman"">大于转移.
JGE/JNL
mso-hansi-font-family:"Times New Roman"">大于或等于转移.
JL/JNGE
mso-hansi-font-family:"Times New Roman"">小于转移.
JLE/JNG 小于或等于转移.
mso-hansi-font-family:"Times New Roman"">以上四条,
"Times New Roman"">测试带符号整数运算的结果(
"Times New Roman"">标志S,O和Z).
JE/JZ
"Times New Roman"">等于转移.
JNE/JNZ
mso-hansi-font-family:"Times New Roman"">不等于时转移.
JC
"Times New Roman"">有进位时转移.
JNC
"Times New Roman"">无进位时转移.
JNO
"Times New Roman"">不溢出时转移.
JNP/JPO
mso-hansi-font-family:"Times New Roman"">奇偶性为奇数时转移.
JNS
"Times New Roman"">符号位为 "0"
"Times New Roman"">时转移.
JO 溢出转移.
JP/JPE
"Times New Roman"">奇偶性为偶数时转移.
JS
"Times New Roman"">符号位为 "1"
"Times New Roman"">时转移.
3>
mso-hansi-font-family:"Times New Roman"">循环控制指令(
"Times New Roman"">短转移)
LOOP
CX
mso-hansi-font-family:"Times New Roman";color:blue">不为零时循环.
LOOPE/LOOPZ CX color:blue">不为零且标志Z=1 "Times New Roman";color:blue">时循环.
LOOPNE/LOOPNZ CX color:blue">不为零且标志Z=0 "Times New Roman";color:blue">时循环.
JCXZ CX
"Times New Roman"">为零时转移.
JECXZ ECX为零时转移.
4>
mso-hansi-font-family:"Times New Roman"">中断指令
INT
color:blue">中断指令
INTO
mso-hansi-font-family:"Times New Roman";color:blue">溢出中断
IRET
mso-hansi-font-family:"Times New Roman";color:blue">中断返回
5>
mso-hansi-font-family:"Times New Roman"">处理器控制指令
HLT
color:blue">处理器暂停,
"Times New Roman";color:blue">直到出现中断或复位信号才继续.
WAIT
mso-hansi-font-family:"Times New Roman";color:blue">当芯片引线TEST
color:blue">为高电平时使CPU
"Times New Roman";color:blue">进入等待状态.
ESC
mso-hansi-font-family:"Times New Roman";color:blue">转换到外处理器.
LOCK
mso-hansi-font-family:"Times New Roman";color:blue">封锁总线.
NOP
mso-hansi-font-family:"Times New Roman";color:blue">空操作.
STC
mso-hansi-font-family:"Times New Roman";color:blue">置进位标志位.
CLC
mso-hansi-font-family:"Times New Roman";color:blue">清进位标志位.
CMC
mso-hansi-font-family:"Times New Roman";color:blue">进位标志取反.
STD
mso-hansi-font-family:"Times New Roman";color:blue">置方向标志位.
CLD
mso-hansi-font-family:"Times New Roman";color:blue">清方向标志位.
STI
mso-hansi-font-family:"Times New Roman";color:blue">置中断允许位.
CLI
mso-hansi-font-family:"Times New Roman";color:blue">清中断允许位.
color:red">六、伪指令
mso-hansi-font-family:"Times New Roman"">───────────────────────────────────────
DB 定义字节.
DW "Times New Roman"">定义字(2字节).
PROC
"Times New Roman"">定义过程.
ENDP
"Times New Roman"">过程结束.
SEGMENT
mso-hansi-font-family:"Times New Roman"">定义段.
ASSUME
"Times New Roman"">建立段寄存器寻址.
ENDS
"Times New Roman"">段结束.
END
"Times New Roman"">程序结束.