实用汇编指令

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了实用汇编指令相关的知识,希望对你有一定的参考价值。

参考技术A 1.跳转指令
B 无条件跳转
BL 带链接的无条件跳转
BX 带状态切换的无条件跳转 根据目标地址最低位切换状态(arm/thumb)
BLX 带链接和状态切换的无条件跳转
B loc_地址
BEQ,BNE

2.存储器与寄存器交互数据指令 核心

3.数据传送指令
MOV:将立即数或寄存器的数据传送到目标寄存器 ←
MOV R0, #8 R0=8

4.数据算术运算指令

ADD,SUB,MUL,DIV
有符号,无符号运算;带进位运算

5.数据逻辑运算指令
与:AND
或:ORR
异或:EOR
移位:实质是乘,除,类似于小数点移位,但相反。小数点左移,数变小;右移变大。
但逻辑移位,左移变大,右移变小,且按2的倍数进行,因为是2进制。
LSL:逻辑左移←
LSR:逻辑右移←

6.比较指令
CMP:比较
CMP R0 #0 R0寄存器中的值与0比较
标志位:如z位,这个都可以在动态调试时,寄存器窗口看到

7.其他指令
协处理器指令:SWT (切换用户模式)
伪指令:DCB

8.寄存器寻址方式
立即寻址:MOV R0,#1234 R0=0X1234
寄存器寻址:MOV R0,R1 R0=R1
寄存器移位寻址:MOV R0,R1,LSL #2 R0=R1*4
寄存器间接寻址:LDR R0,[R1] 将R1寄存器中的值作为地址,取出地址中的值赋予R0
寄存器间接基址偏移寻址:LDR R0,[R1,#-4]将R1寄存器的值-0x4的值作为地址,取出地址中的值给R0

对int a=0;这一句简单高级语言的汇编理解,首先会开辟一个内存存储单元,然后把0x0这个数放入R0寄存器,
然后再把R0寄存器的数据放入内存存储单元。所以:
MOV R0,#0
STR R0,[R11,#0x14+var_20]

汇编指令手册

请问哪位朋友有汇编指令手册
最好哪些指令有英文全称注释
这样好理解些
比如MOV是move
JNZ是jump if not zero

lad是load

参考技术A 1.通用数据传送指令.
MOV----> move
MOVSX---->extended move with sign data
MOVZX---->extended move with zero data
PUSH---->push
POP---->pop
PUSHA---->push all
POPA---->pop all
PUSHAD---->push all data
POPAD---->pop all data
BSWAP---->byte swap
XCHG---->exchange
CMPXCHG---->compare and change
XADD---->exchange and add
XLAT---->translate
2.输入输出端口传送指令.
IN---->input
OUT---->output
3.目的地址传送指令.
LEA---->load effective address
LDS---->load DS
LES---->load ES
LFS---->load FS
LGS---->load GS
LSS---->load SS
4.标志传送指令.
LAHF---->load AH from flag
SAHF---->save AH to flag
PUSHF---->push flag
POPF---->pop flag
PUSHD---->push dflag
POPD---->pop dflag

二、算术运算指令
ADD---->add
ADC---->add with carry
INC---->increase 1
AAA---->ascii add with adjust
DAA---->decimal add with adjust
SUB---->substract
SBB---->substract with borrow
DEC---->decrease 1
NEC---->negative
CMP---->compare
AAS---->ascii adjust on substract
DAS---->decimal adjust on substract
MUL---->multiplication
IMUL---->integer multiplication
AAM---->ascii adjust on multiplication
DIV---->divide
IDIV---->integer divide
AAD---->ascii adjust on divide
CBW---->change byte to word
CWD---->change word to double word
CWDE---->change word to double word with sign to EAX
CDQ---->change double word to quadrate word

三、逻辑运算指令
———————————————————————————————————————
AND---->and
OR---->or
XOR---->xor
NOT---->not
TEST---->test
SHL---->shift left
SAL---->arithmatic shift left
SHR---->shift right
SAR---->arithmatic shift right
ROL---->rotate left
ROR---->rotate right
RCL---->rotate left with carry
RCR---->rotate right with carry

四、串指令
———————————————————————————————————————
MOVS---->move string
CMPS---->compare string
SCAS---->scan string
LODS---->load string
STOS---->store string
REP---->repeat
REPE---->repeat when equal
REPZ---->repeat when zero flag
REPNE---->repeat when not equal
REPNZ---->repeat when zero flag
REPC---->repeat when carry flag
REPNC---->repeat when not carry flag

五、程序转移指令
———————————————————————————————————————
1>无条件转移指令(长转移)
JMP---->jump
CALL---->call
RET---->return
RETF---->return far
2>条件转移指令(短转移,-128到+127的距离内)
JAE---->jump when above or equal
JNB---->jump when not below
JB---->jump when below
JNAE---->jump when not above or equal
JBE---->jump when below or equal
JNA---->jump when not above
JG---->jump when greater
JNLE---->jump when not less or equal
JGE---->jump when greater or equal
JNL---->jump when not less
JL---->jump when less
JNGE---->jump when not greater or equal
JLE---->jump when less or equal
JNG---->jump when not greater
JE---->jump when equal
JZ---->jump when has zero flag
JNE---->jump when not equal
JNZ---->jump when not has zero flag
JC---->jump when has carry flag
JNC---->jump when not has carry flag
JNO---->jump when not has overflow flag
JNP---->jump when not has parity flag
JPO---->jump when parity flag is odd
JNS---->jump when not has sign flag
JO---->jump when has overflow flag
JP---->jump when has parity flag
JPE---->jump when parity flag is even
JS---->jump when has sign flag
3>循环控制指令(短转移)
LOOP---->loop
LOOPE---->loop equal
LOOPZ---->loop zero
LOOPNE---->loop not equal
LOOPNZ---->loop not zero
JCXZ---->jump when CX is zero
JECXZ---->jump when ECX is zero
4>中断指令
INT---->interrupt
INTO---->overflow interrupt
IRET---->interrupt return
5>处理器控制指令
HLT---->halt
WAIT---->wait
ESC---->escape
LOCK---->lock
NOP---->no operation
STC---->set carry
CLC---->clear carry
CMC---->carry make change
STD---->set direction
CLD---->clear direction
STI---->set interrupt
CLI---->clear interrupt

六、伪指令
—————————————————————————————————————
DW---->definw word
PROC---->procedure
ENDP---->end of procedure
SEGMENT---->segment
ASSUME---->assume
ENDS---->end segment
END---->end

参考资料:http://iask.sina.com.cn/b/7447263.html?from=related

本回答被提问者采纳
参考技术B 自己总结,别偷懒!

以上是关于实用汇编指令的主要内容,如果未能解决你的问题,请参考以下文章

汇编语言指令

汇编基础 汇编指令

汇编neg指令?

汇编指令手册

ARM 汇编语言指令

汇编语言-基础知识