Assembly Instructions
Assembly Instructions
1 . Data types
Instructions Type Size
DCB Byte 8 bits | 1 Byte
DCW Halfword 16 bits| 2 Bytes
DCD Word 32 bits | 4 Bytes
DCQ 64 bits | 8 Bytes
2. Load instructions :
→ LDR is used to load something from memory into a register
LDRSB Signed byte 32 bits | 4 Bytes load to register a signed Byte ( load 8 bits , and fill the rest 24 bits
with the same bit of sign )
LDRSH Signed Halfword 32 bits | 4 Bytes load to register a signed Halfword ( load 16 bits , and fill the rest 16
bits with the same bit of sign )
3. Store instructions
→STR is used to store something from a register to a memory address.
Store Instuction Size & Type Size Comment
STR Word 32 bits | 4 Bytes Store word
STRB Byte 8 bits | 1 Byte Store unsigned Byte
STRH Halfword 16 bits| 2 Bytes Store unsigned haflword
STRSB Signed byte 32 bits | 4 Bytes Store signed Byte
STRSH Signed Halfword 32 bits | 4 Bytes Store signed Halff Word
4. Instructions
Instruction Comment
Memory Address Is written on 32 bits
RAM Address 0x20000000
in the RAM memory, user capable of reading and writing
( 0x2000000 < ) : in the flash memory user is only capable of reading which mean :
user can’t use the STR instruction !
=label The address of the that label
Align Add Zeros to the memory until it finds an address that is a multiple of 4
[R1] The content pointed by R1
[R1, #2] The content pointed by ( the value of R1 increased by 2)
PS : the value of R1 rest unchanged after this operation
[R1,#2]! The content pointed by ( the value of R1 increased by 2)
PS : the value of R1 will be changed after this operation
[R1],#2 The content pointed by R1
PS : after this operation the value of R1 will be increased by 2
5. ARM Registers
8. B / BX / BLX
There are three types of branching instructions:
▪ Branch (B)
o Simple jump to a function
▪ Branch link (BL)
o Saves (PC+4) in LR and jumps to function
▪ Branch exchange (BX) and Branch link exchange (BLX)
o Same as B/BL + exchange instruction set (ARM <-> Thumb)
o Needs a register as first operand: BX/BLX reg