当前位置:网站首页>Arm common assembly instructions
Arm common assembly instructions
2022-04-23 06:48:00 【tilblackout】
1、 Commonly used instructions
(1)LDR、STR、MOV
LDR R0,[R1] #R0 = *R1, Read R1 Points to the contents of the memory area , Deposit in R0
STR R0,[R1] #*R1 = R0, take R0 write in R1 Point to memory area
MOV R0,R1 #R0 = R1
MOV R0,#0X10 #R0 = 0x10
LDR R0,=0X12345678 #R0 = 0x12345678 # If there is no equal sign, it will 0x12345678 The value pointing to memory is taken out and put into R0
Pseudo instruction , All instructions are 32 position , but MOV You can't do it all at once 32 The value of a , Because it has several bits to represent registers and instructions
(2)add、sub
add r0,r1,#4 #r0=r1+4
sub r0,r1,#4 #r0=r1-4
sub r0,r1,r2 #r0=r1-r2
(3)B、bl
B # An unconditional jump order
bl main # Jump to main, And save the address of the next instruction in lr In the register
(4)ldmia、stmdb
// The stack is stored down from the high address
ldmia sp,{fp,sp,pc}
1.ldm Read memory for ,m by many
2. There is a high value in the memory number register , It has nothing to do with the order written later
3.ia by increase after, That is, read first and then add
stmdb sp!,{sp,ip,lr,pc}
1.db by decrease before, That is, reduce first and then deposit
2. Exclamation mark indicates SP Equal to the final modified SP value
(5)MRS、MSR
MRS: Transfer the contents of the program status register to the general register .MRS <Rd>,CPSR/SPSR
MSR: Transfers the contents of the operands to a specific field in the program status register .MSR CPSR/SPSR,<Rd>
MRC and MCR similar .
(6)teq、cmp
teq: Test register and register / Whether the immediate values are equal , If equal set CPSR The median condition is 1
teq r0, r1
ADDeq R0, R0, #1; # if R0 == R1, eq It's true , be R1=R1 + 1
cmp: Compare the size of two operands
CMP R0, R1;
ADDHI R0, R0, #1; # if R0>R1,HI It's true , be R0=R0+1
ADDLS R1, R1, #1; # if R0<=R1,LS It's true , be R1=R1+1
(7)adr Instructions : Calculate the relative offset , The front and back addressing space is 4K
start:MOV r0,#10
ADR r4,start # Equivalent to SUB r4,pc,#0xc, Because of the current pc Value for this instruction +8 , therefore -0xc
2、 Other
ADC Add instruction with carry
ADD Add instruction
AND Logic and instruction
B Jump instruction
BIC Bit clear instruction
BL Jump instruction with return
BX Jump instructions with state switching , The lowest is 1 when , perform Thumb Instructions , by 0 when , perform ARM Command execution
BLX Jump instructions with return and state switching
CDP Coprocessor data operation instructions
CMN Compare inverse instructions
CMP Comparison instruction
EOR XOR instruction
LDC Data transfer instructions from memory to coprocessor
LDM Load multiple register instructions
LDR Memory to register data transfer instructions
MCR from ARM Register to coprocessor register data transfer instructions
MLA Multiply and add instructions
MOV Data transfer instructions
MRC From coprocessor registers to ARM Register data transfer instructions
MRS delivery CPSR or SPSR Content to general register instruction
MSR Transfer general registers to CPSR or SPSR Instructions
MUL 32 Bit multiplication instructions
MLA 32 Bit multiply plus command
MVN Reverse data transfer instruction
ORR Logic or instruction
RSB Reverse subtraction instruction
RSC Reverse subtraction with borrow
SBC With borrow subtraction instructions
STC Coprocessor registers write memory instructions
STM Bulk memory word write instructions
STR Register to memory data transfer instruction
SUB Subtraction instructions
SWI Software interrupt command
SWP Exchange instructions
TEQ Equality test instructions
TST Bit test instructions
--------------------------------------------------
Condition code Mnemonic suffix sign meaning
0000 EQ Z Set up equal
0001 NE Z Zero clearing It's not equal
0010 CS C Set up The unsigned number is greater than or equal to
0011 CC C Zero clearing The unsigned number is less than
0100 MI N Set up negative
0101 PL N Zero clearing A positive number or zero
0110 VS V Set up overflow
0111 VC V Zero clearing No overflow
1000 HI C Set up Z Zero clearing The unsigned number is greater than
1001 LS C Zero clearing Z Set up The unsigned number is less than or equal to
1010 GE N be equal to V The signed number is greater than or equal to
1011 LT N It's not equal to V The signed number is less than
1100 GT Z Clear and [N be equal to V] There are signs greater than
1101 LE Z Set or [N It's not equal to V] The signed number is less than or equal to
1110 AL Ignore Unconditional execution
版权声明
本文为[tilblackout]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230549282527.html
边栏推荐
猜你喜欢
信息学一本通-小球
记第一次使用阿里字体图标库
MOS tube characteristics and conduction process
PN结、二极管原理详解与应用
Collection of practical tips for C language (continuously updated)
Qt 添加QSerialPort类 实现串口操作
[UDS unified diagnosis service] IV. typical diagnosis service (1) - diagnosis and communication management function unit
[UDS unified diagnostic service] IV. typical diagnostic service (5) - function / component test function unit (routine function unit 0x31)
VHDL finite state machine (FSM) code example
[UDS unified diagnostic service] II. Network layer protocol (2) - data transmission rules (single frame and multi frame)
随机推荐
uniapp 自定义搜索框适配小程序对齐胶囊
2020 Jiangsu Collegiate Programming Contest-A.Array
Notes on advanced points of C language 2
ES6的新特性
查漏补缺(九)---程序篇
Node的文件系统及Buffer概述
Special register C51 / C52
Quaternion multiplication
js根据名字将数组对象中名字相同的项组成一个相同的数组
Node的数据库编程
约瑟夫序列 线段树 O(nlogn)
Eigen 学习总结
PN结、二极管原理详解与应用
FOC电机库 定点PID代码分析
2022ldu winter vacation training - program patch
Error in created hook: “ReferenceError: “Promise”未定义“
TensorFlow张量介绍
VHDL arbitrary frequency divider (50% duty cycle)
C语言 #和##的使用
ARM常用汇编指令