Structure of an ARM Instruction
All ARM instructions conform to the following structural layout:
label <space> opcode <space> operands <space>; comment
- Each field (label, opcode, operands and comment) must be separated by one or more <space> elements.
A <space> element can be an actual space character (from your space bar) or a tab.
- If there is no label, there must be a <space> element before the actual instruction (i.e. the opcode and any operands).
- The semicolon character indicates the start of a comment, which is terminated by the end of the line.
- All sections are optional. Blank lines will be accepted by the assembler, making it easier to improve code clarity.
Types of Instructions
There are three broad categories of instruction in the ARM assembly language.
Data Processing Instructions
- arithmetic operations
- logical operations
- comparison operations
- register movement operations
Data Movement Instructions
These instructions load and store data from and to memory.
Control Flow Instructions
These are software interrupts and branch instructions that alter the order of execution.
NOTE: For ARM data processing instructions, operands (values) are always 32 bits wide.
The operands are either held in registers or are specified as constants (called literals) in the instruction itself. The result of a data processing instruction is also a 32 bit datum and is stored in a register. Most data processing instructions will have three operands, two of which are inputs and one for the result.