label - follows identifier rules and ends with ':' instruction - assembler instruction op code pseudo-instruction - assembler pseudo-instruction op code directive - assembler directive comment - comment text following ;
3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
N Z C V - - - - - - - - - - - - - - - - - - - - I F T [ Mode ]
[ flags field ] [status field ] [exten. field ] [control field]
Flags field
N - Negative bit 31
Z - Zero bit 30
C - Carry bit 29
V - Overflow bit 28
Control field
I - IRQ Disable bit 7
F - FIQ Disable bit 6
T - Thumb State bit 5
M - Mode bits 0-4
ADC
ADD
AND
B
BL
BIC
CMN
CMP
EOR
LDM
LDMIA
LDMIB
LDMDA
LDMDB
LDR
LDRB
LDRSB
LDRH
LDRSH
MLA
MRS
MSR
MUL
MOV
MVN
ORR
POP
PUSH
RSB
RSC
SBC
SMLAL
SMULL
STM
STMIA
STMIB
STMDA
STMDB
STR
STRB
STRSB
STRH
STRSH
SUB
SWP
SWPB
SVC
SWI
TEQ
TST
UMLAL
UMULL
1
12345
01loop
Rm, shiftcode #immediate
Rm, shiftcode Rs
Shift codes
ASR, LSL, LSR, ROR
{}
{R0}
{R0-R15}
{R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15}
{SB, FP, IP, SP, LR, PC}
{R0-R3, R4-R7, R10-R15}
{R0-R8, SB, FP, IP, SP, LR, PC}
LDR, LDRB, LDRSB, LDRH, LDRSH
STR, STRB, STRSB, STRH, STRSH
Opcodes OPD - double word
LDRD
STRD
| condcode | see Conditional Excecution Code | |
| offset | see Immediate Offset |
LDR R2, [R1]
LDR R2, [R1,#12]
STR R0, [R3,#20]!
STR R3, [R4],#40
LDM, LDMIA, LDMIB, LDMDA, LDMDB
STM, STMIA, STMIB, STMDA, STMDB
| addressing_mode | see Addressing Mode Code | |
| condcode | see Conditional Excecution Code | |
| register_list | see Register list |
LDM SP,{R0-R14}^
LDMDB R0,{R0-R15}
STMBIA SP,{R1,R2
STMDB R13!,{R1,R4-R8}
PUSH
POP
| condcode | see Conditional Excecution Code | |
| register_list | see Register list |
PUSH {R0-R15}
PUSH {R1.R2,R8}
PUSH {FP}
POP {R0,R1,R2,R3}
POP {R0,R1,R2,R3,PC}
AND, EOR, SUB, RSB, ADD, ADC, SBC, RSC, TST, TEQ, CMP, CMN, ORR, MOV, BIC, MVN
ANDS, EORS, SUBS, RSBS, ADDS, ADCS, SBCS, RSCS, TSTS, TEQS, CMPS, CMNS, ORRS, MOVS, BICS, MVNS
| condcode | see Conditional Excecution Code | |
| Operand2 | see Operand2 |
OP{condcode} Rn, #8bit_immediate
OP{condcode} Rd, Rn, #8bit_immediate
OP{condcode} Rd, Rn, Rm
OP{condcode} Rn, Rm
OP{condcode} Rd, Rn, Rm, shiftcode #immediate
OP{condcode} Rn, Rm, shiftcode #immediate
OP{condcode} Rd, Rn, Rm, shiftcode Rs
OP{condcode} Rn, Rm, shiftcode Rs
ADD R0, R1, R2
SUBS R4, R7, R8
SBCS R3, R5, FP
MOV R0, R1
MOVN R0, R1
MOVS LR, LR, LSL R5
Opcodes
B BL
| condcode | see Conditional Excecution Code | |
| immediate | User specified 24 bit signed immediate value represeting target address relative offset from current PC. The target address is calculated by:
|
B #0
BL #0
Opcodes
SVC
| condcode | see Conditional Excecution Code | |
| immediate | User specified immediate value ignored by the processor. 24 bit when assembling ARM instruction set |
SVC #1
Opcodes
SWI
Multiply 32 bit signed or unsigned values in registers Rm and Rs
Store least significant 32 bits of the result in the destination register Rd.
Opcodes
MUL
MULS
| condcode | see Conditional Excecution Code |
MUL R0,R1,R2
MULS R3,R4,R5
Multiply 32 bit signed or unsigned values in registers Rm and Rs add value in the register Rn.
Store least significant 32 bits of the result in the destination register Rd.
Opcodes
MLA
MLAS
| condcode | see Conditional Excecution Code |
MLA R0,R1,R2,R4
MLAS R5,R6,R7,R8
Multiply 32 bit signed values in registers Rm and Rs add value in the register RdLo and RdHi.
Store least significant 32 bits of the result in the destination register RdLo.
Store most significant 32 bits of the result in the destination register RdHi.
Opcodes
SMLAL
SMLALS
| condcode | see Conditional Excecution Code |
SMLAL R0,R1,R2,R4
SMLALS R5,R6,R7,R8
Multiply 32 bit signed values in registers Rm and Rs.
Store least significant 32 bits of the result in the destination register RdLo.
Store most significant 32 bits of the result in the destination register RdHi.
Opcodes
SMULL
SMULLS
| condcode | see Conditional Excecution Code |
SMULL R0,R1,R2,R4
SMULLS R5,R6,R7,R8
Multiply 32 bit unsigned values in registers Rm and Rs add value in the register RdLo and RdHi.
Store least significant 32 bits of the result in the destination register RdLo.
Store most significant 32 bits of the result in the destination register RdHi.
Opcodes
UMLAL
UMLALS
| condcode | see Conditional Excecution Code |
UMLAL R0,R1,R2,R4
UMLALS R5,R6,R7,R8
Multiply 32 bit unsigned values in registers Rm and Rs.
Store least significant 32 bits of the result in the destination register RdLo.
Store most significant 32 bits of the result in the destination register RdHi.
Opcodes
UMULL
UMULLS
| condcode | see Conditional Excecution Code |
UMULL R0,R1,R2,R4
UMULLS R5,R6,R7,R8
Store value in register Rm in memory location addressed by register Rn.
Load Rd with the original value in memory location addressed by the register Rn.
When both Rm and Rd specify the same register then value in Rm is swapped with the
value in memory location addressed by register Rn.
Swap is an atomic operation that can be used to implement semaphores.
SWP swaps words while SWPB swaps bytes.
Opcodes
SWP
SWPB
| condcode | see Conditional Excecution Code |
SWP R0,R0,[R1]
SWPB R2,R3,[R4]
Move either the CPSR or the SPSR of the current mode to register Rd.
Opcodes
MRS
| condcode | see Conditional Excecution Code see Current Program Status Register CPSR see Saved Program Status Register SPSR |
MRS R0,CPSR
MRS R0,SPSR
Load either the CPSR or the SPSR with constant or value in register Rm.
Flags will be set based on selected fields.
Opcodes
MRS
| condcode | see Conditional Excecution Code see Current Program Status Register CPSR see Saved Program Status Register SPSR |
MSR CPSR_fsxc, #0
MSR SPSR_fsxc, [R0]
// MOV32 R0, 0 //
LDR R0, =1
AREA .text