The addressing mode is for the source operand.
6.1 Immediate addressing
The source operand is an immediate value
Immediate number: The number starting with the # sign in the opcode is the immediate number.
Immediate addressing: MOV R0, #0x300
Pseudo-instruction: LDR R0,=0x12345678
Notice:
The immediate data is 8-bit data storage, represented by
The immediate value 0xf200 is indirectly represented by 0xcf2, that is, the 8-bit F2 is rotated right by 24 bits (2 * 12) to obtain X = 0xf2; Y = 0xC
6.2 Register addressing
MOV R0,R1
The source operand is a register
6.3 Register shift addressing
Shift the source operand addressed by the register
MOV R0, R2, LSL, #3
After shifting R2 to the left by 3 bits, assign it to R0
6.4 Register indirect addressing
ARM consists of L/S structure, namely load/store
LOAD loads memory data into registers
STROE stores the data in the register into memory
instruction:
LDR R0, {R1} take out the value in {R1} and put it into R0
STR R0, {R1} Take out the value in R0 and put it into R1
{R1} means taking the data in the address stored in R1 and replacing it with C language, that is, *R1
1 MOV R1, #0x40000000
2 LDR R0, {R1}
3 STR R0, {R1}
4
5 //If the data represented by the data 0x40000000 in R1 is 0x55, then the value of R0 is 0x55
6.5 Base address indexed addressing
MOV R0, #44
MOV R1, #0x40000008
STR R0, [R1, #-4]
[R1, #-4] means the address value stored in R1 - 4
#-4 represents the offset
STR R0, [R1, #-4]!
! means write-back, which is i-- in C language. The previous sentence first assigns the address value of R1 to R0, and then assigns the value in R0 - 4
The previous sentence is equivalent to STR R0,[R1], #-4
6.6 Multiple register addressing
STMIA R0!, {R1 - R3, R5}
Store the values in R1 R2 R3 R5 in the address space starting from R0
The content in curly brackets represents the value in the register, and R0 corresponds to the memory address.
STM: Manipulate the values of multiple memories
The corresponding command is LDMIA
I/D (increase/decrease) A/B (after/before)
6.7 Stack addressing
To perform stack operations, the stack register is R13, which is the SP register.
STMFD SP!, {R1-R3} push onto the stack, the register with the larger number is pushed onto the stack first, it has nothing to do with the writing order.
LDMFD SP!, {R1-R3} pop
Combination: F(FULL)/E(EMPTY) I/D
Generally written as FD, because the address space of ARM is full-decreasing.
Full stack: The stack pointer points to the last valid data item pushed
Empty stack: The stack pointer points to the next empty location to be pushed.
MOV SP, #0x40000010
STMFD SP!, {R1-R4}
That is, the value of R4 R3 R2 R1 is stored in 0x4000000c 0x40000008 0x40000004 0x40000000
6.8 Relative addressing
The jmp and call instructions used in 51
Relative addressing is a jump. Relative addressing is relative to the PC. Jump instruction: B BL BLX BX
B: jump instruction
BL: Jump instruction with return
BLX: Jump instruction with return and state switching
BX: Jump instruction with status switching
Previous article:7. ARM instruction set
Next article:5. Reduced instruction set and complex instruction set instruction formats
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sensors and measurement and control circuits
- Advanced usage of embedded C language
- A strange problem of TMS320F2812 caused by an eCAN bug
- [Evaluation of EVAL-M3-TS6-665PN development board] 2. Detailed explanation of functions
- A brief discussion on PCI_Express architecture.rar
- Free application: Allwinner heterogeneous multi-core AI intelligent vision V853 development board
- [Mill MYB-YT507 development board trial experience] Python displays memory and CPU real-time status 2
- I can't understand the circuit diagram at all
- [ESP32-Audio-Kit Audio Development Board Review] Part 2: ESP-ADF Pitfalls in the vs code Environment
- Infrared ToF technology will significantly improve the performance and reliability of proximity sensors