Labels in arm assembly

Source: Internet
Author: User
Labels in arm assembly

Label is the name of a group of machine commands, indicating the commands or data addresses in the program. Labels are optional. labels are assigned to a statement only when a symbolic address is required to access the statement. By placing a label in front of the target address, you can use the label in the command to replace the address directly. A label is a program target sign and is always associated with an address for transfer or cyclic Instruction Control Transfer. The number is used by the Compilation Program. That is to say, the number in the code generated in the program is replaced with the corresponding value.

Because the label indicates the instruction address, it has three attributes: Segment attribute, offset attribute, and type attribute. The segment attribute is the segment address, and the label segment must be in CS. The offset attribute indicates the distance from the label to the first segment address. The unit is byte and it is a 16-bit unsigned integer. The Type attribute is the distance property, indicator number, and transfer instruction distance. This label is referenced in this section, and the distance is-128 ~ The distance attribute is short. When the label is in the current segment, the distance is-127 ~ The distance attribute is near. When the referenced label instruction and label are not in the same segment, the distance attribute is far.

According to the label generation method, there are three types:

1. PC-based labels.
The PC-based label is located before the target command or before the program data definition pseudo operation. During assembly, this label is processed as a PC value plus (or minus) a numerical constant. It is often used to indicate the target address of the jump command, or a small amount of data embedded in the code segment.
2. Register-based labels.
Register-based labels are commonly used for map and field undefined operations. You can also use equ pseudo-definition. This label is added (or subtracted) to a data constant to the value processed into a register during assembly. It is often used to access data in data segments.
3. Absolute address.

The absolute address is a 32-bit data. It can address the power of 2 to the power of-1, that is, it can directly address the entire memory space.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.