汇编基本指令的学习

来源:互联网 发布:杰恩马克眼镜 知乎 编辑:程序博客网 时间:2024/05/23 19:19
1:ldr 伪指令
LDR{cond}{.W} Rt, =expr
Rt :  is the register to be loaded.
expr :evaluates to a numeric value.


2:ldr指令 装载load 内存--》寄存器
op{type}{cond} Rt, [Rn {, #offset}] ; immediate offset
Rt :is the register to load or store.


Rn :is the register on which the memory address is based
例子:
LDR r8,[r10] ; loads R8 from the address in R10:把r8的数值放入r10所表示的地址。
.
LDRNE r2,[r5,#960]! ; (conditionally) loads R2 from a word 960 bytes above the address in R5, and increments R5 by 960.


3:str指令 存储 store 寄存器--》内存
STR r2,[r9,#consta-struc] :  把r2的值存储到r9的地址constr-struc以上的地址。
 consta-struc is an expression evaluating  to a constant in the range 0-4095.


4:stm指令 ldm
stmdb :相当于stmfd 先pc减rn再放入sp中
stmia : 先把rn放入sp中,pc然后再加
ldmdb : 
ldmia :ldmfd
DB (Decrement Before) IA (Increment After)
op{addr_mode}{cond} Rn{!}, reglist{^}
 
If ! is present, the final address is written back into Rn.
如果you感叹号把最终地址传给rn。
For example:
STMFD sp!, {r0-r5} ; Push onto a Full Descending Stack
LDMFD sp!, {r0-r5} ; Pop from a Full Descending Stack
5:宏
MACRO     宏名字
{$label} macroname{$cond} {$parameter{,$parameter}...}
; code
MEND
6:
0 0
原创粉丝点击