ARM assembly: What do IA, IB, DA, DB and FD, ED, FA, EA mean in assembly?

Publisher:lidong4069Latest update time:2019-09-23 Source: eefocusKeywords:ARM  Assembly Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

In the multiple data transfer (STM, LDM) of ARM instructions, it is mentioned that the Load and Store instructions of multiple registers are divided into 2 groups:

A set of data storage and reading, corresponding to IA, IB, DA, DB,

One set is used for stack operations, corresponding to FD, ED, FA, EA,


The corresponding instructions in the two groups have the same meaning.


IA: increase after; indicates that the address increases after data transmission

IB: increase before

DA: decrease after

DB: decrease before


Right now:


STMIB (address increments first and then completes the operation)

 

STMFA (Full Incrementing Stack)

 

STMIA (Complete Operation Then Increment Address)

 

STMEA (empty incrementing stack)

 

 

 

STMDB (address is reduced first and then the operation is completed)

 

STMFD (full decrementing stack)

 

STMDA (complete operation and then decrement address)

 

STMED (empty decrementing stack)

The two commands in the above groups have the same meaning but are applicable to different occasions. Similarly, there are:


LDMIB, LDMED;

 

LDMIA, LDMFD;

 

LDMDB, LDMEA;

 

LDMDA, LDMFA.


IA mode means: after each transmission, the address is increased by 4; (After Increase)


DB mode means: before each transmission, the address is -4; (Before Decrease)


There are 8 modes for multi-register load/store instructions (4 for data block transfers and 4 for stack operations)



The STMDB and LDMIA instructions are generally used in pairs. STMDB is used to push registers onto the stack, and LDMIA is used to pop registers off the stack. Their function is to save the used registers.



Example 1:


Instruction: stmdb sp!,{r0-r12,lr}

Meaning: sp = sp - 4, first press lr, sp = lr (that is, put the content in lr into the memory address pointed to by sp). sp = sp - 4, then press r12, sp = r12. sp = sp - 4, then press r11, sp = r11...sp = sp - 4, finally press r0, sp = r0.


If you want to pop out r0-r12 and lr, you can use the ldmia instruction: ldmia sp!,{r0-r12,lr}


Example 2:

STMIA, for example, if the current memory address pointed to by r0 is 0x1000, STMIA R0!,{R1-R7} means first storing r1 at 0x1000, then r2 at 0x1004, then r3 at 0x1008. If it is a 32-bit processor, 4 bytes are added each time, and r1-r7 are stored in increasing addresses. This r0! means starting from the address of r0. STMDB means that the address decreases from r0 and is stored in sequence.


Example 3:


LDMIA:LDM means multiple register access. The following parameters are separated by “,”. The first parameter is the first address; the second parameter is the register list, which is enclosed in “{}”.

LDMIA R0!, {R1-R4}; R0 represents the first address of the storage space to be operated. The number of data to be operated is determined by the register list, which is now R1 to R4, a total of 4 data (each data is 32 bits)


specific:

The data in the storage space at address R0 is assigned to R1

The data in the storage space at address R0+4 is assigned to R2

The data in the storage space at address R0+8 is assigned to R3

The data in the storage space at address R0+12 is assigned to R4


The storage space and register status of all example instructions before execution:

mem32[0x1000C] = 0x04

mem32[0x10008] = 0x03

mem32[0x10004] = 0x02

mem32[0x10000] = 0x01

r0 = 0x00010000

r1 = 0x00000000

r3 = 0x00000000

r4 = 0x00000000

After execution, the storage space remains unchanged, but the registers change:

r0 = 0x00010010

r1 = 0x01

r2 = 0x02

r3 = 0x03

r4 = 0x04


Keywords:ARM  Assembly Reference address:ARM assembly: What do IA, IB, DA, DB and FD, ED, FA, EA mean in assembly?

Previous article:ARM assembly: load and store instruction set (six categories)
Next article:s3c2440——implementation of simple printf function for bare metal

Recommended ReadingLatest update time:2024-11-16 13:51

ARM interrupt vector design scheme
In a 32-bit ARM system, a branch instruction or a PC register load instruction is usually placed in the interrupt vector table to implement the function of the program jumping to the interrupt service routine. For example: IRQEntry B HandleIRQ ; jump range is smaller B HandleFIQ Or IRQEntry LDR PC, =
[Microcontroller]
Design of Intelligent Motor Protector Based on ARM Microprocessor LPC2132
1 Introduction With the development of motor control center (MCC) technology, modularization has been more and more widely used, and at the same time, higher requirements have been put forward for motor protection. In view of the development trend of higher and higher automation of electrical monitoring systems
[Microcontroller]
South Korean company launches 3D perception software platform compatible with all 3D lidar sensors
According to foreign media reports, South Korean company Seoul Robotics has launched a 3D perception software platform - SENSR™, which is compatible with all mainstream 3D lidar sensors. With the launch of SENSR™, Seoul Robotics has become the first company to provide commercial 3D perception software solutions that a
[Automotive Electronics]
South Korean company launches 3D perception software platform compatible with all 3D lidar sensors
Design of media player based on ARM9
1 Introduction   The rapid development of computer multimedia technology and network technology has made multimedia applications based on streaming media also used in many fields, especially in network videophone, remote monitoring, and video on demand. With the maturity of computer multimedia compression technology a
[Power Management]
Design of media player based on ARM9
OK6410A development board (eight) 83 linux-5.11 OK6410A arm-gdb+JLinkGDBServer+Jlink+JTAG interface debugging u-boot
Previously at https://blog.csdn.net/u011011827/article/details/118713517 You can see that you can debug bare metal. It can be seen that I loaded the bin file to 0x50000000, which is the space of external sdram So before loading, it must be initialized, and u-boot helps to do this initialization (u-boot is burned in
[Microcontroller]
Using ARM9 microprocessor PXA270 chip to realize low power consumption embedded computer
introduction Green environmental protection and energy saving are the global trend, and embedded computer systems are widely used in portable and highly mobile products. Low power consumption design is not only a requirement for green environmental protection, but also a constraint on the volume and quality of embedde
[Microcontroller]
Using ARM9 microprocessor PXA270 chip to realize low power consumption embedded computer
Disassembling the 3DS to explore Nintendo's naked-eye 3D graphics technology
"3DS is the result of our many years of dedication to the commercialization of 3D technology" ... 8 months ago, Nintendo's representative director and president Satoru Iwata made this high-profile announcement. On February 26, 2011, the portable game console "Nintendo 3DS" was
[Home Electronics]
Disassembling the 3DS to explore Nintendo's naked-eye 3D graphics technology
8. Learn ARM from scratch - inline assembly, mixed assembly, ATPCS rules
1. gcc inline assembly Inline assembly is programming directly using assembly statements in C, so that the program can implement some tasks that C language cannot complete in C program. For example, inline assembly or embedded assembly must be used in the following situations. Using Saturating Arithmetic in Programs
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号