Assembly Language Instruction Set - A-Levels Computers
ARMlite Assembly Language Instruction Set
In the interest of giving learners real-life experiences, we have opted to reference ARMlite, which is a cut-down version of the assembly language instruction set used for programming the ARM chips that are found in a multitude of different devices, including Raspberry Pi computers. Teachers may choose to teach this in a purely theoretical way.
This list of Assembler instructions is a subset of the instruction set for the ARMlite simulator written by Peter Higginson.
ARMlite simulates a simple computer built around a cut-down version of a 32-bit Arm processor. It has 13 general-purpose registers (R0–R12) and three special-purpose registers. The first operand for all data processing operations must be a register. The second operand can be either an immediate value (#x) or a register (Rn).
Immediate values may be specified in decimal, hex or binary format, preceded by a #.
Comments are prefixed by a semicolon ;. They may be added after an instruction or on a line on their own.
Labels are used to specify the location of instructions for branching and to specify locations for loading and storing data. Labels must start with a letter and may be made up of upper- and lower-case letters and numbers.
ARMlite instruction reference
| Instruction | Description |
|---|---|
| Arithmetic and logical operations | |
ADD Rd, Rn, <operand> | Add the value in <operand> to the value in register Rn and store the result in register Rd. |
SUB Rd, Rn, <operand> | Subtract the value in <operand> from the value in register Rn and store the result in register Rd. |
AND Rd, Rn, <operand> | Perform a bitwise logical AND between the values in register Rn and <operand>, and store the result in register Rd. |
ORR Rd, Rn, <operand> | Perform a bitwise logical OR between the values in register Rn and <operand>, and store the result in register Rd. |
EOR Rd, Rn, <operand> | Perform a bitwise logical XOR between the values in register Rn and <operand>, and store the result in register Rd. |
MVN Rd, <operand> | Perform a bitwise logical NOT to the value in <operand>, and store the result in register Rd. |
LSL Rd, Rn, <operand> | Logically shift the value stored in register Rn to the left by the number of bits specified by <operand> and store the result in register Rd. |
LSR Rd, Rn, <operand> | Logically shift the value stored in register Rn to the right by the number of bits specified by <operand> and store the result in register Rd. |
| Comparison and branch instructions | |
CMP Rn, <operand> | Compare the value in <operand> with the value stored in register Rn and set status bits based on the outcome. |
B <label> | Unconditionally branch to the address at position <label>. |
B<condition> <label> | Conditionally branch to the instruction at position <label> when the last CMP instruction result matches the specified <condition>. |
| Data movement and other instructions | |
MOV Rd, <operand> | Move the value in <operand> into register Rd. |
LDR Rd, <address> | Load the contents of the memory location <address> into register Rd. |
STR Rd, <address> | Store the contents of Rd to the memory location <address>. |
HALT | Halt program execution. |
| Syntax notes | |
<operand> | References either #x decimal value or Rn register n. |
<condition> | EQ equal to, NE not equal to, GT greater than, LT less than. |
<label>: | A label definition is formed by an identifier followed by a colon. |
Rd, Rn | General-purpose registers R0 to R12. |